Example #1
0
            dindex = i
            print "ML td", l_umtd, l_mmtd
        else:
            umtd1 = t1
            mmtd1 = t2
            break
    
    return [dindex, td, umtd1, mmtd1]  

################################
#
# main:
#

points = None
if False != argParser.getOptionalArg("--saved"):
    fin = open( argParser.getOptionalArg("--saved"), "r")
    [points, t1lnls, t2lnls, t1trees, t2trees] = pickle.load( fin )
    fin.close()
else:
    [t1trees, t1lnls] = return_trees_from_trace(t1path)
    [t2trees, t2lnls] = return_trees_from_trace(t2path)
    write_all_trees(t1trees, t2trees)
    write_trace(t1trees, t1lnls, t1path + ".unique.txt")
    write_trace(t2trees, t2lnls, t2path + ".unique.txt")    
    points = build_distance_matrix(t1trees, t2trees)
    fout = open("points.txt", "w")
    pickle.dump([points, t1lnls, t2lnls, t1trees, t2trees], fout)
    fout.close()
draw_heatmap(points, t1lnls, t2lnls, "compare_phyml_tree_traces")
Example #2
0
        return "XVII"
    if x == 18:
        return "XVIII"
    if x == 19:
        return "XIX"
    if x == 20:
        return "XX"
    return None


tabpath = ap.getArg("--in")
if False == os.path.exists(tabpath):
    print "\n. I cannot find your TAB file at", tabpath
    exit()

gffpath = ap.getOptionalArg("--out")
if gffpath == False or gffpath == None:
    gffpath = tabpath + ".gff"

fin = open(tabpath, "r")
fout = open(gffpath, "w")
fout.write("# gff-version 3\n")
fout.write("# This file was auto-generated by the script tab2gff.py\n")
fout.write("# using data from the TAB file " + tabpath + "\n")
fout.write("#\n")
for l in fin.xreadlines():
    if l.startswith("#"):
        continue
    tokens = l.split()
    
    genename = tokens[0]
Example #3
0
    command = "tar czf results.tar.gz "
    for f in files:
        if os.path.exists(f):
            command += f + " "
    os.system(command)
    print "\n. Results are packaged into results.tar.gz"

######################################################################
#
# main
#
splash()

"""If the user gives a configpath, then it's referenced
data will be imported into the database."""
configpath = ap.getOptionalArg("--configpath")

if configpath != False:
    ap.params = read_config( configpath )
    
    if False == validate_config(ap.params):
        print "\n. Error: something is wrong with your configuration file."
        print ". Look at previous errors for more detail."
        exit(0)
    
"""If the user didn't give a configpath, then we at
least need a dbpath (to load a prior database)."""
dbpath = ap.getOptionalArg("--dbpath")

if configpath == False:
    print "\n. Error, you need to specify a configuration path, using --configpath"
# output: a CRAN script and a PDF plot (generated from the CRAN script)
#
#

import math
import os
import re
import sys
from dendropy import Tree

from argParser import ArgParser
argParser = ArgParser(sys.argv)

t1path = sys.argv[1]
t2path = sys.argv[2]
id = argParser.getOptionalArg("--id")
if id == False:
    id = ""

import numpy as np
import cogent.maths.stats.test as stats

colors = ["orangered","royalblue", "black"]
pch = [20,5,3]
COLORS = {}
COLORS["unimax"] = "tomato"
COLORS["multimax"] = "deepskyblue"
COLORS["true"] = "black"
COLORS["bionj"] = "snow3"

# set is an array of floats
Example #5
0
    command = "tar czf results.tar.gz "
    for f in files:
        if os.path.exists(f):
            command += f + " "
    os.system(command)
    print "\n. Results are packaged into results.tar.gz"


######################################################################
#
# main
#
splash()
"""If the user gives a configpath, then it's referenced
data will be imported into the database."""
configpath = ap.getOptionalArg("--configpath")

if configpath != False:
    ap.params = read_config(configpath)

    if False == validate_config(ap.params):
        print "\n. Error: something is wrong with your configuration file."
        print ". Look at previous errors for more detail."
        exit(0)
"""If the user didn't give a configpath, then we at
least need a dbpath (to load a prior database)."""
dbpath = ap.getOptionalArg("--dbpath")

if configpath == False:
    print "\n. Error, you need to specify a configuration path, using --configpath"
    exit()
Example #6
0
    print "\t\treplicates conditions, and species."
    print ""
    print "======================================================================"


splash()
"""read_cli reads the command-line, the annotation file, and creates a SQLite3 database."""
con = read_cli(ap)
print_settings(con)
validate_configuration_import(con)

if ap.getOptionalToggle("--load_db_only"):
    "\n. Ending"
    exit()
"""Jump allows for some steps to be skipped."""
jump = ap.getOptionalArg("--jump")
stop = ap.getOptionalArg("--stop")

if jump == False:
    jump = 0
else:
    jump = float(jump)

if stop == False:
    stop = 10000000
else:
    stop = float(stop)
"""Run Bowtie2 for each FASTQ path"""
if jump <= 1 and stop > 1:
    run_bowtie(con)
Example #7
0
from Bio import SeqIO

from chipseqdb import *
from chipseqdb_api import *

from argParser import ArgParser
ap = ArgParser(sys.argv)

from plot_scatter import *

"""Jump allows for some steps to be skipped."""
jump = ap.getOptionalArg("--jump")
stop = ap.getOptionalArg("--stop")
if jump == False:
    jump = 0
else:
    jump = float(jump)
    
if stop == False:
    stop = 10000000
else:
    stop = float(stop)

def read_motifs(motif_path):
    """Reads PSWM data from a text file.
    Motifs are expected to look like this:
    
    /NAME=[SWISS] ABF1 TYPE=PSFM SPECIES=S.cer
    0.208782    0.155386    0.135415    0.500414
    0.745936    0.0    0.254063    0.0
    0.0    0.0    0.0    1.0
import re
from map_anc_2_anc import *
from argParser import ArgParser
ap = ArgParser(sys.argv)

anc1 = ap.getArg("--anc1")
nick1 = ap.getArg("--nick1")
msa1 = ap.getArg("--msa1")
seed1 = ap.getArg("--seed1")

anc2 = ap.getArg("--anc2")
nick2 = ap.getArg("--nick2")
msa2 = ap.getArg("--msa2")
seed2 = ap.getArg("--seed2")

runid = ap.getOptionalArg("--runid")
if runid == False:
    exit()

rsitesa = []
x = ap.getOptionalList("--restrict_sites_1")
if x != None:
    for s in x:
        rsitesa.append( int(s) )
rsitesb = []
x = ap.getOptionalList("--restrict_sites_2")
if x != None:
    for s in x:
        rsitesb.append( int(s) )
        
colors = ["blue", "red", "orange", "green", "black"]
import re
from map_anc_2_anc import *
from argParser import ArgParser
ap = ArgParser(sys.argv)

anc1 = ap.getArg("--anc1")
nick1 = ap.getArg("--nick1")
msa1 = ap.getArg("--msa1")
seed1 = ap.getArg("--seed1")

anc2 = ap.getArg("--anc2")
nick2 = ap.getArg("--nick2")
msa2 = ap.getArg("--msa2")
seed2 = ap.getArg("--seed2")

runid = ap.getOptionalArg("--runid")
if runid == False:
    exit()

rsitesa = []
x = ap.getOptionalList("--restrict_sites_1")
if x != None:
    for s in x:
        rsitesa.append(int(s))
rsitesb = []
x = ap.getOptionalList("--restrict_sites_2")
if x != None:
    for s in x:
        rsitesb.append(int(s))

colors = ["blue", "red", "orange", "green", "black"]