예제 #1
0
def get_simple_global_fitter_config_filename(input_filename, output_filename, code, model, bf_file):
    contents = """
_genomeScreenOptions = {};

/* all paths are either absolute or relative to the DATA READER;
   the first 4 options are for the data reader*/

_genomeScreenOptions ["00"] = "../AnalysisModules/SimpleGlobalFitter.bf";
/* which analysis to run on each gene; */
_genomeScreenOptions ["01"] = "../Writers/TAB.bf";
/* what output to produce; */
_genomeScreenOptions ["02"] = "";
/* tree string; leave blank to use NJ for inference in some analyses */
/* try to paste "(human, chimp, mouse)" to see the use of a fixed tree */
_genomeScreenOptions ["03"] = "%s";
/* alignment file */
_genomeScreenOptions ["04"] = "%s";
/* output csv file */

/* options for the analysis */
_genomeScreenOptions ["05"] = "%s";
/* genetic code */
_genomeScreenOptions ["06"] = "%s";
/* nucleotide bias string; can define any of the 203 models */

ExecuteAFile ("%s", _genomeScreenOptions);
""" % (input_filename, output_filename, code, model, bf_file)
    return hyphy_util.get_filled_temp_filename(contents)
예제 #2
0
#takes fasta alignments, a distance metric and builds neighbor joining trees
import os, sys
from galaxy import eggs
from galaxy.tools.util import hyphy_util

#Retrieve hyphy path, this will need to be the same across the cluster
tool_data = sys.argv.pop()
HYPHY_PATH = os.path.join( tool_data, "HYPHY" )
HYPHY_EXECUTABLE = os.path.join( HYPHY_PATH, "HYPHY" )

#Read command line arguments
input_filename = os.path.abspath(sys.argv[1].strip())
output_filename1 = os.path.abspath(sys.argv[2].strip())
output_filename2 = os.path.abspath(sys.argv[3].strip())
distance_metric = sys.argv[4].strip()
temp_ps_filename = hyphy_util.get_filled_temp_filename("")

#Guess if this is a single or multiple FASTA input file
found_blank = False
is_multiple = False
for line in open(input_filename):
    line = line.strip()
    if line == "": found_blank = True
    elif line.startswith(">") and found_blank:
        is_multiple = True
        break
    else: found_blank = False

NJ_tree_shared_ibf = hyphy_util.get_filled_temp_filename(hyphy_util.NJ_tree_shared_ibf)

#set up NJ_tree file
예제 #3
0
tool_data = sys.argv.pop()
HYPHY_PATH = os.path.join( tool_data, "HYPHY" )
HYPHY_EXECUTABLE = os.path.join( HYPHY_PATH, "HYPHY" )

#Read command line arguments
input_filename = os.path.abspath(sys.argv[1].strip())
output_filename = os.path.abspath(sys.argv[2].strip())
tree_contents = sys.argv[3].strip()
nuc_model = sys.argv[4].strip()
analysis = sys.argv[5].strip()

if tree_contents == "":
    print >> sys.stderr, "Please specify a valid tree definition."
    sys.exit()
        
tree_filename = hyphy_util.get_filled_temp_filename(tree_contents)

if analysis == "local":
    fitter_filename = hyphy_util.get_filled_temp_filename(hyphy_util.SimpleLocalFitter)
else:
    fitter_filename = hyphy_util.get_filled_temp_filename(hyphy_util.SimpleGlobalFitter)

tabwriter_filename = hyphy_util.get_filled_temp_filename(hyphy_util.TabWriter)
FastaReader_filename = hyphy_util.get_filled_temp_filename(hyphy_util.FastaReader)
#setup Config file
config_filename = hyphy_util.get_dnds_config_filename(fitter_filename, tabwriter_filename, "Universal", tree_filename, input_filename, nuc_model, output_filename, FastaReader_filename)

#Run Hyphy
hyphy_cmd = "%s BASEPATH=%s USEPATH=/dev/null %s" % (HYPHY_EXECUTABLE, HYPHY_PATH, config_filename)
hyphy = os.popen(hyphy_cmd, 'r')
#print hyphy.read()
#Retrieve hyphy path, this will need to be the same across the cluster
tool_data = sys.argv.pop()
HYPHY_PATH = os.path.join(tool_data, "HYPHY")
HYPHY_EXECUTABLE = os.path.join(HYPHY_PATH, "HYPHY")

#Read command line arguments
input_filename = os.path.abspath(sys.argv[1].strip())
output_filename = os.path.abspath(sys.argv[2].strip())
tree_contents = sys.argv[3].strip()
nuc_model = sys.argv[4].strip()
base_freq = sys.argv[5].strip()
model_options = sys.argv[6].strip()

#Set up Temporary files for hyphy run
#set up tree file
tree_filename = hyphy_util.get_filled_temp_filename(tree_contents)

#Guess if this is a single or multiple FASTA input file
found_blank = False
is_multiple = False
for line in open(input_filename):
    line = line.strip()
    if line == "": found_blank = True
    elif line.startswith(">") and found_blank:
        is_multiple = True
        break
    else:
        found_blank = False

#set up BranchLengths file
BranchLengths_filename = hyphy_util.get_filled_temp_filename(
#Retrieve hyphy path, this will need to be the same across the cluster
tool_data = sys.argv.pop()
HYPHY_PATH = os.path.join( tool_data, "HYPHY" )
HYPHY_EXECUTABLE = os.path.join( HYPHY_PATH, "HYPHY" )

#Read command line arguments
input_filename = os.path.abspath(sys.argv[1].strip())
output_filename = os.path.abspath(sys.argv[2].strip())
tree_contents = sys.argv[3].strip()
nuc_model = sys.argv[4].strip()
base_freq = sys.argv[5].strip()
model_options = sys.argv[6].strip()

#Set up Temporary files for hyphy run
#set up tree file
tree_filename = hyphy_util.get_filled_temp_filename(tree_contents)

#Guess if this is a single or multiple FASTA input file
found_blank = False
is_multiple = False
for line in open(input_filename):
    line = line.strip()
    if line == "": found_blank = True
    elif line.startswith(">") and found_blank:
        is_multiple = True
        break
    else: found_blank = False

#set up BranchLengths file
BranchLengths_filename = hyphy_util.get_filled_temp_filename(hyphy_util.BranchLengths)
if is_multiple: 
예제 #6
0
tool_data = sys.argv.pop()
HYPHY_PATH = os.path.join(tool_data, "HYPHY")
HYPHY_EXECUTABLE = os.path.join(HYPHY_PATH, "HYPHY")

#Read command line arguments
input_filename = os.path.abspath(sys.argv[1].strip())
output_filename = os.path.abspath(sys.argv[2].strip())
tree_contents = sys.argv[3].strip()
nuc_model = sys.argv[4].strip()
analysis = sys.argv[5].strip()

if tree_contents == "":
    print >> sys.stderr, "Please specify a valid tree definition."
    sys.exit()

tree_filename = hyphy_util.get_filled_temp_filename(tree_contents)

if analysis == "local":
    fitter_filename = hyphy_util.get_filled_temp_filename(
        hyphy_util.SimpleLocalFitter)
else:
    fitter_filename = hyphy_util.get_filled_temp_filename(
        hyphy_util.SimpleGlobalFitter)

tabwriter_filename = hyphy_util.get_filled_temp_filename(hyphy_util.TabWriter)
FastaReader_filename = hyphy_util.get_filled_temp_filename(
    hyphy_util.FastaReader)
#setup Config file
config_filename = hyphy_util.get_dnds_config_filename(
    fitter_filename, tabwriter_filename, "Universal", tree_filename,
    input_filename, nuc_model, output_filename, FastaReader_filename)