This is a test version of Biostars. For the public version, visit https://www.biostars.org.
how to extract the gene sequence according to its coordinates on the reference genome?

hi, how to extract the gene sequence according to its coordinates on the reference genome? Thanks!

sequence

What have you tried? I would suggest using BioPython and string slicing notation of which there are many examples on the forum.

You also haven’t told us what format your data is in.

And do you want the whole gene (introns and exons), cDNA, CDS, protein sequences?

I am sorry I don't state my question clearly. I am writing a python script to integrate my pipeline, and there is a step which I need to get the DNA sequence by a random pair of start and end position from a quite large FASTA file. So what I want to ask is just which tool or approach can handle it quickly, biopython or else?

if it's within a python pipeline / project, then yes likely biopython is the more sensible option. Otherwise you could for instance also get this through blast if you have a blastdb formatted version of your fasta file

Thank you very much for your time!

1 answer

I found a python module named "pyfaidx" which could satisfy my needs. It can make things simple which fetch sequence from a FASTA file. And here is the link https://pypi.org/project/pyfaidx/#description

Log in to answer this question.