Back to index

python-biopython  1.60
Public Member Functions
test_Emboss.SeqRetAlignIOTests Class Reference

List of all members.

Public Member Functions

def tearDown
def check_EMBOSS_to_AlignIO
def check_AlignIO_to_EMBOSS
def check_AlignIO_with_EMBOSS
def test_align_clustalw
def test_clustalw

Detailed Description

Check EMBOSS seqret against Bio.SeqIO for converting files.

Definition at line 332 of file test_Emboss.py.


Member Function Documentation

def test_Emboss.SeqRetAlignIOTests.check_AlignIO_to_EMBOSS (   self,
  in_filename,
  in_format,
  skip_formats = [],
  alphabet = None 
)
Can Bio.AlignIO write files seqret can read back?

Definition at line 364 of file test_Emboss.py.

00364 
00365                                 alphabet=None):
00366         """Can Bio.AlignIO write files seqret can read back?"""
00367         if alphabet:
00368             old_aligns = list(AlignIO.parse(in_filename,in_format,alphabet))
00369         else:
00370             old_aligns = list(AlignIO.parse(in_filename,in_format))
00371 
00372         formats = ["clustal", "phylip"]
00373         if len(old_aligns) == 1:
00374             formats.extend(["fasta","nexus"])
00375         for temp_format in formats:
00376             if temp_format in skip_formats:
00377                 continue
00378             #PHYLIP is a simple format which explicitly supports
00379             #multiple alignments (unlike FASTA).
00380             try:
00381                 new_aligns = list(emboss_piped_AlignIO_convert(old_aligns,
00382                                                                temp_format,
00383                                                                "phylip"))
00384             except ValueError, e:
00385                 #e.g. ValueError: Need a DNA, RNA or Protein alphabet
00386                 #from writing Nexus files...
00387                 continue
00388             try:
00389                 self.assertTrue(compare_alignments(old_aligns, new_aligns))
00390             except ValueError, err:
00391                 raise ValueError("Disagree on file %s %s in %s format: %s" \
00392                                  % (in_format, in_filename, temp_format, err))

Here is the call graph for this function:

Here is the caller graph for this function:

def test_Emboss.SeqRetAlignIOTests.check_AlignIO_with_EMBOSS (   self,
  filename,
  old_format,
  skip_formats = [],
  alphabet = None 
)

Definition at line 394 of file test_Emboss.py.

00394 
00395                                   alphabet=None):
00396         #Check EMBOSS can read Bio.AlignIO output...
00397         self.check_AlignIO_to_EMBOSS(filename, old_format, skip_formats,
00398                                    alphabet)
00399         #Check Bio.AlignIO can read EMBOSS seqret output...
00400         self.check_EMBOSS_to_AlignIO(filename, old_format, skip_formats)
        

Here is the call graph for this function:

Here is the caller graph for this function:

def test_Emboss.SeqRetAlignIOTests.check_EMBOSS_to_AlignIO (   self,
  filename,
  old_format,
  skip_formats = [] 
)
Can AlignIO read seqret's conversion of the file?

Definition at line 339 of file test_Emboss.py.

00339 
00340                               skip_formats=[]):
00341         """Can AlignIO read seqret's conversion of the file?"""
00342         self.assertTrue(os.path.isfile(filename), filename)
00343         old_aligns = list(AlignIO.parse(filename, old_format))
00344         formats = ["clustal", "phylip", "ig"]
00345         if len(old_aligns) == 1:
00346             formats.extend(["fasta","nexus"])
00347         for new_format in formats:
00348             if new_format in skip_formats:
00349                 continue
00350             handle = emboss_convert(filename, old_format, new_format)
00351             try:
00352                 new_aligns = list(AlignIO.parse(handle, new_format))
00353             except:
00354                 handle.close()
00355                 raise ValueError("Can't parse %s file %s in %s format." \
00356                                  % (old_format, filename, new_format))
00357             handle.close()
00358             try:
00359                 self.assertTrue(compare_alignments(old_aligns, new_aligns))
00360             except ValueError, err:
00361                 raise ValueError("Disagree on %s file %s in %s format: %s" \
00362                                  % (old_format, filename, new_format, err))

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 335 of file test_Emboss.py.

00335 
00336     def tearDown(self):
00337         clean_up()

Here is the call graph for this function:

AlignIO & EMBOSS reading each other's conversions of a ClustalW file.

Definition at line 401 of file test_Emboss.py.

00401 
00402     def test_align_clustalw(self):
00403         """AlignIO & EMBOSS reading each other's conversions of a ClustalW file."""
00404         self.check_AlignIO_with_EMBOSS("Clustalw/hedgehog.aln", "clustal")
00405         self.check_AlignIO_with_EMBOSS("Clustalw/opuntia.aln", "clustal")
00406         self.check_AlignIO_with_EMBOSS("Clustalw/odd_consensus.aln", "clustal",
00407                                skip_formats=["nexus"]) #TODO - why not nexus?
00408         self.check_AlignIO_with_EMBOSS("Clustalw/protein.aln", "clustal")
00409         self.check_AlignIO_with_EMBOSS("Clustalw/promals3d.aln", "clustal")

Here is the call graph for this function:

AlignIO & EMBOSS reading each other's conversions of a PHYLIP file.

Definition at line 410 of file test_Emboss.py.

00410 
00411     def test_clustalw(self):
00412         """AlignIO & EMBOSS reading each other's conversions of a PHYLIP file."""
00413         self.check_AlignIO_with_EMBOSS("Phylip/horses.phy", "phylip")
00414         self.check_AlignIO_with_EMBOSS("Phylip/hennigian.phy", "phylip")
00415         self.check_AlignIO_with_EMBOSS("Phylip/reference_dna.phy", "phylip")
00416         self.check_AlignIO_with_EMBOSS("Phylip/reference_dna2.phy", "phylip")
00417         self.check_AlignIO_with_EMBOSS("Phylip/interlaced.phy", "phylip")
00418         self.check_AlignIO_with_EMBOSS("Phylip/interlaced2.phy", "phylip")
00419         self.check_AlignIO_with_EMBOSS("Phylip/random.phy", "phylip")
00420 
        

Here is the call graph for this function:


The documentation for this class was generated from the following file: