Question: How can I extract sequence from a SAM file, with coordinates
gravatar for SaltedPork
3.7 years ago by
SaltedPork110 wrote:

Lets say I have chr1:65355-65398, how do i get the reads that cover this region out of the SAM? I've converted to BAM, sorted it, then indexed it, then i run it with:

samtools view align_sorted.bam chr1:65355-65398

But i return nothing, so either there''s no read in that region, or I've done something wrong along the way.

samtools view -bS align.sam > align.bam
samtools sort align.bam align_sorted.bam
samtools index align_sorted.bam align_sorted.bai

^^ Are the other commands I used.

sam samtools • 2.3k views
ADD COMMENTlink written 3.7 years ago by SaltedPork110

The command looks correct. The file probably does not contain the region. Just do a positive control:

samtools view in.bam | head -n 10

Then enter the chr and coords from the first entry and check if it is returned sucessfully.

ADD REPLYlink written 3.7 years ago by ATpoint36k

and check it's 'chr1' and not just '1'

ADD REPLYlink written 3.7 years ago by Pierre Lindenbaum129k
Please log in to add an answer.


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