Exemplo n.º 1
0
def findMotifsFromSeqs(seqs,Alphabet=None):
    """Runs MEME using alignment created from list of sequences.
        
        - Returns MotifResults object.
        - seqs can be Sequence objects or strings.
    """
    #Make Fasta Alignment
    fasta_aln = fasta_from_sequences(seqs)
    #Make an Alignment object
    aln = Alignment(list(FastaParser(fasta_aln)))
    app = MEME(InputHandler='_input_as_multiline_string')
    if Alphabet == 'dna':
        app.Parameters['-dna'].on()
    else:
        app.Parameters['-protein'].on()
        app.Parameters['-maxw'].Value = 40 
        app.Parameters['-nmotifs'].Value = 20 
        app.Parameters['-evt'].Value = 0.01 

    app.Parameters['-mod'].Value = "anr"
    app.Parameters['-maxsize'].Value = len(fasta_aln) + 1 
    print app.BaseCommand
    output = app(fasta_aln)
    meme_results = MemeParser(output['StdOut'].readlines())
    meme_results.Alignment = aln
    return add_p_values(meme_results)
Exemplo n.º 2
0
def findMotifsFromAlignment(aln,WorkingDir=None):
    """Runs MEME using an Alignment object.
    
        - Returns MotifResults object
        - seqs can be an Alignment object or dict
    """
    #Make Fasta Alignment
    fasta_aln = fasta_from_alignment(aln)
    #Make sure aln is Alignment object
    aln = Alignment(aln)
    app = MEME(InputHandler='_input_as_lines')
    output = app(fasta_aln)
    meme_results = MemeParser(output['StdOut'])
    meme_results.Alignment = aln
    return add_p_values(meme_results)
Exemplo n.º 3
0
def findMotifsFromFile(filename,Alphabet=None):
    """Runs MEME using a Fasta file.
    
        - Returns MotifResults object.
    """
    #Make an Alignment object
    aln = Alignment(list(MinimalFastaParser(open(filename))))
    app = MEME(InputHandler='_input_as_string')
    if Alphabet == 'dna':
        app.Parameters['-dna'].on()
    print app.BaseCommand
    output = app(filename)
    print app.BaseCommand
    print 'standard out'
    print output['StdOut']
    print 'standard error'
    print output['StdErr']
    meme_results = MemeParser(output['StdOut'])
    meme_results.Alignment = aln
    return add_p_values(meme_results)