コード例 #1
0
    def test2(self):
        outdir = 'test/tmp/test_vistrans/Vis_test2/'
        make_clean_dir(outdir)

        stree = treelib.parse_newick(stree_newick)
        tree = treelib.read_tree(treefile2)
        brecon = phylo.read_brecon(breconfile2, tree, stree)

        transsvg.draw_tree(tree, brecon, stree, filename=outdir + "tree.svg")
コード例 #2
0
    def test2(self):
        outdir = 'test/tmp/test_vistrans/Vis_test2/'
        make_clean_dir(outdir)

        stree = treelib.parse_newick(stree_newick)
        tree = treelib.read_tree(treefile2)
        brecon = phylo.read_brecon(breconfile2, tree, stree)

        transsvg.draw_tree(tree, brecon, stree, filename=outdir + "tree.svg")
コード例 #3
0
    def test3(self):
        outdir = 'test/tmp/test_vistrans/Vis_test3/'
        make_clean_dir(outdir)

        stree = treelib.parse_newick(stree_newick)
        tree = treelib.read_tree(treefile3)
        brecon = phylo.read_brecon(breconfile3, tree, stree)

        phylo.add_implied_spec_nodes_brecon(tree, brecon)
        phylo.write_brecon(open(outdir + 'brecon', 'w'), brecon)

        transsvg.draw_tree(tree, brecon, stree, filename=outdir + "tree.svg")
コード例 #4
0
    def test3(self):
        outdir = 'test/tmp/test_vistrans/Vis_test3/'
        make_clean_dir(outdir)

        stree = treelib.parse_newick(stree_newick)
        tree = treelib.read_tree(treefile3)
        brecon = phylo.read_brecon(breconfile3, tree, stree)

        phylo.add_implied_spec_nodes_brecon(tree, brecon)
        phylo.write_brecon(open(outdir + 'brecon', 'w'), brecon)

        transsvg.draw_tree(tree, brecon, stree, filename=outdir + "tree.svg")
コード例 #5
0
ファイル: tasks.py プロジェクト: dmsm/CompBioSummer2015
def process_files(*args):
    conn = tinys3.Connection(os.environ.get('AWS_ACCESS_KEY'), os.environ.get('AWS_SECRET_ACCESS_KEY'),
                             default_bucket=os.environ.get('S3_BUCKET_NAME'))
    filename = args[0]
    url = "http://s3.amazonaws.com/{}/{}".format(os.environ.get('S3_BUCKET_NAME'), filename)
    urllib.urlretrieve(url, filename)
    raw_name = os.path.splitext(filename)[0]
    Reconcile(args)
    freqSummation(args)
    with open("{}freqFile.txt".format(raw_name)) as f:
        lines = f.readlines()

    score_list = ast.literal_eval(lines[0])
    total_freq = float(lines[1][:-2])
    total_recon = float(lines[3])
    total_cost = float(lines[2][:-2])

    scoring = args[4]
    if scoring == "Frequency":
        score_method = "Frequency"
    elif scoring == "xscape":
        score_method = "Xscape Scoring"
    else:
        score_method = "Unit Scoring"

    results_list = []
    for x, score in enumerate(score_list):
        tree = treelib1.read_tree("{}.tree".format(raw_name))
        stree = treelib1.read_tree("{}{}.stree".format(raw_name, x))
        brecon = phylo.read_brecon("{}{}.mowgli.brecon".format(raw_name, x), tree, stree)
        output = "{}{}.svg".format(raw_name, x)
        phylo.add_implied_spec_nodes_brecon(tree, brecon)
        transsvg.draw_tree(tree, brecon, stree, filename=output)
        conn.upload(output, open(output, 'rb'), content_type='image/svg+xml')

        percent = 100.0 * score / total_freq
        running_tot_score = sum(score_list[:x])
        running_tot = min(100.0 * running_tot_score / total_freq, 100)

        results_list.append((score, percent, running_tot))

    return {'results_list': results_list, 'raw_name': raw_name, 'dup': args[1], 'trans': args[2], 'loss': args[3],
            'total_cost': total_cost, 'score_method': score_method, 'total_freq': total_freq,
            'total_recon': total_recon}
コード例 #6
0
# parse options

conf, args = o.parse_args()


#gene2species = phylo.read_gene2species(conf.smap)
stree = treelib1.read_tree(conf.stree)
tree = treelib1.read_tree(conf.tree)
if conf.names:
    snames = dict(util.read_delim(conf.names))
else:
    snames = None

if conf.brecon:

    brecon = phylo.read_brecon(conf.brecon, tree, stree)



elif conf.recon:
    recon, events = phylo.read_recon_events(conf.recon, tree, stree)
    brecon = phylo.recon_events2brecon(recon, events)
    
else:
    gene2species = phylo.read_gene2species(conf.smap)
    recon = phylo.reconcile(tree, stree, gene2species)
    events = phylo.label_events(tree, recon)
    brecon = phylo.recon_events2brecon(recon, events)
    
phylo.add_implied_spec_nodes_brecon(tree, brecon)
コード例 #7
0
#=============================================================================
# parse options

conf, args = o.parse_args()

#gene2species = phylo.read_gene2species(conf.smap)
stree = treelib1.read_tree(conf.stree)
tree = treelib1.read_tree(conf.tree)
if conf.names:
    snames = dict(util.read_delim(conf.names))
else:
    snames = None

if conf.brecon:

    brecon = phylo.read_brecon(conf.brecon, tree, stree)

elif conf.recon:
    recon, events = phylo.read_recon_events(conf.recon, tree, stree)
    brecon = phylo.recon_events2brecon(recon, events)

else:
    gene2species = phylo.read_gene2species(conf.smap)
    recon = phylo.reconcile(tree, stree, gene2species)
    events = phylo.label_events(tree, recon)
    brecon = phylo.recon_events2brecon(recon, events)

phylo.add_implied_spec_nodes_brecon(tree, brecon)

transsvg.draw_tree(tree, brecon, stree, filename=conf.output, snames=snames)