Question: locating positions of a Fasta seq in bam file
0
gravatar for ahmedakhokhar
5 days ago by
ahmedakhokhar110
Belgium
ahmedakhokhar110 wrote:

Hi, I am new to whole-genome alignments and sequencing (and this naive question might have asked before and answer several times, my humble apologies). I have a sequence in a .fasta file (length ~3kb) without its genomic coordinates; all I want to know is that:

what is the genomic location of this .fasta seq in the .bam file?, (and retrieve its genome coordinates from the bam file),

Can someone suggest a tool or steps that are involved in such minor data processing? Thanks

assembly • 117 views
ADD COMMENTlink modified 4 days ago • written 5 days ago by ahmedakhokhar110

Does the BAM file contain the alignment of your fasta file to something else (presumably another fasta file)?

ADD REPLYlink written 4 days ago by Devon Ryan92k

Yes, the bam file was generated from the usual genome sequencing pipeline and it should contain this .fasta seq too. I just want to know where .fasta seq present in the aligned sequence. (genomic coordinates of my .fasta seq in the bam alignment file)

ADD REPLYlink written 4 days ago by ahmedakhokhar110
1

Then use samtools view to get the starting position and calculate from the CIGAR string where the end position is.

Xref: https://bioinformatics.stackexchange.com/questions/10753/locating-positions-of-a-fasta-seq-in-bam-file

ADD REPLYlink written 4 days ago by Devon Ryan92k

samtools view [options] in.sam|in.bam|in.cram [region...]

samtools view; takes [region] coordinates, which I don't have for this seq. This is the problem I am facing. any tips?

ADD REPLYlink modified 4 days ago • written 4 days ago by ahmedakhokhar110

You don't need the region, just pipe the output to grep and grep for the contig name.

ADD REPLYlink written 4 days ago by Devon Ryan92k
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: 1219 users visited in the last hour