Truncating BAM Files
0
0
Entering edit mode
9.0 years ago
JameB11 ▴ 10

Hello,

I am trying to create a smaller BAM file from the original BAM file. The smaller BAM file should have info on only about 10 loci.

Can I not just append the mpileup() output of the region of interest to the header (samtools view -H <bam>)?

Any pointers on how I can accomplish this would be appreciated!

Thanks

bam sam RNA-Seq samtools pysam • 2.3k views
ADD COMMENT
2
Entering edit mode

samtools view with option '-L your.bed' http://www.htslib.org/doc/samtools.html

ADD REPLY
0
Entering edit mode

Sorry, but I don't have a .bed file. Just a BAM.

ADD REPLY
0
Entering edit mode
Pierre meant a bam file, not a bed one. Notice he uses samtools view
ADD REPLY
0
Entering edit mode

I executed the following but I get no output.

echo "Chr1:3631-5899" > test.bed
samtools view accepted_hits.bam -L test.bed
ADD REPLY
3
Entering edit mode

That's not a bed file. echo -e "Chr1\t3631\t5899" > test.bed would make a valid BED file.

ADD REPLY

Login before adding your answer.

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