Problem With Mpileup
1
0
Entering edit mode
12.5 years ago

I tried to make a coverage per base figure by processing single_reference.sam file with following commands:; samtools view -bS $1.sam > $1.bam; samtools sort $1.bam > $1.sort.bam; samtools mpileup $1.sort.bam > $1.c; cat $1.c | awk '{FS=" "}{print $2" "$4}' > $1.pileup

However, I received the following notice after running the sh:; [samopen] SAM header is present: 1 sequences.; Usage: samtools sort [-on] [-m <maxMem>] <in.bam> <out.prefix>; [bamheaderread] bgzfcheckEOF: Invalid argument; [bamheaderread] invalid BAM binary header (this is not a BAM file).; sam2bam2pileup.sh: line 4: 24893 Segmentation fault samtools mpileup $1.sort.bam > $1.c

Thanks for your gracious help!

samtools mpileup sam bam • 2.9k views
ADD COMMENT
0
Entering edit mode
12.5 years ago

Samtools sort doesn't write to standard output, rather it writes to a file for which you specify the name prefix as an argument (samtools will add the ".bam" extension itself):

samtools sort inputFile.bam outputFile

ADD COMMENT
0
Entering edit mode

Solved. Thank you so much! bow!

ADD REPLY

Login before adding your answer.

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