Question: Piping a bam file to samtools calmd
0
gravatar for rubic
2.5 years ago by
rubic180
United States
rubic180 wrote:

Is there way to combine these samtools commands:

  1. samtools view -h -F 0x10 <bam>

  2. samtools calmd <bam_from_step_1> <ref.fasta>

I tried this:

samtools view -h -F 0x10 <bam> | samtools calmd <ref.fasta> | samtools view -bS - > <out.bam>

But it doesn't work.

pipe calmd samtools • 1.4k views
ADD COMMENTlink modified 2.5 years ago by Dan D6.8k • written 2.5 years ago by rubic180
1

For one thing, samtools view outputs data in .sam format, not .bam format. So if calmd requires a .bam format, add -b to samtools view top give it a bam.

ADD REPLYlink written 2.5 years ago by swbarnes25.8k
3
gravatar for Dan D
2.5 years ago by
Dan D6.8k
Tennessee
Dan D6.8k wrote:

In bash you need to use - to specify that the input is coming from a pipe. You should also add the -S parameter to specify that the input is SAM (or follow the suggestion of @swbarnes2 and output BAM from view instead):

samtools view -h -F 0x10 <bam> | samtools calmd -S - <ref.fasta> | samtools view -bS - > <out.bam>
ADD COMMENTlink modified 2.5 years ago • written 2.5 years ago by Dan D6.8k
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 637 users visited in the last hour