Entering edit mode
2.8 years ago
BeeWork
▴
10
Hi all,
I have mapped a pair-end SAMPLE_R1.fastq and SAMPLE_R2.fastq to hg.38 in Bowtie2. The mapping is fine as I could see the summary stats from the stederr file.But when I tried to convert the SAM file to BAM file.
samtools view -b -o SAMPLE.bam -S SAMPLE.sam
I have this error message:
[W::sam_read1] Parse error at line 198
samtools view: error reading file "SAMPLE.sam"
This is line 198 in the sam file
@SRR891270.1
HWI-ST281:266:C1LTTACXX:2:1101:1339:1962/1%0ANTATCACACCCCATCCTAAAGTAAGGTCAGCTAAATAAGCTATCGGGCCC%0A+%0A#41BABDDDHHFHCEEEAAFAFCCCGFF<@?E:*1?DDFDGGFFHGIH<F%0A
What problem of this line would be?
Thanks
I'm currently learning on the SAM to BAM conversion. From my understanding the code line should be;
instead of samtools view -b -o SAMPLE.bam -S SAMPLE.sam
Have a try on it and let's see if this works (mine works well). Hope this helps!
Any time you see
samtools view -bS
, it is an indication that the tutorial you are reading is outdated.Your suggested command line uses the
-b
,-S
, and-o
options, which is exactly the same set of options that BeeWork is already using. So it is effectively identical to the OP's version (except that it puts an option after the filename argumentSAMPLE.sam
, which is a bad habit especially in scripts as it does not work on all Unixes).Samtools has automatically detected the format of its input files since 2014. The
-S
option (forsamtools view
), which previously specified that the input file was SAM rather than BAM, has been ignored since samtools 1.0. There is no reason to use it.Thanks John,
Suchakan - John is correct. these flags are the same and don't need -S to specific input SAM format, samtools view should be able to detect. in samtools-view manual, it said "ignored" in -S flag.
Oh thank you so much for telling me this invaluable information; I have learned so much from you two John and BeeWork. Sorry for the inconvenience caused.