Repository navigation
Description
Filing this meta-issue, since we don't seem to have a single place discussing this on GitHub.
My (likely biased) summary from those discussions is no one likes the current alphabet system, and most people ignore it.
Biopython has a complicated hard to use legacy alphabet system in Bio.Alphabet which is used as a typing system (e.g. can't do reverse-complement on a protein), can store some useful information like the expected letters, if gapped and the gap character (although only one), and a stop codon symbol (although only one).
The objects in Bio.Alphabet cover three-letter alphabets as well as the more commonly used one-letter alphabets, although the Seq object effectively assumes the later only. Three-letter alphabets can be used with the array-based MutableSeq object, but it is very fragile and many things break - thus #1681.
Note we do not (currently) validate the expected letters when making a sequence object with an alphabet with an explicit set of expected letters - #1040.
Discussion on #1674 (hiding alphabets) has meant we now hide the alphabet in the Seq object representation if it is the default alphabet. Discussion there, and on #1681, and on the mailing list suggests going further and removing Bio.Alphabet entirely.
Note that removal is not as simple as it might sound - it will require some delicate modifications, for example several of the parsers in Bio.SeqIO use the alphabet to store the sequence type (important metadata in more than one file format).
I personally do like the typing system aspect of the alphabet system, but think we only need a much simpler DNA/RNA/nucleotide/protein/other system (more like an enum). I started looking at that on this branch which aimed to break as little existing code as possible: https://github.com/peterjc/biopython/tree/alpha_lite
Activity
mdehoon commentedon May 5, 2019
I don't think it's productive to restart this discussion. We have been discussing this since 2005 (this is not a typo), if not earlier.
As a reminder, in August 2018 we called for a Biopython Enhancement Proposal on alphabets, where we invited people in favor of having alphabets in Biopython to work out a detailed proposal on the purpose and implementation of alphabets:
https://lists.open-bio.org/pipermail/biopython/2018-August/016524.html
with a time limit of January 1, 2020 after which alphabets would be removed from Biopython if no agreement on a proposal was reached.
Overall, there was little interest from users and developers. Thomas Wemyss stepped up to work out a proposal, but in the end concluded that it was better to remove alphabets:
https://lists.open-bio.org/pipermail/biopython/2018-October/016556.html
@peterjc Can you take over from Thomas and write a BEP?
peterjc commentedon May 5, 2019
This wasn't meant to restart the conversation - but be a visible marker. To that end, I'll lock this issue.
mdehoon commentedon May 6, 2019
@peterjc OK, thanks!
peterjc commentedon May 6, 2019
Locking the issue preventing GitHub automatically linking pull request #2050 (just merged) which declared
Bio.Alphabetas obsolete, and added aPendingDeprecationWarning(which is silent by default).See also our https://biopython.org/wiki/Deprecation_policy
peterjc commentedon Aug 16, 2019
Note to self for a possible reduced sequence type system:
enum34(available on PyPI) is the new Python stdlib enum module available in Python 3.4 backported for previous versions of Python from 2.4 to 3.3. tested on 2.6, 2.7, and 3.3+peterjc commentedon Jan 22, 2020
See also #2488, which includes a reminder that for many people the only place they need to use
Bio.Alphabetis in constructingSeqRecordobjects for output in GenBank or other formats which need to know DNA vs RNA vs Protein explicitly.peterjc commentedon Jun 26, 2020
Following the release of Biopython 1.77 (May 2020) which was focused on removing Python 2 specific code, we are currently removing internal use of
Bio.Alphabetobjects. TheSeqobjects will no long use this attribute for type checking.Where recording the molecule type is required (some file formats need this), the
SeqRecordannotation is used instead. Specifically, the.annotations['molecule_type']field which was already used in the GenBank/EMBL parser. This should be a string containing "DNA", "RNA", "protein". It can be a longer string like "mRNA".peterjc commentedon Jul 29, 2020
With the recent work up to and including #3168, Biopython no longer uses
Bio.Alphabetinternally and we should be OK to remove or deprecate it in the next release (Biopython 1.78). We still need to look at documentation and helping people transition, see e.g. examples on #3156.generic protein alphabet for all translation output (biopython#2929)
Drop IUPAC alphabets from GenBank/EMBL parser
Removed use of Bio.Alphabet