pvalue = float(sys.argv[4]) # output file out = sys.argv[5] # genes to be used as potential targets filter_targets = [] targets = None if len(sys.argv) > 6: targets_file = sys.argv[6] # reading targets targets = GeneSet("genes") targets.read(targets_file) # starting motif databases motif_set = MotifSet() if len(sys.argv) > 7: motif_set.read_file([sys.argv[7]]) else: motif_set.read_file([jaspar, uniprobe, internal]) # reading genes factors = GeneSet("genes") factors.read(factor_file) # reading networks #for f in glob.glob(enrichment_files): # # use last dir name as name for condition # condition=os.path.dirname(f) # condition=condition.split("/")[-1] motif_set.read_motif_targets_enrichment(enrichment_files, pvalue) #motif_set.write_enrichment_table(pvalue,out+"/pvalue_table_"+str(pvalue*100)+".txt")
from rgt.MotifSet import MotifSet from rgt.GeneSet import GeneSet import sys jaspar = '/home/ivan/projects/reg-gen/data/motifs/jaspar_vertebrates.mtf' uniprobe = '/home/ivan/projects/reg-gen/data/motifs/uniprobe_primary.mtf' internal = '/home/ivan/projects/reg-gen/data/motifs/internal.mtf' motif_set = MotifSet() motif_set.read_file([jaspar, uniprobe, internal]) motifs = [(l.strip("\n")).split("\t")[0] for l in open(sys.argv[1])] geneset_file = sys.argv[2] search_mode = sys.argv[3] genes = GeneSet("DC Genes") genes.read_expression(geneset_file) filtered = motif_set.filter_by_motifs(motifs) [filtered_genes, g_m, m_g] = filtered.filter_by_genes(genes, search=search_mode) genes_found = [] not_found = [] print "\t\t" + ("\t".join(genes.cond)) for m in motifs: try: sel_genes = m_g[m]
from rgt.MotifSet import MotifSet from rgt.GeneSet import GeneSet import sys jaspar='/home/ivan/projects/reg-gen/data/motifs/jaspar_vertebrates.mtf' uniprobe='/home/ivan/projects/reg-gen/data/motifs/uniprobe_primary.mtf' internal='/home/ivan/projects/reg-gen/data/motifs/internal.mtf' motif_set = MotifSet() motif_set.read_file([jaspar,uniprobe,internal]) motifs=[(l.strip("\n")).split("\t")[0] for l in open(sys.argv[1])] geneset_file=sys.argv[2] search_mode=sys.argv[3] genes=GeneSet("DC Genes") genes.read_expression(geneset_file) filtered=motif_set.filter_by_motifs(motifs) [filtered_genes,g_m,m_g]=filtered.filter_by_genes(genes,search=search_mode) genes_found=[] not_found=[] print "\t\t"+("\t".join(genes.cond)) for m in motifs: try: sel_genes=m_g[m] for g in sel_genes:
# output file out=sys.argv[5] # genes to be used as potential targets filter_targets=[] targets=None if len(sys.argv) > 6: targets_file=sys.argv[6] # reading targets targets=GeneSet("genes") targets.read(targets_file) # starting motif databases motif_set = MotifSet() if len(sys.argv) > 7: motif_set.read_file([sys.argv[7]]) else: motif_set.read_file([jaspar,uniprobe,internal]) # reading genes factors=GeneSet("genes") factors.read(factor_file) # reading networks #for f in glob.glob(enrichment_files): # # use last dir name as name for condition # condition=os.path.dirname(f) # condition=condition.split("/")[-1] motif_set.read_motif_targets_enrichment(enrichment_files,pvalue) #motif_set.write_enrichment_table(pvalue,out+"/pvalue_table_"+str(pvalue*100)+".txt")