Back to index

python-biopython  1.60
Classes | Functions | Variables
test_AlignIO_convert Namespace Reference

Classes

class  ConvertTests

Functions

def check_convert
def funct

Variables

list tests
list output_formats = ["fasta"]
tuple runner = unittest.TextTestRunner(verbosity = 2)

Function Documentation

def test_AlignIO_convert.check_convert (   in_filename,
  in_format,
  out_format,
  alphabet = None 
)

Definition at line 15 of file test_AlignIO_convert.py.

00015 
00016 def check_convert(in_filename, in_format, out_format, alphabet=None):
00017     #Write it out using parse/write
00018     handle = StringIO()
00019     aligns = list(AlignIO.parse(open(in_filename), in_format, None, alphabet))
00020     try:
00021         count = AlignIO.write(aligns, handle, out_format)
00022     except ValueError:
00023         count = 0
00024     #Write it out using convert passing filename and handle
00025     handle2 = StringIO()
00026     try:
00027         count2 = AlignIO.convert(in_filename, in_format, handle2, out_format, alphabet)
00028     except ValueError:
00029         count2 = 0
00030     assert count == count2
00031     assert handle.getvalue() == handle2.getvalue()
00032     #Write it out using convert passing handle and handle
00033     handle2 = StringIO()
00034     try:
00035         count2 = AlignIO.convert(open(in_filename), in_format, handle2, out_format, alphabet)
00036     except ValueError:
00037         count2 = 0
00038     assert count == count2
00039     assert handle.getvalue() == handle2.getvalue()
00040     #TODO - convert passing an output filename?

Here is the call graph for this function:

Here is the caller graph for this function:

def test_AlignIO_convert.funct (   fn,
  fmt1,
  fmt2,
  alpha 
)

Definition at line 61 of file test_AlignIO_convert.py.

00061 
00062         def funct(fn,fmt1, fmt2, alpha):
00063             f = lambda x : x.simple_check(fn, fmt1, fmt2, alpha)
00064             f.__doc__ = "Convert %s from %s to %s" % (fn, fmt1, fmt2)
            return f

Variable Documentation

Definition at line 57 of file test_AlignIO_convert.py.

tuple test_AlignIO_convert.runner = unittest.TextTestRunner(verbosity = 2)

Definition at line 71 of file test_AlignIO_convert.py.

Initial value:
00001 [
00002     ('Clustalw/hedgehog.aln', "clustal", None),
00003     ('Nexus/test_Nexus_input.nex', "nexus", None),
00004     ('Stockholm/simple.sth', "stockholm", None),
00005     ('GFF/multi.fna', "fasta", generic_nucleotide),
00006     ("Quality/example.fastq", "fastq", None),
00007     ("Quality/example.fastq", "fastq-sanger", generic_dna),
00008     ('Fasta/output001.m10', "fasta-m10", None),
00009     ('IntelliGenetics/VIF_mase-pro.txt', "ig", generic_protein),
00010     ('NBRF/clustalw.pir', "pir", None),
00011     ]

Definition at line 46 of file test_AlignIO_convert.py.