[Biopython-dev] [Bug 2550] Alphabet problems when adding sequences

bugzilla-daemon at portal.open-bio.org bugzilla-daemon at portal.open-bio.org
Wed Aug 13 17:12:26 UTC 2008


http://bugzilla.open-bio.org/show_bug.cgi?id=2550


biopython-bugzilla at maubp.freeserve.co.uk changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED




------- Comment #5 from biopython-bugzilla at maubp.freeserve.co.uk  2008-08-13 13:12 EST -------
Changes checked into CVS, new behaviour:

>>> from Bio import Alphabet
>>> from Bio.Alphabet import IUPAC
>>> from Bio.Seq import Seq
>>> a = Seq("ACTG", Alphabet.generic_dna)
>>> b = Seq("AC-TG", Alphabet.Gapped(Alphabet.generic_dna, "-"))
>>> c = Seq("AC-TG", Alphabet.Gapped(IUPAC.unambiguous_dna, "-"))
>>> a
Seq('ACTG', DNAAlphabet())
>>> b
Seq('AC-TG', Gapped(DNAAlphabet(), '-'))
>>> c
Seq('AC-TG', Gapped(IUPACUnambiguousDNA(), '-'))
>>> b+c
Seq('AC-TGAC-TG', Gapped(DNAAlphabet(), '-'))
>>> a+b
Seq('ACTGAC-TG', Gapped(DNAAlphabet(), '-'))
>>> p = Seq("ACDEFG", Alphabet.generic_protein)
>>> q = Seq("ACDEFG", IUPAC.protein)
>>> r = Seq("ACDEFG*", Alphabet.HasStopCodon(IUPAC.protein, "*"))
>>> p
Seq('ACDEFG', ProteinAlphabet())
>>> q
Seq('ACDEFG', IUPACProtein())
>>> r
Seq('ACDEFG*', HasStopCodon(IUPACProtein(), '*'))
>>> p+q
Seq('ACDEFGACDEFG', ProteinAlphabet())
>>> p+r
Seq('ACDEFGACDEFG*', HasStopCodon(ProteinAlphabet(), '*'))
>>> c = Seq("AC-TG", Alphabet.Gapped(IUPAC.unambiguous_dna, "-"))
>>> d = Seq('AC.TG', Alphabet.Gapped(IUPAC.unambiguous_dna, '.'))
>>> c
Seq('AC-TG', Gapped(IUPACUnambiguousDNA(), '-'))
>>> d
Seq('AC.TG', Gapped(IUPACUnambiguousDNA(), '.'))
>>> c+d
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "Bio/Seq.py", line 137, in __add__
    a = Alphabet._consensus_alphabet([self.alphabet, other.alphabet])
  File "/Users/pjcock/repositories/biopython/Bio/Alphabet/__init__.py", line
200, in _consensus_alphabet
    raise ValueError("More than one gap character present")
ValueError: More than one gap character present


Checking in Tests/test_seq.py;
/home/repository/biopython/biopython/Tests/test_seq.py,v  <--  test_seq.py
new revision: 1.16; previous revision: 1.15
done
Checking in Tests/test_GACrossover.py;
/home/repository/biopython/biopython/Tests/test_GACrossover.py,v  <-- 
test_GACrossover.py
new revision: 1.3; previous revision: 1.2
done
Checking in Tests/test_GAMutation.py;
/home/repository/biopython/biopython/Tests/test_GAMutation.py,v  <-- 
test_GAMutation.py
new revision: 1.2; previous revision: 1.1
done
Checking in Tests/test_GASelection.py;
/home/repository/biopython/biopython/Tests/test_GASelection.py,v  <-- 
test_GASelection.py
new revision: 1.2; previous revision: 1.1
done
Checking in Tests/output/test_seq;
/home/repository/biopython/biopython/Tests/output/test_seq,v  <--  test_seq
new revision: 1.14; previous revision: 1.13
done
Checking in Bio/Seq.py;
/home/repository/biopython/biopython/Bio/Seq.py,v  <--  Seq.py
new revision: 1.30; previous revision: 1.29
done
Checking in Bio/Alphabet/__init__.py;
/home/repository/biopython/biopython/Bio/Alphabet/__init__.py,v  <-- 
__init__.py
new revision: 1.10; previous revision: 1.9
done

Note that the GA unit tests needed a minor change in order that their bespoke
alphabet objects inherited from a Bio.Alphabet object.


-- 
Configure bugmail: http://bugzilla.open-bio.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.



More information about the Biopython-dev mailing list