from gusPyCode.MDAP_proj.MDAP_defs import findBestPairAlignments
from TAMO.MotifTools import Motif,load


iFiles = ['/Users/biggus/Documents/James/Collaborations/Campbell/data/Results_HyperGeoScreen/masked/Results_gGEMS/CCupAt4Days.6-8mers.gGEMS.top6.motifs.stdThresh.tmo']
motifs = []

for i in range(len(iFiles)):
    motifs.extend(load(iFiles[i]))


    
mat = findBestPairAlignments(motifs, 1)

None
Пример #2
0
from TAMO.MotifTools import load,sum
import gusPyCode.MDAP_proj.MDAP_defs as md


motifs = load('/Users/biggus/Documents/James/Collaborations/Campbell/data/Results_HyperGeoScreen/masked/Results_gGEMS/CCupAt4Days.6-8mers.gGEMS.top6.motifs.stdThresh.tmo')

# Weights __MUST__ be in same order as motifs are loaded.
weights = [1,
           2,
           3,
           4,
           -1,
           5]

assert len(motifs) == len(weights), \
       'Error: len(motifs) MUST equal len(weights).'

motifs = zip(*[motifs, weights])
motifs.sort(key=lambda x: x[1])
motifs = zip(*motifs)

aligned = md.alignSimilarMotifs(motifs[0])
combined = sum(aligned,zip(*motifs[1]))

None

Пример #3
0
    for h,s in zip(fg_fasta_headers,fg_fasta) :
        h = h.replace('>'+get_org_settings(org)['genome_dir']+'/','')
        h = h.replace('.nib','')
        if len(s) > 150 :
            fg_fasta_dict[h] = s

    # now sample the background sequences
    sys.stderr.write('Sampling bg sequences (len(fg_fasta)==%d)\n'%(len(fg_fasta_dict)))
    #bg_fasta_dict = rejection_sample_bg(fg_fasta_dict,org,bg_match_epsilon=1e-3,verbose=True)
    bg_fasta_dict = {}
    bg_fasta = bg_fasta_dict.values()
    """

    # load the motifs
    sys.stderr.write('Movin right along\n')
    motifs = load(motif_fn)

    if opts.motif_ind != 'all' :
        motif_indices = [int(i) for i in opts.motif_ind.split(',') if len(i) != 0]
        motifs = [motifs[i] for i in motif_indices]
    else :
        motif_indices = xrange(len(motifs))

    # use all cores w/ a Pool
    #pool = Pool(processes=opts.n_procs)

    # go through each motif
    job_params = []
    res = []
    #for i,m in zip(motif_indices,motifs) :
    #    job_params.append((i,m,peak_pvals,fg_fasta,bg_fasta,opts.dir))