Mapping genetic coordinates with the Bio.SeqUtils.Mapper module.

Mapping genetic locations between different coordinate systems is an
essential part of much genomic analysis. This is a brief introduction to
the SeqMapper module.

Note: This uses the coordinate mapper currently available on my
branch. This in turn
is a branch of Peter’s branch introducing CompoundLocations. It will not
work with the old style of SeqFeature.

Configuration

The mapper and mapping positions store all positions in Python
coordinates, i.e. 0-based. Many users are working with data that is
1-based, such as GenBank or HGVS. Each map position type has a
“to_hgvs” and “to_genbank” method for easy conversion. It is also
possible to set the default print representation of mapping positions to
either of these formats:

Mapping

The first step to using the mapper is to get the exons from a GenBank or
similar file. The mapper will accept exons as a sequence of pairs, a
SeqRecord with a CDS feature, or a CDS SeqFeature. The file used in this
example is located in the Tests directory of the Biopython source code.

Once the mapper is constructed, its methods can be used to transform
positions located within the given CDS. Note that attempting to
transcribe and translate a genomic position that is not within CDS will
raise an exception. Also note that printing the list will show the repr
of the positions, which are in Python 0-based coordinates.