Get genotype from reference fasta
1
1
Entering edit mode
9.9 years ago
win ▴ 990

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 • 2.3k views
ADD COMMENT
3
Entering edit mode
9.9 years ago
samtools faidx foo.fa chromosome:pos1-pos2
ADD COMMENT
0
Entering edit mode

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

pip install --user pyfaidx 
faidx foo.fa chr:pos1-pos2
ADD REPLY
0
Entering edit mode

This command produced a binary sai file. So I am still unsure how I could get genotype at pos1-pos2?

ADD REPLY
1
Entering edit mode

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

ADD REPLY
1
Entering edit mode

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

ADD REPLY
1
Entering edit mode

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 REPLY
0
Entering edit mode

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 REPLY
0
Entering edit mode

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

ADD REPLY

Login before adding your answer.

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