Error when I tried to: Add Read group information and align PE reads to the whole human genomeĀ¶
0
0
Entering edit mode
2.8 years ago

I'm trying to align PE fastq files using 'bwa mem' and in the command I want to add the read group information so that it appears in the output .sam file

Note: I'm using jupyter notebook here is my piece of code

R1 = os.path.join(rootdir, "001_S001_L001_R1_001.fastq") 
R2 = os.path.join(rootdir, '001_S001_L001_R2_001.fastq')

SM = os.path.basename(R1).split('_')[0]                     ## Sample ID
LB = '_'.join(os.path.basename(R1).split('_')[0:2])         ## Library ID
PL="Illumina"                                               ##platform (e.g. illumina, solid)

with open(R1) as f:
    firstline = f.readline()
    RGID = '_'.join(firstline.replace(':','_').split('_')[0:4])

PU= RGID + '_' + LB                                                  ## Platform unit
index_file = '/home/phoebemagdy/workdir/PhD/Trial_Code/Ecto_Data/BWA_alignment/BWA_Index/hg19.fa'

!bwa mem -t 2 -M -R "@RG\tID:{}\tSM:{}\tPL:{}\tLB:{}\tPU:{}".format (RGID, SM, PL, LB, PU) {index_file} {R1} {R2}>  First_patient.sam

I always get the following error : /bin/bash: -c: line 0: syntax error near unexpected token (' /bin/bash: -c: line 0:bwa mem -t 2 -M -R "@RG\tID:{}\tSM:{}\tPL:{}\tLB:{}\tPU:{}".format (RGID, SM, PL, LB, PU) {index_file} {R1} {R2}> First_patient.sam' 1

I'll be grateful for any suggestions to help fixing this error...!

bwa-mem add ID readgroup • 658 views
ADD COMMENT
0
Entering edit mode

`Do you have to use a jupyter notebook for this? It seems to complicate things unnecessarily.

You could try adding echo before the bwa mem call and see which command gets printed, and if you can spot something that looks off.

ADD REPLY

Login before adding your answer.

Traffic: 2020 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6