Does Biopython Have Something Like Perl'S Bio::Locatableseq To Map Positions To Columns And Back Again
1
0
Entering edit mode
11.3 years ago
Owen S. ▴ 370

Hi,

In the past I have happily used perl's Bio::LocatableSeq to map positions in one sequence to positions in another. Does biopython's Bio.Align not have similar functionality?

Here is what I want. Given the following Align object:

from Bio.Alphabet import generic_dna
from Bio.Seq import Seq
from Bio.SeqRecord import SeqRecord
from Bio.Align import MultipleSeqAlignment
a = SeqRecord(Seq("AAAACGT", generic_dna), id="Alpha")
b = SeqRecord(Seq("AAA-CGT", generic_dna), id="Beta")
c = SeqRecord(Seq("AAAAGGT", generic_dna), id="Gamma")
align = MultipleSeqAlignment([a, b, c])

I want to be able to do this kind of thing:

align.position_to_column(seq=1, pos=2)
2

align.position_to_column(seq=1, pos=3)
4

align.column_to_position(seq=0, col=3)
3

align.column_to_position(seq=1, col=3)
None

I find it hard to believe this isn't part of Align, but I haven't been able to find any examples of this in python. Thanks in advance.

biopython • 2.7k views
ADD COMMENT
1
Entering edit mode
11.3 years ago
Peter 6.0k

Does this do what you want? http://biopython.org/wiki/Coordinate_mapping

Feedback on the mailing list please :)

ADD COMMENT
0
Entering edit mode

Thanks Peter. I didn't know about Coordinating_mapping, but it's not quite what I was looking for. This looks to me like a way of mapping genomic, mRNA, and protein coordinates (using a GenBank "or similar file" as input). I was looking for something that maps positions between sequences in an alignment (using an alignment file as input).

By the way, in pythonland, what exactly do we call a collection of code like Coordinate_mapping? It doesn't seem to be part of BioPython. It's just somebody's branch in their personal, public git repos, with a description on the biopython wiki? Are there hundreds of such branches? If so, it seems to me that BioPython would benefit from a package management system like R has (CRAN or bioconductor). Or am I missing something?

Actually, I guess I see from https://github.com/biopython/biopython/network that this is more of a special situation, where we have some code being worked on by a developer, which will (may) be merged back into the main codebase in the future.

ADD REPLY
0
Entering edit mode

That wiki page is pointing at an experimental branch on GitHub - if we had some positive feedback that this is widely useful, then it would probably end up in Biopython proper.

See also http://www.slideshare.net/pjacock/biopython-update-bosc2013/ for some thoughts on Biopython packaging and PyPI, https://pypi.python.org/pypi

ADD REPLY

Login before adding your answer.

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