Ejemplo n.º 1
0
def print_meme_motif(word, nsites, ev_string, aln):

    # make the PWM
    pwm = sequence.PWM(sequence.getAlphabet('DNA'))
    pwm.setFromAlignment(aln)

    # print PWM in MEME format
    alphabet = sequence.getAlphabet('DNA').getSymbols()
    alen = len(alphabet)
    w = len(word)
    print "\nMOTIF %s\nletter-probability matrix: alength= %d w= %d nsites= %d E= %s" % \
            (word, alen, w, nsites, ev_string)
    for row in pwm.pretty(): print row
    print ""
def print_meme_motif(word, nsites, ev_string, aln):

    # make the PWM
    pwm = sequence.PWM(sequence.getAlphabet('DNA'))
    pwm.setFromAlignment(aln)

    # print PWM in MEME format
    alphabet = sequence.getAlphabet('DNA').getSymbols()
    alen = len(alphabet)
    w = len(word)
    print "\nMOTIF %s\nletter-probability matrix: alength= %d w= %d nsites= %d E= %s" % \
            (word, alen, w, nsites, ev_string)
    for row in pwm.pretty():
        print row
    print ""
Ejemplo n.º 3
0
def get_freqs_and_nsites(w, dists, offsets, seqs):
    """
    Get PWMs and numbers of sites for each exact Hamming distance.
    Returns (freqs[d], nsites[d]).
    """

    freqs = []
    nsites = []
    for d in range(w+1):            # Hamming distance
        # get alignments
        aln = get_aln_from_dists_and_offsets(w, d, d, dists, offsets, seqs)
        # make frequency matrix
        #FIXME alphabet
        pwm = sequence.PWM(sequence.getAlphabet('DNA'))
        pwm.setFromAlignment(aln)
        freqs.append(pwm.getFreq())
        nsites.append(len(aln))
        #print "getting freqs for d", d

    return freqs, nsites
def get_freqs_and_nsites(w, dists, offsets, seqs):
    """
    Get PWMs and numbers of sites for each exact Hamming distance.
    Returns (freqs[d], nsites[d]).
    """

    freqs = []
    nsites = []
    for d in range(w + 1):  # Hamming distance
        # get alignments
        aln = get_aln_from_dists_and_offsets(w, d, d, dists, offsets, seqs)
        # make frequency matrix
        #FIXME alphabet
        pwm = sequence.PWM(sequence.getAlphabet('DNA'))
        pwm.setFromAlignment(aln)
        freqs.append(pwm.getFreq())
        nsites.append(len(aln))
        #print "getting freqs for d", d

    return freqs, nsites
Ejemplo n.º 5
0
def print_meme_header():

    alphabet = "".join(sequence.getAlphabet('DNA').getSymbols())
    print >> sys.stdout, "\nMEME version 4.5\n\nALPHABET= %s\n\nstrands: + -\n\nBackground letter frequencies (from" % alphabet
    # FIXME: put in real background frequencies
    print >> sys.stdout, "A 0.25 C 0.25 G 0.25 T 0.25\n"
def print_meme_header():

    alphabet = "".join(sequence.getAlphabet('DNA').getSymbols())
    print >> sys.stdout, "\nMEME version 4.5\n\nALPHABET= %s\n\nstrands: + -\n\nBackground letter frequencies (from" % alphabet
    # FIXME: put in real background frequencies
    print >> sys.stdout, "A 0.25 C 0.25 G 0.25 T 0.25\n"