Question: Get genotype from reference fasta
1
gravatar for win
5.9 years ago by
win860
India
win860 wrote:

Hi all,

In NGS analysis we use a reference fasta and I wanted to know if it would be possible to get genotype at a certain genomic location from that file?

 

fasta • 1.4k views
ADD COMMENTlink modified 10 days ago by Biostar ♦♦ 20 • written 5.9 years ago by win860
3
gravatar for Devon Ryan
5.9 years ago by
Devon Ryan97k
Freiburg, Germany
Devon Ryan97k wrote:

samtools faidx foo.fa chromosome:pos1-pos2

ADD COMMENTlink written 5.9 years ago by Devon Ryan97k

And if you need to do it in a script or use Windows 

pip install --user pyfaidx 
faidx foo.fa chr:pos1-pos2
ADD REPLYlink written 5.9 years ago by Matt Shirley9.4k

this command produced a binary sai file. so i am still unsure how i could get genotype at pos1-pos2?

ADD REPLYlink written 5.9 years ago by win860
1

It prints the sequence to the screen. It just has to build an index the first time you use it.

ADD REPLYlink written 5.9 years ago by Devon Ryan97k
1

I had to run samtools faidx file.fa and then your command. Now I can see the output in FASTA format.

ADD REPLYlink written 5.9 years ago by win860
1

Yes, an unfortunate behavior of samtools is that you must invoke faidx once to generate the index, then again to fetch sequence. This is something I did not emulate with pyfaidx. 

ADD REPLYlink written 5.9 years ago by Matt Shirley9.4k

This must have already gotten fixed, since the version of samtools I have (granted, I track the github repo) will create the index (if needed) and then load it in a single go.

ADD REPLYlink written 5.9 years ago by Devon Ryan97k

You might be right, or I might be remembering incorrectly :)

ADD REPLYlink written 5.9 years ago by Matt Shirley9.4k
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: 1963 users visited in the last hour