Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

providing a starting tree skips first tree building step #29

Merged
merged 1 commit into from
May 29, 2012
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions run_gubbins.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from array import *
from Bio import SeqIO
from cStringIO import StringIO
import shutil


# config variables
Expand Down Expand Up @@ -106,7 +107,11 @@ def fasttree_tree_building_command(i, starting_tree, current_tree_name,starting_
def fasttree_gubbins_command(base_filename,starting_base_filename, i,alignment_filename,gubbins_exec,min_snps):
current_tree_name = fasttree_current_tree_name(base_filename, i)
return gubbins_exec+" -r -v "+starting_base_filename+".vcf -t "+str(current_tree_name)+" -p "+starting_base_filename+".phylip -m "+ str(min_snps)+" "+ alignment_filename


def starting_tree_gubbins_command(base_filename,starting_base_filename, i,alignment_filename,gubbins_exec,min_snps,starting_tree):
return gubbins_exec+" -r -v "+starting_base_filename+".vcf -t "+str(starting_tree)+" -p "+starting_base_filename+".phylip -m "+ str(min_snps)+" "+ alignment_filename


def number_of_sequences_in_alignment(filename):
return len(get_sequence_names_from_alignment(filename))

Expand Down Expand Up @@ -197,7 +202,7 @@ def is_exe(fpath):
current_tree_name = ""

for i in range(1, args.iterations+1):

if args.tree_builder == "hybrid" :
if i == 1:
previous_tree_name = fasttree_previous_tree_name(base_filename, i)
Expand Down Expand Up @@ -233,7 +238,13 @@ def is_exe(fpath):

if args.verbose > 0:
print tree_building_command
subprocess.call(tree_building_command, shell=True)


if args.starting_tree is not None and i == 1:
copyfile(args.starting_tree, current_tree_name)
else:
subprocess.call(tree_building_command, shell=True)

if args.verbose > 0:
print int(time.time())

Expand Down