Permalink
Browse files

Add blank lines where needed (PEP8 E302).

  • Loading branch information...
cbrueffer committed Dec 6, 2012
1 parent c31f081 commit fd82a0a7a7c17b4e99e99298611e895a003774ba
Showing with 250 additions and 0 deletions.
  1. +1 −0 Tests/PAML/gen_results.py
  2. +1 −0 Tests/requires_internet.py
  3. +3 −0 Tests/run_tests.py
  4. +7 −0 Tests/seq_tests_common.py
  5. +4 −0 Tests/test_AlignIO.py
  6. +1 −0 Tests/test_AlignIO_convert.py
  7. +2 −0 Tests/test_CAPS.py
  8. +1 −0 Tests/test_Chi2.py
  9. +2 −0 Tests/test_ClustalOmega_tool.py
  10. +1 −0 Tests/test_Clustalw_tool.py
  11. +1 −0 Tests/test_Cluster.py
  12. +1 −0 Tests/test_ColorSpiral.py
  13. +1 −0 Tests/test_Crystal.py
  14. +1 −0 Tests/test_Dialign_tool.py
  15. +11 −0 Tests/test_Emboss.py
  16. +8 −0 Tests/test_EmbossPhylipNew.py
  17. +1 −0 Tests/test_EmbossPrimer.py
  18. +4 −0 Tests/test_Entrez.py
  19. +1 −0 Tests/test_File.py
  20. +5 −0 Tests/test_GACrossover.py
  21. +6 −0 Tests/test_GAMutation.py
  22. +4 −0 Tests/test_GAOrganism.py
  23. +6 −0 Tests/test_GAQueens.py
  24. +2 −0 Tests/test_GARepair.py
  25. +9 −0 Tests/test_GASelection.py
  26. +5 −0 Tests/test_GenBank.py
  27. +9 −0 Tests/test_GenomeDiagram.py
  28. +2 −0 Tests/test_GraphicsBitmaps.py
  29. +3 −0 Tests/test_GraphicsChromosome.py
  30. +1 −0 Tests/test_GraphicsDistribution.py
  31. +4 −0 Tests/test_HMMCasino.py
  32. +7 −0 Tests/test_HMMGeneral.py
  33. +1 −0 Tests/test_HotRand.py
  34. +3 −0 Tests/test_KEGG.py
  35. +1 −0 Tests/test_KeyWList.py
  36. +1 −0 Tests/test_LogisticRegression.py
  37. +1 −0 Tests/test_MMCIF.py
  38. +2 −0 Tests/test_Mafft_tool.py
  39. +1 −0 Tests/test_Medline.py
  40. +2 −0 Tests/test_Muscle_tool.py
  41. +1 −0 Tests/test_NCBIXML.py
  42. +1 −0 Tests/test_NNExclusiveOr.py
  43. +10 −0 Tests/test_NNGene.py
  44. +1 −0 Tests/test_PAML_baseml.py
  45. +2 −0 Tests/test_PAML_tools.py
  46. +1 −0 Tests/test_PAML_yn00.py
  47. +3 −0 Tests/test_PDB.py
  48. +1 −0 Tests/test_PDB_KDTree.py
  49. +6 −0 Tests/test_ParserSupport.py
  50. +4 −0 Tests/test_Phd.py
  51. +1 −0 Tests/test_Phylo_depend.py
  52. +2 −0 Tests/test_PopGen_FDist_nodepend.py
  53. +1 −0 Tests/test_PopGen_GenePop_EasyController.py
  54. +1 −0 Tests/test_PopGen_GenePop_nodepend.py
  55. +1 −0 Tests/test_Prank_tool.py
  56. +1 −0 Tests/test_Probcons_tool.py
  57. +1 −0 Tests/test_ProtParam.py
  58. +1 −0 Tests/test_SCOP_online.py
  59. +1 −0 Tests/test_SVDSuperimposer.py
  60. +1 −0 Tests/test_SearchIO_blast_xml.py
  61. +1 −0 Tests/test_SearchIO_hmmer3_text.py
  62. +7 −0 Tests/test_SeqIO.py
  63. +4 −0 Tests/test_SeqIO_AbiIO.py
  64. +3 −0 Tests/test_SeqIO_FastaIO.py
  65. +6 −0 Tests/test_SeqIO_QualityIO.py
  66. +1 −0 Tests/test_SeqIO_SeqXML.py
  67. +6 −0 Tests/test_SeqIO_convert.py
  68. +10 −0 Tests/test_SeqIO_features.py
  69. +2 −0 Tests/test_SeqIO_index.py
  70. +2 −0 Tests/test_SeqIO_online.py
  71. +2 −0 Tests/test_SeqRecord.py
  72. +1 −0 Tests/test_SeqUtils.py
  73. +1 −0 Tests/test_Seq_objs.py
  74. +1 −0 Tests/test_SffIO.py
  75. +1 −0 Tests/test_TCoffee_tool.py
  76. +2 −0 Tests/test_TogoWS.py
  77. +3 −0 Tests/test_Tutorial.py
  78. +1 −0 Tests/test_Uniprot.py
  79. +2 −0 Tests/test_Wise.py
  80. +1 −0 Tests/test_bgzf.py
  81. +1 −0 Tests/test_kNN.py
  82. +1 −0 Tests/test_lowess.py
  83. +1 −0 Tests/test_phyml_tool.py
  84. +1 −0 Tests/test_prodoc.py
  85. +1 −0 Tests/test_prosite1.py
  86. +1 −0 Tests/test_prosite2.py
  87. +3 −0 Tests/test_psw.py
  88. +1 −0 Tests/test_py3k.py
  89. +1 −0 Tests/test_raxml_tool.py
  90. +2 −0 Tests/test_seq.py
  91. +1 −0 do2to3.py
  92. +11 −0 setup.py
@@ -97,6 +97,7 @@ def baseml(vers=None, verbose=False):
bin = "baseml{0}".format(version)
bml.run(command=bin, verbose=verbose)
+
def yn00(vers=None, verbose=False):
from Bio.Phylo.PAML import yn00
if vers is not None:
@@ -11,6 +11,7 @@
from Bio import MissingExternalDependencyError
+
def check():
try:
check.available
View
@@ -39,6 +39,7 @@
import distutils.util
import gc
+
def is_pypy():
import platform
try:
@@ -49,6 +50,7 @@ def is_pypy():
pass
return False
+
def is_numpy():
if is_pypy():
return False
@@ -139,6 +141,7 @@ def is_numpy():
system_lang = os.environ.get('LANG', 'C') #Cache this
+
def main(argv):
"""Run tests, return number of failures (integer)."""
# insert our paths in sys.path:
@@ -6,6 +6,7 @@
from Bio.SeqFeature import ExactPosition, FeatureLocation, SeqFeature
from Bio.SeqRecord import SeqRecord
+
def checksum_summary(record):
if isinstance(record.seq, UnknownSeq):
return repr(record.seq)
@@ -17,6 +18,7 @@ def checksum_summary(record):
return "%s [%s] len %i" \
% (short, seguid(record.seq), len(record.seq))
+
def compare_reference(old_r, new_r):
"""Compare two Reference objects
@@ -62,6 +64,7 @@ def compare_reference(old_r, new_r):
return True
+
def compare_feature(old_f, new_f):
"""Compare two SeqFeature objects"""
assert isinstance(old_f, SeqFeature)
@@ -175,6 +178,7 @@ def compare_feature(old_f, new_f):
"%s -> %s" % (old_f.qualifiers[key], new_f.qualifiers[key])
return True
+
def compare_sequence(old, new):
"""Compare two Seq or DBSeq objects"""
assert len(old) == len(new), "%i vs %i" % (len(old), len(new))
@@ -235,6 +239,7 @@ def compare_sequence(old, new):
assert s == str(new[:])
return True
+
def compare_features(old_list, new_list):
assert isinstance(old_list, list)
assert isinstance(new_list, list)
@@ -244,6 +249,7 @@ def compare_features(old_list, new_list):
return False
return True
+
def compare_record(old, new):
"""Compare two SeqRecord or DBSeqRecord objects"""
assert isinstance(old, SeqRecord)
@@ -325,6 +331,7 @@ def compare_record(old, new):
% (key, old.annotations[key], new.annotations[key])
return True
+
def compare_records(old_list, new_list):
assert isinstance(old_list, list)
assert isinstance(new_list, list)
View
@@ -68,12 +68,14 @@
("pir", 2, 1, 'NBRF/clustalw.pir'),
]
+
def str_summary(text, max_len=40):
if len(text) <= max_len:
return text
else:
return text[:max_len-4] + "..." + text[-3:]
+
def alignment_summary(alignment, index=" ", vertical_threshold=5):
"""Returns a concise summary of an Alignment object as a string."""
answer = []
@@ -162,6 +164,7 @@ def check_simple_write_read(alignments, indent=" "):
SeqIO.write(alignments[0], handle, format)
assert handle.getvalue() == alignments[0].format(format)
+
def simple_alignment_comparison(alignments, alignments2, format):
assert len(alignments) == len(alignments2)
for a1, a2 in zip(alignments, alignments2):
@@ -195,6 +198,7 @@ def simple_alignment_comparison(alignments, alignments2, format):
"'%s' vs '%s'" % (r1.id, r2.id)
return True
+
#Check Phylip files reject duplicate identifiers.
def check_phylip_reject_duplicate():
"""
@@ -38,6 +38,7 @@ def check_convert(in_filename, in_format, out_format, alphabet=None):
assert handle.getvalue() == handle2.getvalue()
#TODO - convert passing an output filename?
+
class ConvertTests(unittest.TestCase):
"""Cunning unit test where methods are added at run time."""
def simple_check(self, filename, in_format, out_format, alphabet):
View
@@ -7,12 +7,14 @@
from Bio.SeqRecord import SeqRecord
from Bio.Align import MultipleSeqAlignment
+
def createAlignment(sequences, alphabet):
"""Create an Alignment object from a list of sequences"""
return MultipleSeqAlignment((SeqRecord(Seq(s,alphabet), id="sequence%i"%(i+1))
for (i,s) in enumerate(sequences)),
alphabet)
+
class TestCAPS(unittest.TestCase):
def test_trivial(self):
View
@@ -9,6 +9,7 @@
import sys
from Bio.Phylo.PAML import chi2
+
class ModTest(unittest.TestCase):
def testCdfChi2(self):
@@ -83,6 +83,7 @@ def add_file_to_clean(self, filename):
#################################################################
+
class ClustalOmegaTestErrorConditions(ClustalOmegaTestCase):
def test_empty_file(self):
@@ -128,6 +129,7 @@ def test_invalid_format(self):
#################################################################
+
class ClustalOmegaTestNormalConditions(ClustalOmegaTestCase):
def test_simple_fasta(self):
@@ -78,6 +78,7 @@
raise MissingExternalDependencyError(
"Install clustalw or clustalw2 if you want to use it from Biopython.")
+
class ClustalWTestCase(unittest.TestCase):
"""Class implementing common functions for ClustalW tests."""
View
@@ -19,6 +19,7 @@
raise MissingPythonDependencyError(
"Install NumPy if you want to use Bio.Cluster")
+
class TestCluster(unittest.TestCase):
module = 'Bio.Cluster'
@@ -30,6 +30,7 @@ def rect(r, phi):
# Biopython Bio.Graphics.ColorSpiral
from Bio.Graphics.ColorSpiral import ColorSpiral, get_colors, get_color_dict
+
class SpiralTest(unittest.TestCase):
"""Construct and draw ColorSpiral colours placed on HSV spiral."""
def setUp(self):
View
@@ -11,6 +11,7 @@
# modules to be tested
from Bio.Crystal import Hetero, Chain, Crystal, CrystalError
+
class ChainTestCase(unittest.TestCase):
def setUp(self):
@@ -38,6 +38,7 @@
raise MissingExternalDependencyError(
"Install DIALIGN2-2 if you want to use the Bio.Align.Applications wrapper.")
+
class DialignApplication(unittest.TestCase):
def setUp(self):
View
@@ -52,6 +52,7 @@
raise MissingExternalDependencyError(
"Install EMBOSS if you want to use Bio.Emboss.")
+
def get_emboss_version():
"""Returns a tuple of three ints, e.g. (6,1,0)"""
#Windows and Unix versions of EMBOSS seem to differ in
@@ -91,6 +92,7 @@ def get_emboss_version():
#################################################################
+
#Top level function as this makes it easier to use for debugging:
def emboss_convert(filename, old_format, new_format):
"""Run seqret, returns handle."""
@@ -113,6 +115,7 @@ def emboss_convert(filename, old_format, new_format):
child.stderr.close()
return child.stdout
+
#Top level function as this makes it easier to use for debugging:
def emboss_piped_SeqIO_convert(records, old_format, new_format):
"""Run seqret, returns records (as a generator)."""
@@ -139,6 +142,7 @@ def emboss_piped_SeqIO_convert(records, old_format, new_format):
child.stdout.close()
return records
+
#Top level function as this makes it easier to use for debugging:
def emboss_piped_AlignIO_convert(alignments, old_format, new_format):
"""Run seqret, returns alignments (as a generator)."""
@@ -207,6 +211,7 @@ def compare_records(old_list, new_list):
#TODO - check annotation
return True
+
#Top level function as this makes it easier to use for debugging:
def compare_alignments(old_list, new_list):
"""Check two lists of Alignments agree, raises a ValueError if mismatch."""
@@ -219,6 +224,7 @@ def compare_alignments(old_list, new_list):
compare_records(old,new)
return True
+
class SeqRetSeqIOTests(unittest.TestCase):
"""Check EMBOSS seqret against Bio.SeqIO for converting files."""
@@ -329,6 +335,7 @@ def test_clustalw(self):
self.check_SeqIO_with_EMBOSS("Clustalw/opuntia.aln", "clustal",
skip_formats=["embl","genbank"])
+
class SeqRetAlignIOTests(unittest.TestCase):
"""Check EMBOSS seqret against Bio.SeqIO for converting files."""
@@ -746,6 +753,7 @@ def test_seqtmatchall_piped(self):
child.stdout.close()
child.stderr.close()
+
#Top level function as this makes it easier to use for debugging:
def emboss_translate(sequence, table=None, frame=None):
"""Call transeq, returns protein sequence as string."""
@@ -801,6 +809,7 @@ def emboss_translate(sequence, table=None, frame=None):
raise ValueError(str(cline))
return str(record.seq)
+
#Top level function as this makes it easier to use for debugging:
def check_translation(sequence, translation, table=None):
if table is None:
@@ -821,6 +830,7 @@ def check_translation(sequence, translation, table=None):
% (sequence, translation, t))
return True
+
class TranslationTests(unittest.TestCase):
"""Run pairwise alignments with water and needle, and parse them."""
@@ -898,6 +908,7 @@ def test_mixed_unambig_rna_codons(self):
"""transeq vs Bio.Seq on unambiguous DNA/RNA codons (inc. alt tables)."""
self.translate_all_codons("ATUCGatucg")
+
def clean_up():
"""Fallback clean up method to remove temp files."""
for filename in os.listdir("Emboss"):
@@ -50,30 +50,35 @@
###########################################################################
+
# A few top level functions that are called repeatedly in the test cases
def write_AlignIO_dna():
"""Convert opuntia.aln to a phylip file"""
assert 1 == AlignIO.convert("Clustalw/opuntia.aln", "clustal",
"Phylip/opuntia.phy", "phylip")
+
def write_AlignIO_protein():
"""Convert hedgehog.aln to a phylip file"""
assert 1 == AlignIO.convert("Clustalw/hedgehog.aln", "clustal",
"Phylip/hedgehog.phy", "phylip")
+
def clean_up():
"""Delete tests files (to be used as tearDown() function in test fixtures)"""
for filename in ["test_file", "Phylip/opuntia.phy","Phylip/hedgehog.phy"]:
if os.path.isfile(filename):
os.remove(filename)
+
def parse_trees(filename):
"""Helper function until we have Bio.Phylo on trunk."""
data = open("test_file", "r").read()
for tree_str in data.split(";\n"):
if tree_str:
yield Trees.Tree(tree_str+";")
+
class DistanceTests(unittest.TestCase):
"""Tests for calculating distance based phylogenetic trees with phylip"""
@@ -152,6 +157,7 @@ def test_distances_from_protein_AlignIO(self):
# """Estimate tree from bootstrapped distance matrix and parse it"""
# self.tree_from_distances("Phylip/bs_horses.fdnadist")
+
class ParsimonyTests(unittest.TestCase):
"""Tests for estimating parsimony based phylogenetic trees with phylip"""
@@ -206,6 +212,7 @@ def test_parsimony_from_AlignIO_protein(self):
# """Make a parsimony tree from a phylip DNA alignment"""
# self.parsimony_tree("Phylip/bs_interlaced.phy", "phylip", DNA=False)
+
class BootstrapTests(unittest.TestCase):
"""Tests for pseudosampling alignments with fseqboot"""
@@ -254,6 +261,7 @@ def test_bootstrap_AlignIO_protein(self):
write_AlignIO_protein()
self.check_bootstrap("Phylip/hedgehog.phy", "phylip", "p")
+
class TreeComparisonTests(unittest.TestCase):
"""Tests for comparing phylogenetic trees with phylip tools"""
@@ -216,6 +216,7 @@ def test_in_depth_normal_parse(self):
"\tTCACATTCCCAAATGTAGATCG hits reverse strand at [114] with "
"0 mismatches")
+
class PrimerSearchInputTest(unittest.TestCase):
"""Test creating input files for primersearch.
"""
Oops, something went wrong.

0 comments on commit fd82a0a

Please sign in to comment.