Difference between commands [bowtie2, samtools]
1
0
Entering edit mode
2.5 years ago
Jimpix ▴ 10

Hi! I would like to ask what is the difference between commands bellow. This wrote in oneliner:

bowtie2 -x {input.index} -U {input.fastq} | samtools view -bS -> {output}

and this two:

bowtie2 -x {input.index} -U {input.fastq} -S {output}

samtools view -u {input} -o {output}

or this is the same or the first one is shorter?

bowtie2 samtools • 1.2k views
ADD COMMENT
2
Entering edit mode
2.5 years ago
iraun 6.2k

Using the first option, the output will be directly a BAM file.

Using the second option, you will get a SAM file from the first command, and a BAM file from the second. If you don't need a SAM file, I will recommend going for the first option, it is faster and you will avoid generating huge SAM files in your computer that take a lot of space and you don't need them.

ADD COMMENT
0
Entering edit mode

Thanks! for the clear explanation

ADD REPLY
0
Entering edit mode

One more question. Why the final bam file is much bigger (about 70%) when I use the second commands, those with support sam files?

ADD REPLY
1
Entering edit mode

-u, --uncompressed Output uncompressed data. This also changes the default output format to BAM, but this can be overridden by the explicit format options or using a filename with a known suffix.

ADD REPLY
0
Entering edit mode

that is mean that bam in not always comprased type of file?

ADD REPLY
1
Entering edit mode

Hi! No problem. I have never used -u myself. Here you can read the manual of samtools, which says the same as what @GenoMax has pointed out, and also This option saves time spent on compression/decompression and is thus preferred when the output is piped to another samtools command. I guess the output is a SAM file instead of a BAM file, or some kind of uncompressed file, and that is why is bigger. You can try to see the content of the file. A BAM file is always compressed.

ADD REPLY

Login before adding your answer.

Traffic: 1637 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