Question: Truncating BAM Files
0
gravatar for JameB11
4.3 years ago by
JameB110
Canada
JameB110 wrote:

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.

pysam rna-seq sam samtools bam • 1.3k views
ADD COMMENTlink modified 4.1 years ago by Biostar ♦♦ 20 • written 4.3 years ago by JameB110
2

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

ADD REPLYlink written 4.3 years ago by Pierre Lindenbaum126k

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

ADD REPLYlink written 4.3 years ago by JameB110
Pierre meant a bam file, not a bed one. Notice he uses samtools view
ADD REPLYlink modified 4.3 years ago • written 4.3 years ago by Antonio R. Franco4.3k

I executed the following but I get no output.

echo "Chr1:3631-5899" > test.bed
samtools view accepted_hits.bam -L test.bed
ADD REPLYlink modified 11 weeks ago by RamRS25k • written 4.3 years ago by JameB110
3

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

ADD REPLYlink written 4.3 years ago by Devon Ryan94k
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: 2256 users visited in the last hour