Esempio n. 1
0
def main(args):
    # Create the tree structure
    supertree = Tree([])
    root = TreeNode("r")
    rodent = TreeNode("")
    primate = TreeNode("")
    highermammal = TreeNode("")
    mouse = TreeNode("3")
    rat = TreeNode("4")
    human = TreeNode("1")
    chimp = TreeNode("2")
    dog = TreeNode("5")
    root.children = [ rodent, highermammal ]
    rodent.children = [ mouse, rat ]
    highermammal.children = [ dog, primate ]
    primate.children = [ human, chimp ]
    supertree.r = root
    supertree.node = [ root, highermammal, rodent, mouse,
                       rat, primate, human, chimp ]
    a = ["A", "C", "T", "G"]
    
    #first I need to make all the trees
    trees = dict()
    for n1 in a:
        for n2 in a:
            for n3 in a:
                for n4 in a:
                    for n5 in a:
                        trees[n1+n2+n3+n4+n5] = color(supertree, [n1, n2, n3, n4, n5])

    a_file = open("../doc/pickle/alignment.pickle", "r")

    # Load the 5-way alignment
    alignment = pickle.load(a_file)

    # Close relevant files
    a_file.close()

    skip = [0]#, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]
    pvals = [-9]
    len1 = 0    
    f1 = ""    
    for j in pvals:        
        print "Doing pval " + str(j)      
        
        for s in skip:                   
            f1 = open("../doc/fasta/MA0112(p " + str(j) + ").gff", "r")            
            m1 = cm_scan3.buildMotifs(f1, alignment)            
            len1 = findLength("MA0112.pwm")            
            f1.close()
            print len(m1)
            if len1 > s+1:
                if len(m1) != 0:                                                
                    scanNonAdj2.mainRunner("MA0112(p " + str(j) + ").gff", m1, len(m1), "LL all PWM pval " + \
                                           str(j) + " NA " + str(s) + "/", s, trees)                    
                else: print "NO HITS"                    
            #makeGraphs.make("LL all PWM pval " + str(j) + " NA " + str(s) + "/", j, s)
            #randomScanNonAdj2.mainRunner(s, j, trees)
    sys.exit(0)
Esempio n. 2
0
def main(args):
    # Create the tree structure
    supertree = Tree([])
    root = TreeNode("r")
    rodent = TreeNode("")
    primate = TreeNode("")
    highermammal = TreeNode("")
    mouse = TreeNode("3")
    rat = TreeNode("4")
    human = TreeNode("1")
    chimp = TreeNode("2")
    dog = TreeNode("5")
    root.children = [ rodent, highermammal ]
    rodent.children = [ mouse, rat ]
    highermammal.children = [ dog, primate ]
    primate.children = [ human, chimp ]
    supertree.r = root
    supertree.node = [ root, highermammal, rodent, mouse,
                       rat, primate, human, chimp ]
    a = ["A", "C", "T", "G"]
    
    #first I need to make all the trees
    trees = dict()
    for n1 in a:
        for n2 in a:
            for n3 in a:
                for n4 in a:
                    for n5 in a:
                        trees[n1+n2+n3+n4+n5] = color(supertree, [n1, n2, n3, n4, n5])

    a_file = open("../../Doc/pickle/alignment.pickle", "r")

    # Load the 5-way alignment
    alignment = pickle.load(a_file)

    # Close relevant files
    a_file.close()
    pwmFile = open("../../Doc/Vertebrate PWM/PWMlist.txt", "r")
    pwms = pickle.load(pwmFile)
    pwmFile.close()
    skip = range(1)
    pvals = [-9]
    len1 = 0    
    f1 = ""    
    for j in pvals:        
        print "Doing pval " + str(j)        
        for s in skip:            
            for i in range(len(pwms)):                
                #f1 = open("../doc/fasta/" + pwms[i] + "random(p " + str(j) + ").gff", "r")
                f1 = open("../../Doc/fasta/sortedhuman1ku-corrected.fasta." + pwms[i] + "cc.gff", "r")
                m1 = cm_scan3.buildMotifs(f1, alignment)            
                len1 = findLength(pwms[i] + "cc.pwm")            
                f1.close()
                print len(m1)
                if len1 > s+1:
                    if len(m1) != 0:
                        print pwms[i]
                        scanNonAdj2.mainRunner("sortedhuman1ku-corrected.fasta." + pwms[i] + "cc.gff", m1, len(m1), \
                                               "../../Results/Controls/Comp Permuted PWMs/Raw Data/Gap " + \
                                               str(s) + "/", s, trees)
                        #scanNonAdj2.mainRunner(pwms[i] + "(p " + str(j) + ").gff", m1, len(m1), "LL all PWM pval " + \
                        #                       str(j) + " NA " + str(s) + "/", s, trees)                    
                    #else: print "NO HITS"
            #randomScanNonAdj2.mainRunner(s, j, trees)
    sys.exit(0)