Skip to content

Commit

Permalink
Prank: PEP8 whitespace cleanup.
Browse files Browse the repository at this point in the history
  • Loading branch information
cbrueffer authored and peterjc committed Mar 29, 2013
1 parent 0e2fef0 commit b6e413d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
6 changes: 3 additions & 3 deletions Bio/Align/Applications/_Prank.py
Expand Up @@ -46,7 +46,7 @@ class PrankCommandline(AbstractCommandline):
Last checked against version: 081202 Last checked against version: 081202
""" """
def __init__(self, cmd="prank", **kwargs): def __init__(self, cmd="prank", **kwargs):
OUTPUT_FORMAT_VALUES = list(range(1,18)) OUTPUT_FORMAT_VALUES = list(range(1, 18))
self.parameters = [ self.parameters = [
################## input/output parameters: ################## ################## input/output parameters: ##################
#-d=sequence_file #-d=sequence_file
Expand All @@ -55,7 +55,7 @@ def __init__(self, cmd="prank", **kwargs):
filename=True, filename=True,
is_required=True), is_required=True),
#-t=tree_file [default: no tree, generate approximate NJ tree] #-t=tree_file [default: no tree, generate approximate NJ tree]
_Option(["-t", "t"],"Input guide tree filename", _Option(["-t", "t"], "Input guide tree filename",
filename=True), filename=True),
#-tree="tree_string" [tree in newick format; in double quotes] #-tree="tree_string" [tree in newick format; in double quotes]
_Option(["-tree", "tree"], _Option(["-tree", "tree"],
Expand Down Expand Up @@ -193,7 +193,7 @@ def __init__(self, cmd="prank", **kwargs):
_Switch(["-convert", "convert"], _Switch(["-convert", "convert"],
"Convert input alignment to new format. Do " "Convert input alignment to new format. Do "
"not perform alignment") "not perform alignment")
] ]
AbstractCommandline.__init__(self, cmd, **kwargs) AbstractCommandline.__init__(self, cmd, **kwargs)




Expand Down
18 changes: 9 additions & 9 deletions Tests/test_Prank_tool.py
Expand Up @@ -19,7 +19,7 @@
os.environ['LANG'] = 'C' os.environ['LANG'] = 'C'


prank_exe = None prank_exe = None
if sys.platform=="win32": if sys.platform == "win32":
try: try:
#This can vary depending on the Windows language. #This can vary depending on the Windows language.
prog_files = os.environ["PROGRAMFILES"] prog_files = os.environ["PROGRAMFILES"]
Expand All @@ -30,7 +30,7 @@
#sensible locations under Program Files... and then the full path. #sensible locations under Program Files... and then the full path.
likely_dirs = ["", # Current dir likely_dirs = ["", # Current dir
prog_files, prog_files,
os.path.join(prog_files,"Prank")] + sys.path os.path.join(prog_files, "Prank")] + sys.path
for folder in likely_dirs: for folder in likely_dirs:
if os.path.isdir(folder): if os.path.isdir(folder):
if os.path.isfile(os.path.join(folder, "prank.exe")): if os.path.isfile(os.path.join(folder, "prank.exe")):
Expand Down Expand Up @@ -90,12 +90,12 @@ def test_Prank_simple_with_NEXUS_output(self):
"""Simple round-trip through app with infile, output in NEXUS """Simple round-trip through app with infile, output in NEXUS
output.?.??? files written to cwd - no way to redirect output.?.??? files written to cwd - no way to redirect
""" """
records = list(SeqIO.parse(self.infile1,"fasta")) records = list(SeqIO.parse(self.infile1, "fasta"))
#Try using keyword argument, #Try using keyword argument,
cmdline = PrankCommandline(prank_exe, d=self.infile1, noxml=True) cmdline = PrankCommandline(prank_exe, d=self.infile1, noxml=True)
#Try using a property, #Try using a property,
cmdline.d = self.infile1 cmdline.d = self.infile1
cmdline.f = 17 # NEXUS format cmdline.f = 17 # NEXUS format
cmdline.set_parameter("notree", True) cmdline.set_parameter("notree", True)
self.assertEqual(str(cmdline), prank_exe + self.assertEqual(str(cmdline), prank_exe +
" -d=Fasta/fa01 -f=17 -noxml -notree") " -d=Fasta/fa01 -f=17 -noxml -notree")
Expand All @@ -107,10 +107,10 @@ def test_Prank_simple_with_NEXUS_output(self):
align = AlignIO.read("output.2.nex", "nexus") align = AlignIO.read("output.2.nex", "nexus")
for old, new in zip(records, align): for old, new in zip(records, align):
#Old versions of Prank reduced name to 9 chars #Old versions of Prank reduced name to 9 chars
self.assertTrue(old.id==new.id or old.id[:9]==new.id) self.assertTrue(old.id == new.id or old.id[:9] == new.id)
#infile1 has alignment gaps in it #infile1 has alignment gaps in it
self.assertEqual(str(new.seq).replace("-",""), self.assertEqual(str(new.seq).replace("-", ""),
str(old.seq).replace("-","")) str(old.seq).replace("-", ""))
except NexusError: except NexusError:
#See bug 3119, #See bug 3119,
#Bio.Nexus can't parse output from prank v100701 (1 July 2010) #Bio.Nexus can't parse output from prank v100701 (1 July 2010)
Expand Down Expand Up @@ -165,7 +165,7 @@ def conversion(self, prank_number, prank_ext, format):
self.assertTrue(os.path.isfile(filename)) self.assertTrue(os.path.isfile(filename))
old = AlignIO.read(self.input, "fasta") old = AlignIO.read(self.input, "fasta")
#Hack... #Hack...
if format=="phylip": if format == "phylip":
for record in old: for record in old:
record.id = record.id[:10] record.id = record.id[:10]
new = AlignIO.read(filename, format) new = AlignIO.read(filename, format)
Expand Down Expand Up @@ -197,5 +197,5 @@ def test_convert_to_phylip(self):




if __name__ == "__main__": if __name__ == "__main__":
runner = unittest.TextTestRunner(verbosity = 2) runner = unittest.TextTestRunner(verbosity=2)
unittest.main(testRunner=runner) unittest.main(testRunner=runner)

0 comments on commit b6e413d

Please sign in to comment.