Permalink
Browse files

Fix spacing around inline comments (E261, E262).

  • Loading branch information...
1 parent f57bace commit 10a632018ed516a90162ee59c9e6c424728d7ddc @cbrueffer cbrueffer committed Dec 6, 2012
Showing with 171 additions and 171 deletions.
  1. +1 −1 Tests/run_tests.py
  2. +2 −2 Tests/seq_tests_common.py
  3. +3 −3 Tests/test_AlignIO.py
  4. +2 −2 Tests/test_CAPS.py
  5. +5 −5 Tests/test_CodonTable.py
  6. +11 −11 Tests/test_Emboss.py
  7. +1 −1 Tests/test_EmbossPhylipNew.py
  8. +15 −15 Tests/test_GenomeDiagram.py
  9. +1 −1 Tests/test_LogisticRegression.py
  10. +1 −1 Tests/test_MMCIF.py
  11. +1 −1 Tests/test_MarkovModel.py
  12. +8 −8 Tests/test_Muscle_tool.py
  13. +1 −1 Tests/test_NCBITextParser.py
  14. +8 −8 Tests/test_NCBIXML.py
  15. +1 −1 Tests/test_PAML_tools.py
  16. +1 −1 Tests/test_PDB.py
  17. +1 −1 Tests/test_PDB_KDTree.py
  18. +11 −11 Tests/test_Pathway.py
  19. +1 −1 Tests/test_PopGen_DFDist.py
  20. +1 −1 Tests/test_PopGen_FDist.py
  21. +2 −2 Tests/test_PopGen_FDist_nodepend.py
  22. +1 −1 Tests/test_PopGen_GenePop.py
  23. +2 −2 Tests/test_PopGen_GenePop_EasyController.py
  24. +1 −1 Tests/test_PopGen_GenePop_nodepend.py
  25. +1 −1 Tests/test_PopGen_SimCoal.py
  26. +3 −3 Tests/test_Prank_tool.py
  27. +1 −1 Tests/test_SVDSuperimposer.py
  28. +1 −1 Tests/test_SearchIO_index.py
  29. +25 −25 Tests/test_SeqIO.py
  30. +1 −1 Tests/test_SeqIO_FastaIO.py
  31. +1 −1 Tests/test_SeqIO_PdbIO.py
  32. +3 −3 Tests/test_SeqIO_QualityIO.py
  33. +1 −1 Tests/test_SeqIO_convert.py
  34. +9 −9 Tests/test_SeqIO_features.py
  35. +11 −11 Tests/test_SeqIO_index.py
  36. +2 −2 Tests/test_SeqIO_write.py
  37. +2 −2 Tests/test_SeqRecord.py
  38. +5 −5 Tests/test_Seq_objs.py
  39. +1 −1 Tests/test_SubsMat.py
  40. +1 −1 Tests/test_TCoffee_tool.py
  41. +10 −10 Tests/test_TogoWS.py
  42. +2 −2 Tests/test_Uniprot.py
  43. +3 −3 Tests/test_bgzf.py
  44. +6 −6 Tests/test_seq.py
View
2 Tests/run_tests.py
@@ -139,7 +139,7 @@ def is_numpy():
DOCTEST_MODULES.remove("Bio.SearchIO._model.hit")
DOCTEST_MODULES.remove("Bio.SearchIO._model.hsp")
-system_lang = os.environ.get('LANG', 'C') #Cache this
+system_lang = os.environ.get('LANG', 'C') # Cache this
def main(argv):
View
4 Tests/seq_tests_common.py
@@ -209,8 +209,8 @@ def compare_sequence(old, new):
assert expected == new[i]
#Test slices
- indices.append(ln) #check copes with overflows
- indices.append(ln+1000) #check copes with overflows
+ indices.append(ln) # check copes with overflows
+ indices.append(ln + 1000) # check copes with overflows
for i in indices:
for j in indices:
expected = s[i:j]
View
6 Tests/test_AlignIO.py
@@ -30,10 +30,10 @@
("clustal", 7, 1, 'Clustalw/opuntia.aln'),
("clustal", 5, 1, 'Clustalw/hedgehog.aln'),
("clustal", 2, 1, 'Clustalw/odd_consensus.aln'),
- ("clustal",20, 1, 'Clustalw/protein.aln'), #Used in the tutorial
- ("clustal",20, 1, 'Clustalw/promals3d.aln'), #Nonstandard header
+ ("clustal",20, 1, 'Clustalw/protein.aln'), # Used in the tutorial
+ ("clustal",20, 1, 'Clustalw/promals3d.aln'), # Nonstandard header
#Following examples are also used in test_GFF.py
- ("fasta", 3, 1, 'GFF/multi.fna'), #Trivial nucleotide alignment
+ ("fasta", 3, 1, 'GFF/multi.fna'), # Trivial nucleotide alignment
#Following example is also used in test_Nexus.py
("nexus", 9, 1, 'Nexus/test_Nexus_input.nex'),
("nexus", 2, 1, 'Nexus/codonposset.nex'),
View
4 Tests/test_CAPS.py
@@ -80,11 +80,11 @@ def testNoCAPS(self):
def test_uneven(self):
alignment = ["aaaaaaaaaaaaaa",
- "aaaaaaaaaaaaaa", #we'll change this below
+ "aaaaaaaaaaaaaa", # we'll change this below
"aaaaaaaaaaaaaa",
]
align = createAlignment(alignment, Alphabet.generic_nucleotide)
- align[1].seq = align[1].seq[:8] #evil
+ align[1].seq = align[1].seq[:8] # evil
self.assertRaises(CAPS.AlignmentHasDifferentLengthsError,
CAPS.CAPSMap,
align)
View
10 Tests/test_CodonTable.py
@@ -22,11 +22,11 @@
assert ambiguous_rna_by_id[n].forward_table["GUU"] == "V"
assert ambiguous_rna_by_id[n].forward_table["GUN"] == "V"
if n != 23 :
- assert ambiguous_rna_by_id[n].forward_table["UUN"] == "X" #F or L
+ assert ambiguous_rna_by_id[n].forward_table["UUN"] == "X" # F or L
assert ambiguous_dna_by_id[n].forward_table["GTT"] == "V"
if n != 23 :
- assert ambiguous_dna_by_id[n].forward_table["TTN"] == "X" #F or L
+ assert ambiguous_dna_by_id[n].forward_table["TTN"] == "X" # F or L
assert ambiguous_dna_by_id[n].forward_table["GTN"] == "V"
if n != 23 :
@@ -35,14 +35,14 @@
assert ambiguous_generic_by_id[n].forward_table["GUU"] == "V"
assert ambiguous_generic_by_id[n].forward_table["GUN"] == "V"
if n != 23 :
- assert ambiguous_generic_by_id[n].forward_table["UUN"] == "X" #F or L
+ assert ambiguous_generic_by_id[n].forward_table["UUN"] == "X" # F or L
assert ambiguous_generic_by_id[n].forward_table["GTT"] == "V"
if n != 23 :
- assert ambiguous_generic_by_id[n].forward_table["TTN"] == "X" #F or L
+ assert ambiguous_generic_by_id[n].forward_table["TTN"] == "X" # F or L
assert ambiguous_generic_by_id[n].forward_table["GTN"] == "V"
#And finally something evil, an RNA-DNA mixture:
if n != 23 :
- assert ambiguous_generic_by_id[n].forward_table["UTN"] == "X" #F or L
+ assert ambiguous_generic_by_id[n].forward_table["UTN"] == "X" # F or L
assert ambiguous_generic_by_id[n].forward_table["UTU"] == "F"
#R = A or G, so URR = UAA or UGA / TRA = TAA or TGA = stop codons
View
22 Tests/test_Emboss.py
@@ -27,7 +27,7 @@
exes_wanted = ["water", "needle", "seqret", "transeq", "seqmatchall",
"embossversion"]
-exes = dict() #Dictionary mapping from names to exe locations
+exes = dict() # Dictionary mapping from names to exe locations
if "EMBOSS_ROOT" in os.environ:
#Windows default installation path is C:\mEMBOSS which contains the exes.
@@ -63,9 +63,9 @@ def get_emboss_version():
universal_newlines=True,
shell=(sys.platform!="win32"))
stdout, stderr = child.communicate()
- child.stdout.close() #This is both stdout and stderr
+ child.stdout.close() # This is both stdout and stderr
del child
- assert stderr is None #Send to stdout instead
+ assert stderr is None # Send to stdout instead
for line in stdout.split("\n"):
if line.strip()=="Reports the current EMBOSS version number":
pass
@@ -102,7 +102,7 @@ def emboss_convert(filename, old_format, new_format):
sequence = filename,
sformat = old_format,
osformat = new_format,
- auto = True, #no prompting
+ auto = True, # no prompting
stdout = True)
#Run the tool,
child = subprocess.Popen(str(cline),
@@ -124,7 +124,7 @@ def emboss_piped_SeqIO_convert(records, old_format, new_format):
cline = SeqretCommandline(exes["seqret"],
sformat = old_format,
osformat = new_format,
- auto = True, #no prompting
+ auto = True, # no prompting
filter = True)
#Run the tool,
child = subprocess.Popen(str(cline),
@@ -151,7 +151,7 @@ def emboss_piped_AlignIO_convert(alignments, old_format, new_format):
cline = SeqretCommandline(exes["seqret"],
sformat = old_format,
osformat = new_format,
- auto = True, #no prompting
+ auto = True, # no prompting
filter = True)
#Run the tool,
child = subprocess.Popen(str(cline),
@@ -410,7 +410,7 @@ def test_align_clustalw(self):
self.check_AlignIO_with_EMBOSS("Clustalw/hedgehog.aln", "clustal")
self.check_AlignIO_with_EMBOSS("Clustalw/opuntia.aln", "clustal")
self.check_AlignIO_with_EMBOSS("Clustalw/odd_consensus.aln", "clustal",
- skip_formats=["nexus"]) #TODO - why not nexus?
+ skip_formats=["nexus"]) # TODO - why not nexus?
self.check_AlignIO_with_EMBOSS("Clustalw/protein.aln", "clustal")
self.check_AlignIO_with_EMBOSS("Clustalw/promals3d.aln", "clustal")
@@ -676,8 +676,8 @@ def test_needle_piped2(self):
cline = exes["needle"]
cline += " -asequence asis:" + query
cline += " -bsequence Fasta/f002"
- cline += " -auto" #no prompting
- cline += " -filter" #use stdout
+ cline += " -auto" # no prompting
+ cline += " -filter" # use stdout
#Run the tool,
child = subprocess.Popen(str(cline),
stdin=subprocess.PIPE,
@@ -776,8 +776,8 @@ def emboss_translate(sequence, table=None, frame=None):
SeqIO.write(SeqRecord(sequence, id="Test"), filename, "fasta")
cline += " -sequence %s" % filename
- cline += " -auto" #no prompting
- cline += " -filter" #use stdout
+ cline += " -auto" # no prompting
+ cline += " -filter" # use stdout
if table is not None:
cline += " -table %s" % str(table)
if frame is not None:
View
2 Tests/test_EmbossPhylipNew.py
@@ -22,7 +22,7 @@
exes_wanted = ['fdnadist', 'fneighbor', 'fprotdist','fprotpars','fconsense',
'fseqboot', 'ftreedist', 'fdnapars']
-exes = dict() #Dictionary mapping from names to exe locations
+exes = dict() # Dictionary mapping from names to exe locations
if "EMBOSS_ROOT" in os.environ:
#Windows default installation path is C:\mEMBOSS which contains the exes.
View
30 Tests/test_GenomeDiagram.py
@@ -163,7 +163,7 @@ def calc_gc_skew(sequence):
g = sequence.count('G') + sequence.count('g')
c = sequence.count('C') + sequence.count('c')
if g+c == 0:
- return 0.0 #TODO - return NaN or None here?
+ return 0.0 # TODO - return NaN or None here?
else:
return (g-c)/float(g+c)
@@ -178,7 +178,7 @@ def calc_at_skew(sequence):
a = sequence.count('A') + sequence.count('a')
t = sequence.count('T') + sequence.count('t')
if a+t == 0:
- return 0.0 #TODO - return NaN or None here?
+ return 0.0 # TODO - return NaN or None here?
else:
return (a-t)/float(a+t)
@@ -257,7 +257,7 @@ def test_limits(self):
#Circular diagram
gdd.draw(tracklines=False,
pagesize=(15*cm,15*cm),
- circular=True, #Data designed to be periodic
+ circular=True, # Data designed to be periodic
start=0, end=points, circle_core=0.5)
gdd.write(os.path.join('Graphics', "line_graph_c.pdf"), "pdf")
@@ -454,7 +454,7 @@ def test_arrow_heads(self):
self.add_track_with_sigils(sigil="ARROW", color="orange",
arrowhead_length=1)
self.add_track_with_sigils(sigil="ARROW", color="red",
- arrowhead_length=10000) #Triangles
+ arrowhead_length=10000) # Triangles
self.assertEqual(len(self.gdd.tracks), 4)
self.finish("GD_sigil_arrows")
@@ -570,7 +570,7 @@ def setUp(self):
def test_write_arguments(self):
"""Check how the write methods respond to output format arguments."""
gdd = Diagram('Test Diagram')
- gdd.drawing = None #Hack - need the ReportLab drawing object to be created.
+ gdd.drawing = None # Hack - need the ReportLab drawing object to be created.
filename = os.path.join("Graphics","error.txt")
#We (now) allow valid formats in any case.
for output in ["XXX","xxx",None,123,5.9]:
@@ -631,7 +631,7 @@ def test_partial_diagram(self):
#Note that I am using strings for color names, instead
#of passing in color objects. This should also work!
if len(gds_features) % 2 == 0:
- color = "white" #for testing the automatic black border!
+ color = "white" # for testing the automatic black border!
else:
color = "red"
#Checking it can cope with the old UK spelling colour.
@@ -877,10 +877,10 @@ def test_diagram_via_object_pdf(self):
#gdfs1.set_all_features('color', colors.red)
gdfs2.set_all_features('color', colors.blue)
- gdt1.add_set(gdfsA) #Before CDS so under them!
+ gdt1.add_set(gdfsA) # Before CDS so under them!
gdt1.add_set(gdfs1)
- gdt2.add_set(gdfsB) #Before genes so under them!
+ gdt2.add_set(gdfsB) # Before genes so under them!
gdt2.add_set(gdfs2)
gdt3 = Track('misc features and repeats', greytrack=1,
@@ -924,7 +924,7 @@ def test_diagram_via_object_pdf(self):
gdt5.add_set(gdgs2)
gdgs3 = GraphSet('Di-nucleotide count')
- step = len(genbank_entry)//400 #smaller step
+ step = len(genbank_entry) // 400 # smaller step
gdgs3.new_graph(apply_to_window(genbank_entry.seq, step, calc_dinucleotide_counts, step),
'Di-nucleotide count', style='heat',
color=colors.red, altcolor=colors.orange)
@@ -933,12 +933,12 @@ def test_diagram_via_object_pdf(self):
#Add the tracks (from both features and graphs)
#Leave some white space in the middle/bottom
- gdd.add_track(gdt4, 3) # GC skew
- gdd.add_track(gdt5, 4) # GC and AT content
- gdd.add_track(gdt1, 5) # CDS features
- gdd.add_track(gdt2, 6) # Gene features
- gdd.add_track(gdt3, 7) # Misc features and repeat feature
- gdd.add_track(gdt6, 8) # Feature depth
+ gdd.add_track(gdt4, 3) # GC skew
+ gdd.add_track(gdt5, 4) # GC and AT content
+ gdd.add_track(gdt1, 5) # CDS features
+ gdd.add_track(gdt2, 6) # Gene features
+ gdd.add_track(gdt3, 7) # Misc features and repeat feature
+ gdd.add_track(gdt6, 8) # Feature depth
#Finally draw it in both formats, and full view and partial
gdd.draw(format='circular', orientation='landscape',
View
2 Tests/test_LogisticRegression.py
@@ -8,7 +8,7 @@
try:
import numpy
- from numpy import linalg #missing in PyPy's micronumpy
+ from numpy import linalg # missing in PyPy's micronumpy
except ImportError:
from Bio import MissingExternalDependencyError
raise MissingExternalDependencyError(
View
2 Tests/test_MMCIF.py
@@ -16,7 +16,7 @@
try:
import numpy
- from numpy import dot #Missing on PyPy's micronumpy
+ from numpy import dot # Missing on PyPy's micronumpy
del dot
except ImportError:
from Bio import MissingPythonDependencyError
View
2 Tests/test_MarkovModel.py
@@ -4,7 +4,7 @@
try:
from numpy import array
- from numpy import random #missing in PyPy's micronumpy
+ from numpy import random # missing in PyPy's micronumpy
except ImportError:
from Bio import MissingPythonDependencyError
raise MissingPythonDependencyError(
View
16 Tests/test_Muscle_tool.py
@@ -29,7 +29,7 @@
#a Muscle directory with the muscle.exe file plus a readme etc,
#which the user could put anywhere. We'll try a few sensible
#locations under Program Files... and then the full path.
- likely_dirs = ["", #Current dir
+ likely_dirs = ["", # Current dir
prog_files,
os.path.join(prog_files,"Muscle3.6"),
os.path.join(prog_files,"Muscle3.7"),
@@ -65,7 +65,7 @@ def setUp(self):
self.infile1 = "Fasta/f002"
self.infile2 = "Fasta/fa01"
self.infile3 = "Fasta/f001"
- self.outfile1 = "Fasta/temp align out1.fa" #with spaces!
+ self.outfile1 = "Fasta/temp align out1.fa" # with spaces!
self.outfile2 = "Fasta/temp_align_out2.fa"
self.outfile3 = "Fasta/temp_align_out3.fa"
self.outfile4 = "Fasta/temp_align_out4.fa"
@@ -95,7 +95,7 @@ def test_Muscle_simple(self):
def test_Muscle_with_options(self):
"""Round-trip through app with a switch and valued option"""
cmdline = MuscleCommandline(muscle_exe)
- cmdline.set_parameter("input", self.infile1) #"input" is alias for "in"
+ cmdline.set_parameter("input", self.infile1) # "input" is alias for "in"
cmdline.set_parameter("out", self.outfile2)
#Use property:
cmdline.objscore = "sp"
@@ -196,7 +196,7 @@ def test_simple_clustal(self):
shell=(sys.platform!="win32"))
#Didn't use -quiet so there should be progress reports on stderr,
align = AlignIO.read(child.stdout, "clustal")
- align.sort() #by record.id
+ align.sort() # by record.id
self.assertTrue(child.stderr.read().strip().startswith("MUSCLE"))
return_code = child.wait()
self.assertEqual(return_code, 0)
@@ -218,7 +218,7 @@ def test_simple_clustal_strict(self):
cmdline = MuscleCommandline(muscle_exe)
cmdline.set_parameter("in", input_file)
#Use clustal output (with a CLUSTAL header)
- cmdline.set_parameter("clwstrict", True) #Default None treated as False!
+ cmdline.set_parameter("clwstrict", True) # Default None treated as False!
self.assertEqual(str(cmdline).rstrip(), muscle_exe +
" -in Fasta/f002 -clwstrict")
self.assertEqual(str(eval(repr(cmdline))), str(cmdline))
@@ -252,13 +252,13 @@ def test_long(self):
cmdline.set_parameter("in", temp_large_fasta_file)
#Use fast options
cmdline.set_parameter("maxiters", 1)
- cmdline.set_parameter("diags", True) #Default None treated as False!
+ cmdline.set_parameter("diags", True) # Default None treated as False!
#Use clustal output
- cmdline.set_parameter("clwstrict", True) #Default None treated as False!
+ cmdline.set_parameter("clwstrict", True) # Default None treated as False!
#Shoudn't need this, but just to make sure it is accepted
cmdline.set_parameter("maxhours", 0.1)
#No progress reports to stderr
- cmdline.set_parameter("quiet", True) #Default None treated as False!
+ cmdline.set_parameter("quiet", True) # Default None treated as False!
self.assertEqual(str(cmdline).rstrip(), muscle_exe +
" -in temp_cw_prot.fasta -diags -maxhours 0.1" +
" -maxiters 1 -clwstrict -quiet")
View
2 Tests/test_NCBITextParser.py
@@ -14192,7 +14192,7 @@ def test_text_2215L_blastx_001(self):
self.assertEqual(record.application, "BLASTX")
self.assertEqual(record.version, '2.2.15')
self.assertEqual(record.date, "Oct-15-2006")
- self.assertEqual(record.query, "66118") #Odd name for a query sequence, but valid!
+ self.assertEqual(record.query, "66118") # Odd name for a query sequence, but valid!
self.assertEqual(record.query_letters, 662)
self.assertEqual(record.database, "Leigo")
self.assertEqual(record.database_sequences, 4535438)
View
16 Tests/test_NCBIXML.py
@@ -1609,7 +1609,7 @@ def test_xml_2222_blastx_001(self):
self.assertEqual(record.num_sequences_in_database, 8994603)
self.assertEqual(record.database_sequences, 8994603)
#self.assertEqual(record.database_length, 3078807967)
- self.assertEqual(record.database_length, -1216159329) #NCBI bug!
+ self.assertEqual(record.database_length, -1216159329) # NCBI bug!
self.assertEqual(len(record.descriptions), 1)
self.assertEqual(len(record.alignments), 1)
self.assertEqual(len(record.alignments[0].hsps), 1)
@@ -1624,7 +1624,7 @@ def test_xml_2222_blastx_001(self):
self.assertEqual(record.num_sequences_in_database, 8994603)
self.assertEqual(record.database_sequences, 8994603)
#self.assertEqual(record.database_length, 3078807967)
- self.assertEqual(record.database_length, -1216159329) #NCBI bug!
+ self.assertEqual(record.database_length, -1216159329) # NCBI bug!
# I used -num_descriptions 10 and -num_alignments 1
self.assertEqual(len(record.descriptions), 10)
self.assertEqual(len(record.alignments), 10)
@@ -1642,7 +1642,7 @@ def test_xml_2222_blastx_001(self):
self.assertEqual(record.num_sequences_in_database, 8994603)
self.assertEqual(record.database_sequences, 8994603)
#self.assertEqual(record.database_length, 3078807967)
- self.assertEqual(record.database_length, -1216159329) #NCBI bug!
+ self.assertEqual(record.database_length, -1216159329) # NCBI bug!
self.assertEqual(len(record.descriptions), 0)
self.assertEqual(len(record.alignments), 0)
@@ -1656,7 +1656,7 @@ def test_xml_2222_blastx_001(self):
self.assertEqual(record.num_sequences_in_database, 8994603)
self.assertEqual(record.database_sequences, 8994603)
#self.assertEqual(record.database_length, 3078807967)
- self.assertEqual(record.database_length, -1216159329) #NCBI bug!
+ self.assertEqual(record.database_length, -1216159329) # NCBI bug!
self.assertEqual(len(record.descriptions), 10)
self.assertEqual(len(record.alignments), 10)
self.assertEqual(len(record.alignments[0].hsps), 1)
@@ -1672,7 +1672,7 @@ def test_xml_2222_blastx_001(self):
self.assertEqual(record.num_sequences_in_database, 8994603)
self.assertEqual(record.database_sequences, 8994603)
#self.assertEqual(record.database_length, 3078807967)
- self.assertEqual(record.database_length, -1216159329) #NCBI bug!
+ self.assertEqual(record.database_length, -1216159329) # NCBI bug!
self.assertEqual(len(record.descriptions), 10)
self.assertEqual(len(record.alignments), 10)
self.assertEqual(len(record.alignments[0].hsps), 2)
@@ -1688,7 +1688,7 @@ def test_xml_2222_blastx_001(self):
self.assertEqual(record.num_sequences_in_database, 8994603)
self.assertEqual(record.database_sequences, 8994603)
#self.assertEqual(record.database_length, 3078807967)
- self.assertEqual(record.database_length, -1216159329) #NCBI bug!
+ self.assertEqual(record.database_length, -1216159329) # NCBI bug!
self.assertEqual(len(record.descriptions), 10)
self.assertEqual(len(record.alignments), 10)
self.assertEqual(len(record.alignments[0].hsps), 1)
@@ -1704,7 +1704,7 @@ def test_xml_2222_blastx_001(self):
self.assertEqual(record.num_sequences_in_database, 8994603)
self.assertEqual(record.database_sequences, 8994603)
#self.assertEqual(record.database_length, 3078807967)
- self.assertEqual(record.database_length, -1216159329) #NCBI bug!
+ self.assertEqual(record.database_length, -1216159329) # NCBI bug!
self.assertEqual(len(record.descriptions), 10)
self.assertEqual(len(record.alignments), 10)
self.assertEqual(len(record.alignments[0].hsps), 1)
@@ -1733,7 +1733,7 @@ def test_xml_2222_blastp_001(self):
self.assertEqual(record.num_sequences_in_database, 8994603)
self.assertEqual(record.database_sequences, 8994603)
#self.assertEqual(record.database_length, 3078807967)
- self.assertEqual(record.database_length, -1216159329) #NCBI bug!
+ self.assertEqual(record.database_length, -1216159329) # NCBI bug!
self.assertEqual(len(record.descriptions), 10)
self.assertEqual(len(record.alignments), 10)
self.assertEqual(len(record.alignments[0].hsps), 1)
View
2 Tests/test_PAML_tools.py
@@ -28,7 +28,7 @@ def which(program):
#For Windows, the user is instructed to move the programs to a folder
#and then to add the folder to the system path. Just in case they didn't
#do that, we can check for it in Program Files.
- likely_dirs = ["", #Current dir
+ likely_dirs = ["", # Current dir
prog_files,
os.path.join(prog_files, "paml41"),
os.path.join(prog_files, "paml43"),
View
2 Tests/test_PDB.py
@@ -17,7 +17,7 @@
try:
import numpy
- from numpy import dot #Missing on PyPy's micronumpy
+ from numpy import dot # Missing on PyPy's micronumpy
del dot
except ImportError:
from Bio import MissingPythonDependencyError
View
2 Tests/test_PDB_KDTree.py
@@ -48,7 +48,7 @@ def get_coord(self):
hits = ns.search_all(5.0)
self.assertTrue(isinstance(hits, list), hits)
self.assertTrue(len(hits) >= 0, hits)
- x = array([250,250,250]) #Far away from our random atoms
+ x = array([250,250,250]) # Far away from our random atoms
self.assertEqual([], ns.search(x, 5.0, "A"))
self.assertEqual([], ns.search(x, 5.0, "R"))
self.assertEqual([], ns.search(x, 5.0, "C"))
View
22 Tests/test_Pathway.py
@@ -50,11 +50,11 @@ def testNodes(self):
def testEdges(self):
a = Graph(['a','b','c','d'])
a.add_edge('a','b','label1')
- self.assertEqual(a.child_edges('a'), [('b','label1')]) #, "incorrect child edges")
+ self.assertEqual(a.child_edges('a'), [('b','label1')]) # , "incorrect child edges")
a.add_edge('b','a','label2')
- self.assertEqual(a.parent_edges('a'), [('b','label2')]) #, "incorrect parent edges")
+ self.assertEqual(a.parent_edges('a'), [('b','label2')]) # , "incorrect parent edges")
a.add_edge('b','c','label3')
- self.assertEqual(a.parent_edges('c'), [('b','label3')]) #, "incorrect parent edges")
+ self.assertEqual(a.parent_edges('c'), [('b','label3')]) # , "incorrect parent edges")
l = a.children('b')
l.sort()
self.assertEqual(l, ['a', 'c'], "incorrect children")
@@ -72,7 +72,7 @@ def testRemoveNode(self):
a.remove_node('e')
b = Graph(['a','b','c','d'])
b.add_edge('a','b','label5')
- self.assertEqual(a, b)#, "incorrect node removal")
+ self.assertEqual(a, b) # , "incorrect node removal")
class MultiGraphTestCase(unittest.TestCase):
@@ -112,15 +112,15 @@ def testNodes(self):
def testEdges(self):
a = MultiGraph(['a','b','c','d'])
a.add_edge('a','b','label1')
- self.assertEqual(a.child_edges('a'), [('b','label1')]) #, "incorrect child edges")
+ self.assertEqual(a.child_edges('a'), [('b','label1')]) # , "incorrect child edges")
a.add_edge('a','b','label2')
l = a.child_edges('a')
l.sort()
- self.assertEqual(l, [('b','label1'),('b','label2')]) #, "incorrect child edges")
+ self.assertEqual(l, [('b','label1'),('b','label2')]) # , "incorrect child edges")
a.add_edge('b','a','label2')
- self.assertEqual(a.parent_edges('a'), [('b','label2')]) #, "incorrect parent edges")
+ self.assertEqual(a.parent_edges('a'), [('b','label2')]) # , "incorrect parent edges")
a.add_edge('b','c','label3')
- self.assertEqual(a.parent_edges('c'), [('b','label3')]) #, "incorrect parent edges")
+ self.assertEqual(a.parent_edges('c'), [('b','label3')]) # , "incorrect parent edges")
l = a.children('b')
l.sort()
self.assertEqual(l, ['a', 'c'], "incorrect children")
@@ -143,7 +143,7 @@ def testRemoveNode(self):
b.add_edge('a','b','label5')
self.assertEqual(repr(b), "<MultiGraph: ('a': ('b', 'label5'))('b': )('c': )('d': )>")
self.assertEqual(repr(a), repr(b))
- self.assertEqual(a, b)#, "incorrect node removal")
+ self.assertEqual(a, b) # , "incorrect node removal")
class ReactionTestCase(unittest.TestCase):
@@ -159,8 +159,8 @@ def setUp(self):
self.r_4 = Reaction({"c":-1, "d":-1, "a":1, "e":2})
def testEq(self):
- self.assertEqual(self.r_1, self.r_1i) #, "not equal to similar")
- self.assertNotEqual(self.r_3, self.r_4) #, "equal to different")
+ self.assertEqual(self.r_1, self.r_1i) # , "not equal to similar")
+ self.assertNotEqual(self.r_3, self.r_4) # , "equal to different")
def testRev(self):
self.assertEqual(self.r_empty.reverse(), self.r_empty, "empty reversed not empty")
View
2 Tests/test_PopGen_DFDist.py
@@ -24,7 +24,7 @@
if file == f or file.lower() == f.lower()+".exe":
wanted[f] = file
except os.error:
- pass #Path doesn't exist - correct to pass
+ pass # Path doesn't exist - correct to pass
if len(wanted) != 4:
raise MissingExternalDependencyError(
"Install Dfdist, Ddatacal, pv2 and cplot2 if you want to use DFDist with Bio.PopGen.FDist.")
View
2 Tests/test_PopGen_FDist.py
@@ -24,7 +24,7 @@
if file == f or file.lower() == f.lower()+".exe":
wanted[f] = file
except os.error:
- pass #Path doesn't exist - correct to pass
+ pass # Path doesn't exist - correct to pass
if len(wanted) != 4:
raise MissingExternalDependencyError(
"Install fdist2, datacal, pv and cplot if you want to use FDist2 with Bio.PopGen.FDist.")
View
4 Tests/test_PopGen_FDist_nodepend.py
@@ -58,7 +58,7 @@ def test_record_parser(self):
handle = self.handles[index]
rec = FDist.read(handle)
assert isinstance(rec, FDist.Record)
- assert rec.data_org == 0 #We don't support any other
+ assert rec.data_org == 0 # We don't support any other
assert rec.num_pops, rec.num_loci == self.pops_loci[index]
for i in range(len(self.num_markers[index])):
assert rec.loci_data[i][0] == \
@@ -97,7 +97,7 @@ def test_convert_big(self):
fd_rec = convert_genepop_to_fdist(gp_rec)
assert(fd_rec.num_loci == 3)
assert(fd_rec.num_pops == 3)
- gp_rec._handle.close() #TODO - Needs a proper fix
+ gp_rec._handle.close() # TODO - Needs a proper fix
def tearDown(self):
for handle in self.handles:
View
2 Tests/test_PopGen_GenePop.py
@@ -19,7 +19,7 @@
if filename.startswith('Genepop'):
found = True
except os.error:
- pass #Path doesn't exist - correct to pass
+ pass # Path doesn't exist - correct to pass
if not found:
raise MissingExternalDependencyError(
"Install GenePop if you want to use Bio.PopGen.GenePop.")
View
4 Tests/test_PopGen_GenePop_EasyController.py
@@ -19,13 +19,13 @@
if filename.startswith('Genepop'):
found = True
except os.error:
- pass #Path doesn't exist - correct to pass
+ pass # Path doesn't exist - correct to pass
if not found:
raise MissingExternalDependencyError(
"Install GenePop if you want to use Bio.PopGen.GenePop.")
-cur_dir = os.path.abspath(".") #Tests directory
+cur_dir = os.path.abspath(".") # Tests directory
class AppTest(unittest.TestCase):
View
2 Tests/test_PopGen_GenePop_nodepend.py
@@ -105,7 +105,7 @@ def test_file_record_parser(self):
continue
assert len(rec.populations[i]) == \
self.pops_indivs[index][1][i]
- rec._handle.close() #TODO - Needs a proper fix
+ rec._handle.close() # TODO - Needs a proper fix
def test_wrong_file_parser(self):
"""Testing the ability to deal with wrongly formatted files
View
2 Tests/test_PopGen_SimCoal.py
@@ -21,7 +21,7 @@
found = True
simcoal_dir = path
except os.error:
- pass #Path doesn't exist - correct to pass
+ pass # Path doesn't exist - correct to pass
if not found:
raise MissingExternalDependencyError(
"Install SIMCOAL2 if you want to use Bio.PopGen.SimCoal.")
View
6 Tests/test_Prank_tool.py
@@ -29,7 +29,7 @@
#For Windows, PRANK just comes as a zip file which contains the
#prank.exe file which the user could put anywhere. We'll try a few
#sensible locations under Program Files... and then the full path.
- likely_dirs = ["", #Current dir
+ likely_dirs = ["", # Current dir
prog_files,
os.path.join(prog_files,"Prank")] + sys.path
for folder in likely_dirs:
@@ -125,7 +125,7 @@ def test_Prank_complex_command_line(self):
cmdline.set_parameter("notree", True)
cmdline.set_parameter("-gaprate", 0.321)
cmdline.set_parameter("gapext", 0.6)
- cmdline.set_parameter("-dots", 1) #i.e. True
+ cmdline.set_parameter("-dots", 1) # i.e. True
#Try using a property:
cmdline.kappa = 3
cmdline.skipins = True
@@ -143,7 +143,7 @@ class PrankConversion(unittest.TestCase):
def setUp(self):
#As these reads are all 36, it can be seen as pre-aligned:
self.input = "Quality/example.fasta"
- self.output = 'temp with space' #prefix, PRANK will pick extensions
+ self.output = 'temp with space' # prefix, PRANK will pick extensions
def conversion(self, prank_number, prank_ext, format):
"""Get PRANK to do a conversion, and check it with SeqIO."""
View
2 Tests/test_SVDSuperimposer.py
@@ -5,7 +5,7 @@
#TODO - Don't use "from XXX import *"
try:
from numpy import *
- from numpy import dot #missing in PyPy's micronumpy
+ from numpy import dot # missing in PyPy's micronumpy
except ImportError:
from Bio import MissingPythonDependencyError
raise MissingPythonDependencyError(
View
2 Tests/test_SearchIO_index.py
@@ -1273,7 +1273,7 @@ def check_index(self, filename, format, **kwargs):
self.assertNotEqual(id(qres), id(dbidx_qres))
self.assertTrue(compare_search_obj(qres, dbidx_qres))
- indexed._proxy._handle.close() #TODO - Better solution
+ indexed._proxy._handle.close() # TODO - Better solution
if sqlite3 is not None:
db_indexed.close()
db_indexed._con.close()
View
50 Tests/test_SeqIO.py
@@ -52,8 +52,8 @@ def send_warnings_to_stdout(message, category, filename, lineno,
for format in sorted(AlignIO._FormatToWriter):
if format not in test_write_read_alignment_formats:
test_write_read_alignment_formats.append(format)
-test_write_read_alignment_formats.remove("gb") #an alias for genbank
-test_write_read_alignment_formats.remove("fastq-sanger") #an alias for fastq
+test_write_read_alignment_formats.remove("gb") # an alias for genbank
+test_write_read_alignment_formats.remove("fastq-sanger") # an alias for fastq
# test_files is a list of tuples containing:
# - string: file format
@@ -82,22 +82,22 @@ def send_warnings_to_stdout(message, category, filename, lineno,
("fasta", False, 'Fasta/rose.pro', 1),
("fasta", False, 'Fasta/rosemary.pro', 1),
#Following examples are also used in test_BioSQL_SeqIO.py
- ("fasta", False, 'Fasta/f001', 1), #Protein
- ("fasta", False, 'Fasta/f002', 3), #DNA
- #("fasta", False, 'Fasta/f003', 2), #Protein with comments
- ("fasta", False, 'Fasta/fa01', 2), #Protein with gaps
+ ("fasta", False, 'Fasta/f001', 1), # Protein
+ ("fasta", False, 'Fasta/f002', 3), # DNA
+ #("fasta", False, 'Fasta/f003', 2), # Protein with comments
+ ("fasta", False, 'Fasta/fa01', 2), # Protein with gaps
#Following are also used in test_SeqIO_features.py, see also NC_005816.gb
("fasta", False, 'GenBank/NC_005816.fna', 1),
("fasta", False, 'GenBank/NC_005816.ffn', 10),
("fasta", False, 'GenBank/NC_005816.faa', 10),
("fasta", False, 'GenBank/NC_000932.faa', 85),
- ("tab", False, 'GenBank/NC_005816.tsv', 10), # FASTA -> Tabbed
+ ("tab", False, 'GenBank/NC_005816.tsv', 10), # FASTA -> Tabbed
#Following examples are also used in test_GFF.py
- ("fasta", False, 'GFF/NC_001802.fna', 1), #upper case
- ("fasta", False, 'GFF/NC_001802lc.fna', 1), #lower case
- ("fasta", True, 'GFF/multi.fna', 3), #Trivial nucleotide alignment
+ ("fasta", False, 'GFF/NC_001802.fna', 1), # upper case
+ ("fasta", False, 'GFF/NC_001802lc.fna', 1), # lower case
+ ("fasta", True, 'GFF/multi.fna', 3), # Trivial nucleotide alignment
#Following example is also used in test_registry.py
- ("fasta", False, 'Registry/seqs.fasta', 2), #contains blank line
+ ("fasta", False, 'Registry/seqs.fasta', 2), # contains blank line
#Following example is also used in test_Nexus.py
("nexus", True, 'Nexus/test_Nexus_input.nex', 9),
#Following examples are also used in test_SwissProt.py
@@ -130,35 +130,35 @@ def send_warnings_to_stdout(message, category, filename, lineno,
("genbank",False, 'GenBank/iro.gb', 1),
("genbank",False, 'GenBank/pri1.gb', 1),
("genbank",False, 'GenBank/arab1.gb', 1),
- ("genbank",False, 'GenBank/protein_refseq.gb', 1), #Old version
- ("genbank",False, 'GenBank/protein_refseq2.gb', 1), #Revised version
+ ("genbank",False, 'GenBank/protein_refseq.gb', 1), # Old version
+ ("genbank",False, 'GenBank/protein_refseq2.gb', 1), # Revised version
("genbank",False, 'GenBank/extra_keywords.gb', 1),
("genbank",False, 'GenBank/one_of.gb', 1),
- ("genbank",False, 'GenBank/NT_019265.gb', 1), #contig, no sequence
+ ("genbank",False, 'GenBank/NT_019265.gb', 1), # contig, no sequence
("genbank",False, 'GenBank/origin_line.gb', 1),
("genbank",False, 'GenBank/blank_seq.gb', 1),
("genbank",False, 'GenBank/dbsource_wrap.gb', 1),
- ("genbank",False, 'GenBank/NC_005816.gb', 1), #See also AE017046.embl
+ ("genbank",False, 'GenBank/NC_005816.gb', 1), # See also AE017046.embl
("genbank",False, 'GenBank/NC_000932.gb', 1),
- ("genbank",False, 'GenBank/pBAD30.gb', 1), #Odd LOCUS line from Vector NTI
+ ("genbank",False, 'GenBank/pBAD30.gb', 1), # Odd LOCUS line from Vector NTI
# The next example is a truncated copy of gbvrl1.seq from
# ftp://ftp.ncbi.nih.gov/genbank/gbvrl1.seq.gz
# This includes an NCBI header, and the first three records:
("genbank",False, 'GenBank/gbvrl1_start.seq', 3),
#Following files are also used in test_GFF.py
("genbank",False, 'GFF/NC_001422.gbk', 1),
#Following files are currently only used here or in test_SeqIO_index.py:
- ("embl", False, 'EMBL/epo_prt_selection.embl', 9), #proteins
+ ("embl", False, 'EMBL/epo_prt_selection.embl', 9), # proteins
("embl", False, 'EMBL/TRBG361.embl', 1),
("embl", False, 'EMBL/DD231055_edited.embl', 1),
- ("embl", False, 'EMBL/SC10H5.embl', 1), # Pre 2006 style ID line
- ("embl", False, 'EMBL/U87107.embl', 1), # Old ID line with SV line
- ("embl", False, 'EMBL/AAA03323.embl', 1), # 2008, PA line but no AC
- ("embl", False, 'EMBL/AE017046.embl', 1), #See also NC_005816.gb
- ("embl", False, 'EMBL/Human_contigs.embl', 2), #contigs, no sequences
- ("embl", False, 'EMBL/location_wrap.embl', 1), #wrapped locations and unspecified type
- ("embl", False, 'EMBL/A04195.imgt', 1), # features over indented for EMBL
- ("imgt", False, 'EMBL/A04195.imgt', 1), # features over indented for EMBL
+ ("embl", False, 'EMBL/SC10H5.embl', 1), # Pre 2006 style ID line
+ ("embl", False, 'EMBL/U87107.embl', 1), # Old ID line with SV line
+ ("embl", False, 'EMBL/AAA03323.embl', 1), # 2008, PA line but no AC
+ ("embl", False, 'EMBL/AE017046.embl', 1), # See also NC_005816.gb
+ ("embl", False, 'EMBL/Human_contigs.embl', 2), # contigs, no sequences
+ ("embl", False, 'EMBL/location_wrap.embl', 1), # wrapped locations and unspecified type
+ ("embl", False, 'EMBL/A04195.imgt', 1), # features over indented for EMBL
+ ("imgt", False, 'EMBL/A04195.imgt', 1), # features over indented for EMBL
("stockholm", True, 'Stockholm/simple.sth', 2),
("stockholm", True, 'Stockholm/funny.sth', 6),
#Following PHYLIP files are currently only used here and in test_AlignIO.py,
View
2 Tests/test_SeqIO_FastaIO.py
@@ -70,7 +70,7 @@ class TitleFunctions(unittest.TestCase):
"""Cunning unit test where methods are added at run time."""
def simple_check(self, filename, alphabet):
"""Basic test for parsing single record FASTA files."""
- title, seq = read_title_and_seq(filename) #crude parser
+ title, seq = read_title_and_seq(filename) # crude parser
#First check using Bio.SeqIO.FastaIO directly with title function,
record = read_single_with_titles(filename, alphabet)
idn, name, descr = title_to_ids(title)
View
2 Tests/test_SeqIO_PdbIO.py
@@ -8,7 +8,7 @@
try:
import numpy
- from numpy import dot #Missing on PyPy's micronumpy
+ from numpy import dot # Missing on PyPy's micronumpy
del dot
except ImportError:
from Bio import MissingPythonDependencyError
View
6 Tests/test_SeqIO_QualityIO.py
@@ -140,7 +140,7 @@ def check_fails(self, filename, good_count, formats=None, raw=True):
handle = open(filename, "rU")
records = SeqIO.parse(handle, format)
for i in range(good_count):
- record = records.next() #Make sure no errors!
+ record = records.next() # Make sure no errors!
self.assertTrue(isinstance(record, SeqRecord))
self.assertRaises(ValueError, records.next)
handle.close()
@@ -149,7 +149,7 @@ def check_general_fails(self, filename, good_count):
handle = open(filename, "rU")
tuples = QualityIO.FastqGeneralIterator(handle)
for i in range(good_count):
- title, seq, qual = tuples.next() #Make sure no errors!
+ title, seq, qual = tuples.next() # Make sure no errors!
self.assertRaises(ValueError, tuples.next)
handle.close()
@@ -599,7 +599,7 @@ def test_E3MFGYR02_trimmed(self) :
"""Write and read back E3MFGYR02_random_10_reads.sff (trimmed)"""
self.check(os.path.join("Roche", "E3MFGYR02_random_10_reads.sff"), "sff-trim",
["fastq", "fastq-sanger", "fastq-illumina", "fastq-solexa",
- "fasta", "qual", "phd"]) #not sff as output
+ "fasta", "qual", "phd"]) # not sff as output
class MappingTests(unittest.TestCase):
View
2 Tests/test_SeqIO_convert.py
@@ -95,7 +95,7 @@ def compare_record(old, new, truncate=None):
if old.description != new.description \
and (old.id+" "+old.description).strip() != new.description \
and new.description != "<unknown description>" \
- and new.description != "" : #e.g. tab format
+ and new.description != "": # e.g. tab format
raise ValueError("'%s' vs '%s' " % (old.description, new.description))
if len(old.seq) != len(new.seq):
raise ValueError("%i vs %i" % (len(old.seq), len(new.seq)))
View
18 Tests/test_SeqIO_features.py
@@ -226,7 +226,7 @@ def check(self, parent_seq, feature, answer_str, location_str):
self.assertEqual(new, answer_str)
new = feature.extract(parent_seq.tomutable())
- self.assertTrue(isinstance(new, Seq)) #Not MutableSeq!
+ self.assertTrue(isinstance(new, Seq)) # Not MutableSeq!
self.assertEqual(str(new), answer_str)
new = feature.extract(UnknownSeq(len(parent_seq), parent_seq.alphabet))
@@ -253,14 +253,14 @@ def check(self, parent_seq, feature, answer_str, location_str):
#unit test have mostly defaulted to strand None.
self.assertEqual(len(feature.sub_features), len(new_f.sub_features))
for f1, f2 in zip(feature.sub_features, new_f.sub_features):
- f1.type = "misc_feature" #hack as may not be misc_feature
+ f1.type = "misc_feature" # hack as may not be misc_feature
if f1.strand is None:
- f1.strand = f2.strand #hack as described above
+ f1.strand = f2.strand # hack as described above
self.assertEqual(f1.strand, f2.strand)
self.assertTrue(compare_feature(f1,f2))
- feature.type = "misc_feature" #hack as may not be misc_feature
+ feature.type = "misc_feature" # hack as may not be misc_feature
if not feature.strand:
- feature.strand = new_f.strand #hack as above
+ feature.strand = new_f.strand # hack as above
self.assertEqual(feature.strand, new_f.strand)
self.assertTrue(compare_feature(feature, new_f))
@@ -959,11 +959,11 @@ def test_within(self):
class NC_000932(unittest.TestCase):
#This includes an evil dual strand gene
basename = "NC_000932"
- emblname = None # "AP000423" has different annotation (e.g. more CDS)
+ emblname = None # "AP000423" has different annotation (e.g. more CDS)
table = 11
- skip_trans_test = ["gi|7525080|ref|NP_051037.1|", #dual-strand
- "gi|7525057|ref|NP_051038.1|", #dual-strand
- "gi|90110725|ref|NP_051109.2|", #Invalid annotation? No start codon
+ skip_trans_test = ["gi|7525080|ref|NP_051037.1|", # dual-strand
+ "gi|7525057|ref|NP_051038.1|", # dual-strand
+ "gi|90110725|ref|NP_051109.2|", # Invalid annotation? No start codon
]
__doc__ = "Tests using %s GenBank and FASTA files from the NCBI" % basename
#TODO - neat way to change the docstrings...
View
22 Tests/test_SeqIO_index.py
@@ -45,7 +45,7 @@ def gzip_open(filename, format):
if sys.version_info[0] < 3 or format in SeqIO._BinaryFormats:
return gzip.open(filename)
handle = gzip.open(filename)
- data = handle.read() #bytes!
+ data = handle.read() # bytes!
handle.close()
return StringIO(_bytes_to_string(data))
@@ -105,7 +105,7 @@ def simple_check(self, filename, format, alphabet, comp):
rec_dict = SeqIO.index(filename, format, alphabet)
self.check_dict_methods(rec_dict, id_list, id_list)
- rec_dict._proxy._handle.close() #TODO - Better solution
+ rec_dict._proxy._handle.close() # TODO - Better solution
del rec_dict
if not sqlite3:
@@ -137,22 +137,22 @@ def simple_check(self, filename, format, alphabet, comp):
alphabet)
self.check_dict_methods(rec_dict, id_list, id_list)
rec_dict.close()
- rec_dict._con.close() #hack for PyPy
+ rec_dict._con.close() # hack for PyPy
del rec_dict
#Now reload it...
rec_dict = SeqIO.index_db(index_tmp, [filename], format,
alphabet)
self.check_dict_methods(rec_dict, id_list, id_list)
rec_dict.close()
- rec_dict._con.close() #hack for PyPy
+ rec_dict._con.close() # hack for PyPy
del rec_dict
#Now reload without passing filenames and format
rec_dict = SeqIO.index_db(index_tmp, alphabet=alphabet)
self.check_dict_methods(rec_dict, id_list, id_list)
rec_dict.close()
- rec_dict._con.close() #hack for PyPy
+ rec_dict._con.close() # hack for PyPy
del rec_dict
os.remove(index_tmp)
@@ -168,7 +168,7 @@ def key_check(self, filename, format, alphabet, comp):
key_list = [add_prefix(id) for id in id_list]
rec_dict = SeqIO.index(filename, format, alphabet, add_prefix)
self.check_dict_methods(rec_dict, key_list, id_list)
- rec_dict._proxy._handle.close() #TODO - Better solution
+ rec_dict._proxy._handle.close() # TODO - Better solution
del rec_dict
if not sqlite3:
@@ -196,23 +196,23 @@ def key_check(self, filename, format, alphabet, comp):
add_prefix)
self.check_dict_methods(rec_dict, key_list, id_list)
rec_dict.close()
- rec_dict._con.close() #hack for PyPy
+ rec_dict._con.close() # hack for PyPy
del rec_dict
#Now reload it...
rec_dict = SeqIO.index_db(index_tmp, [filename], format, alphabet,
add_prefix)
self.check_dict_methods(rec_dict, key_list, id_list)
rec_dict.close()
- rec_dict._con.close() #hack for PyPy
+ rec_dict._con.close() # hack for PyPy
del rec_dict
#Now reload without passing filenames and format
rec_dict = SeqIO.index_db(index_tmp, alphabet=alphabet,
key_function=add_prefix)
self.check_dict_methods(rec_dict, key_list, id_list)
rec_dict.close()
- rec_dict._con.close() #hack for PyPy
+ rec_dict._con.close() # hack for PyPy
del rec_dict
os.remove(index_tmp)
#Done
@@ -331,7 +331,7 @@ def get_raw_check(self, filename, format, alphabet, comp):
else:
rec2 = SeqIO.read(handle, format, alphabet)
self.assertEqual(True, compare_record(rec1, rec2))
- rec_dict._proxy._handle.close() #TODO - Better solution
+ rec_dict._proxy._handle.close() # TODO - Better solution
del rec_dict
if sqlite3:
@@ -365,7 +365,7 @@ def test_duplicates_to_dict(self):
("EMBL/epo_prt_selection.embl", "embl", None),
("EMBL/U87107.embl", "embl", None),
("EMBL/TRBG361.embl", "embl", None),
- ("EMBL/A04195.imgt", "embl", None), #Not a proper EMBL file, an IMGT file
+ ("EMBL/A04195.imgt", "embl", None), # Not a proper EMBL file, an IMGT file
("EMBL/A04195.imgt", "imgt", None),
("GenBank/NC_000932.faa", "fasta", generic_protein),
("GenBank/NC_005816.faa", "fasta", generic_protein),
View
4 Tests/test_SeqIO_write.py
@@ -27,8 +27,8 @@
for format in sorted(AlignIO._FormatToWriter):
if format not in test_write_read_alignment_formats:
test_write_read_alignment_formats.append(format)
-test_write_read_alignment_formats.remove("gb") #an alias for genbank
-test_write_read_alignment_formats.remove("fastq-sanger") #an alias for fastq
+test_write_read_alignment_formats.remove("gb") # an alias for genbank
+test_write_read_alignment_formats.remove("fastq-sanger") # an alias for fastq
# This is a list of three-tuples. Each tuple contains a
View
4 Tests/test_SeqRecord.py
@@ -149,7 +149,7 @@ def test_add_seq(self):
self.assertEqual(len(rec.features), len(self.record.features))
self.assertEqual(rec.features[0].type, "source")
self.assertEqual(rec.features[0].location.nofuzzy_start, 0)
- self.assertEqual(rec.features[0].location.nofuzzy_end, 26) #not +3
+ self.assertEqual(rec.features[0].location.nofuzzy_end, 26) # not +3
def test_add_seqrecord(self):
"""Simple left addition of SeqRecord from genbank file."""
@@ -168,7 +168,7 @@ def test_add_seqrecord(self):
len(self.record.features) + len(other.features))
self.assertEqual(rec.features[0].type, "source")
self.assertEqual(rec.features[0].location.nofuzzy_start, 0)
- self.assertEqual(rec.features[0].location.nofuzzy_end, len(self.record)) #not +3
+ self.assertEqual(rec.features[0].location.nofuzzy_end, len(self.record)) # not +3
i = len(self.record.features)
self.assertEqual(rec.features[i].type, "source")
self.assertEqual(rec.features[i].location.nofuzzy_start, len(self.record))
View
10 Tests/test_Seq_objs.py
@@ -204,7 +204,7 @@ def test_str_startswith(self):
self.assertEqual(str(example1).startswith(subs_str),
example1.startswith(subs))
self.assertEqual(str(example1).startswith(subs_str),
- example1.startswith(subs_str)) #strings!
+ example1.startswith(subs_str)) # strings!
self.assertEqual(str(example1).startswith(subs_str,3),
example1.startswith(subs,3))
self.assertEqual(str(example1).startswith(subs_str,2,6),
@@ -232,7 +232,7 @@ def test_str_endswith(self):
self.assertEqual(str(example1).endswith(subs_str),
example1.endswith(subs))
self.assertEqual(str(example1).startswith(subs_str),
- example1.startswith(subs_str)) #strings!
+ example1.startswith(subs_str)) # strings!
self.assertEqual(str(example1).endswith(subs_str,3),
example1.endswith(subs,3))
self.assertEqual(str(example1).endswith(subs_str,2,6),
@@ -301,7 +301,7 @@ def test_str_getitem(self):
if step == 0:
try:
print example1[i:j:step]
- self._assert(False) #Should fail!
+ self._assert(False) # Should fail!
except ValueError:
pass
else:
@@ -408,7 +408,7 @@ def test_the_transcription(self):
raise e
str1 = str(example1)
self.assertEqual(str1.replace("T","U").replace("t","u"), str(tran))
- self.assertEqual(tran.alphabet, generic_rna) #based on limited examples
+ self.assertEqual(tran.alphabet, generic_rna) # based on limited examples
def test_the_back_transcription(self):
"""Check obj.back_transcribe() method."""
@@ -426,7 +426,7 @@ def test_the_back_transcription(self):
raise e
str1 = str(example1)
self.assertEqual(str1.replace("U","T").replace("u","t"), str(tran))
- self.assertEqual(tran.alphabet, generic_dna) #based on limited examples
+ self.assertEqual(tran.alphabet, generic_dna) # based on limited examples
def test_the_translate(self):
"""Check obj.translate() method."""
View
2 Tests/test_SubsMat.py
@@ -51,7 +51,7 @@
s += counts[key]
f.write("Total sum %.2f should be 1.0\n" % (s))
lo_mat_prot = \
-SubsMat.make_log_odds_matrix(acc_rep_mat=acc_rep_mat,round_digit=1) #,ftab_prot
+SubsMat.make_log_odds_matrix(acc_rep_mat=acc_rep_mat,round_digit=1) # ,ftab_prot
f.write("\nLog odds matrix\n")
f.write("\nLog odds half matrix\n")
# Was %.1f. Let us see if this is OK
View
2 Tests/test_TCoffee_tool.py
@@ -36,7 +36,7 @@ class TCoffeeApplication(unittest.TestCase):
def setUp(self):
self.infile1 = "Fasta/fa01"
self.outfile1 = "fa01.aln"
- self.outfile2 = "fa01.html" #Written by default when no output set
+ self.outfile2 = "fa01.html" # Written by default when no output set
self.outfile3 = "Fasta/tc_out.pir"
self.outfile4 = "Fasta/tc_out.phy"
View
20 Tests/test_TogoWS.py
@@ -208,7 +208,7 @@ def test_invalid_db(self):
def test_nucleotide_genbank(self):
"""Bio.TogoWS.entry("nucleotide", "X52960")"""
- handle = TogoWS.entry("nucleotide", "X52960") #Returns "genbank" format
+ handle = TogoWS.entry("nucleotide", "X52960") # Returns "genbank" format
record = SeqIO.read(handle, "gb")
handle.close()
self.assertEqual(record.id, "X52960.1")
@@ -219,49 +219,49 @@ def test_nucleotide_genbank(self):
def test_nucleotide_genbank_length(self):
"""Bio.TogoWS.entry("nucleotide", "X52960", field="length")"""
handle = TogoWS.entry("nucleotide", "X52960", field="length")
- data = handle.read().strip() #ignore trailing \n
+ data = handle.read().strip() # ignore trailing \n
handle.close()
self.assertEqual(data, "248")
def test_nucleotide_genbank_seq(self):
"""Bio.TogoWS.entry("nucleotide", "X52960", field="seq")"""
handle = TogoWS.entry("nucleotide", "X52960", field="seq")
- data = handle.read().strip() #ignore trailing \n
+ data = handle.read().strip() # ignore trailing \n
handle.close()
self.assertEqual(seguid(data), "Ktxz0HgMlhQmrKTuZpOxPZJ6zGU")
def test_nucleotide_genbank_definition(self):
"""Bio.TogoWS.entry("nucleotide", "X52960", field="definition")"""
handle = TogoWS.entry("nucleotide", "X52960", field="definition")
- data = handle.read().strip() #ignore trailing \n
+ data = handle.read().strip() # ignore trailing \n
handle.close()
self.assertEqual(data, "Coleus blumei viroid 1 (CbVd) RNA.")
def test_nucleotide_genbank_accession(self):
"""Bio.TogoWS.entry("nucleotide", "X52960", field="accession")"""
handle = TogoWS.entry("nucleotide", "X52960", field="accession")
- data = handle.read().strip() #ignore trailing \n
+ data = handle.read().strip() # ignore trailing \n
handle.close()
self.assertEqual(data, "X52960")
def test_nucleotide_genbank_accession(self):
"""Bio.TogoWS.entry("nucleotide", "X52960", field="version")"""
handle = TogoWS.entry("nucleotide", "X52960", field="version")
- data = handle.read().strip() #ignore trailing \n
+ data = handle.read().strip() # ignore trailing \n
handle.close()
self.assertEqual(data, "1")
def test_nucleotide_genbank_acc_version(self):
"""Bio.TogoWS.entry("nucleotide", "X52960", field="acc_version")"""
handle = TogoWS.entry("nucleotide", "X52960", field="acc_version")
- data = handle.read().strip() #ignore trailing \n
+ data = handle.read().strip() # ignore trailing \n
handle.close()
self.assertEqual(data, "X52960.1")
def test_nucleotide_genbank_organism(self):
"""Bio.TogoWS.entry("nucleotide", "X52960", field="organism")"""
handle = TogoWS.entry("nucleotide", "X52960", field="organism")
- data = handle.read().strip() #ignore trailing \n
+ data = handle.read().strip() # ignore trailing \n
handle.close()
self.assertEqual(data, "Coleus blumei viroid 1")
@@ -300,14 +300,14 @@ def test_embl_AM905444_gff3(self):
def test_embl_AM905444_seq(self):
"""Bio.TogoWS.entry("embl", "AM905444", field="seq")"""
handle = TogoWS.entry("embl", "AM905444", field="seq")
- data = handle.read().strip() #ignore any trailing \n
+ data = handle.read().strip() # ignore any trailing \n
handle.close()
self.assertEqual(seguid(data), "G0HtLpwF7i4FXUaUjDUPTjok79c")
def test_embl_AM905444_definition(self):
"""Bio.TogoWS.entry("embl", "AM905444", field="definition")"""
handle = TogoWS.entry("embl", "AM905444", field="definition")
- data = handle.read().strip() #ignore any trailing \n
+ data = handle.read().strip() # ignore any trailing \n
handle.close()
self.assertEqual(data, "Herbaspirillum seropedicae locus tag HS193.0074 for porin")
View
4 Tests/test_Uniprot.py
@@ -87,8 +87,8 @@ def compare_txt_xml(self, old, new):
#Tweak for line breaks in plain text SwissProt
r1.title = r1.title.replace("- ", "-")
r2.title = r2.title.replace("- ", "-")
- r1.journal = r1.journal.rstrip(".") #Should parser do this?
- r1.medline_id = "" #Missing in UniPort MXL? TODO - check
+ r1.journal = r1.journal.rstrip(".") # Should parser do this?
+ r1.medline_id = "" # Missing in UniPort MXL? TODO - check
#Lots of extra comments in UniProt XML
r1.comment = ""
r2.comment = ""
View
6 Tests/test_bgzf.py
@@ -39,7 +39,7 @@ def rewrite(self, compressed_input_file, output_file):
self.assertFalse(h.seekable())
self.assertFalse(h.isatty())
self.assertEqual(h.fileno(), h._handle.fileno())
- h.close() #Gives empty BGZF block as BAM EOF marker
+ h.close() # Gives empty BGZF block as BAM EOF marker
h = gzip.open(output_file)
new_data = h.read()
@@ -61,12 +61,12 @@ def check_blocks(self, old_file, new_file):
self.assertEqual(old, new)
def check_text(self, old_file, new_file):
- h = open(old_file) #text mode!
+ h = open(old_file) # text mode!
old_line = h.readline()
old = old_line + h.read()
h.close()
- h = bgzf.BgzfReader(new_file, "r") #Text mode!
+ h = bgzf.BgzfReader(new_file, "r") # Text mode!
new_line = h.readline()
new = new_line + h.read(len(old))
h.close()
View
12 Tests/test_seq.py
@@ -248,7 +248,7 @@
print str(a.strip(b))
assert False, "Alphabet should have clashed!"
except TypeError:
- pass #Good!
+ pass # Good!
for chars in test_chars:
str_chars = str(chars)
@@ -307,7 +307,7 @@ def sorted_dict(d):
print "RNA Ambiguity mapping:", sorted_dict(ambiguous_rna_values)
print "RNA Complement mapping:", sorted_dict(ambiguous_rna_complement)
for ambig_char, values in sorted(ambiguous_rna_values.iteritems()):
- compl_values = complement(values).replace("T","U") #need to help as no alphabet
+ compl_values = complement(values).replace("T","U") # need to help as no alphabet
print "%s={%s} --> {%s}=%s" % \
(ambig_char, values, compl_values, ambiguous_rna_complement[ambig_char])
assert set(compl_values) == set(ambiguous_rna_values[ambiguous_rna_complement[ambig_char]])
@@ -352,7 +352,7 @@ def sorted_dict(d):
Seq.Seq("AUGAAACUG", IUPAC.unambiguous_rna),
Seq.Seq("AUGAAACUGWN", IUPAC.ambiguous_rna),
Seq.Seq("ATGAAACTG", Alphabet.generic_nucleotide),
- Seq.Seq("AUGAAACTG", Alphabet.generic_nucleotide), #U and T
+ Seq.Seq("AUGAAACTG", Alphabet.generic_nucleotide), # U and T
Seq.MutableSeq("ATGAAACTG", Alphabet.generic_dna),
Seq.MutableSeq("AUGaaaCUG", IUPAC.unambiguous_rna),
Seq.Seq("ACTGTCGTCT", Alphabet.generic_protein)]
@@ -400,7 +400,7 @@ def sorted_dict(d):
except ValueError:
pass
if not isinstance(s, Seq.Seq):
- continue #Only Seq has this method
+ continue # Only Seq has this method
try:
print s.transcribe()
assert False, "Transcription shouldn't work on a protein!"
@@ -434,7 +434,7 @@ def sorted_dict(d):
except ValueError:
pass
if not isinstance(s, Seq.Seq):
- continue #Only Seq has this method
+ continue # Only Seq has this method
try:
print s.back_transcribe()
assert False, "Back transcription shouldn't work on a protein!"
@@ -519,7 +519,7 @@ def sorted_dict(d):
except ValueError:
pass
if not isinstance(s, Seq.Seq):
- continue #Only Seq has this method
+ continue # Only Seq has this method
try:
print s.translate()
assert False, "Translation shouldn't work on a protein!"

0 comments on commit 10a6320

Please sign in to comment.