Example #1
0
def problem_revp():
    ''' http://rosalind.info/problems/revp/ '''
    from solutions.revp import revp
    from rutility.parsers import fasta
    f = readfile('rosalind_revp.txt')
    with f:
        iterfasta = fasta(f)
        for result in revp(iterfasta.next().data):
            listoutput(result)
Example #2
0
def problem_orf():
    ''' http://rosalind.info/problems/orf/ '''
    from solutions.orf import orf
    from rutility.parsers import fasta
    f = readfile('rosalind_orf.txt')
    with f:
        frames = orf(fasta(f).next().data)
        for frame in frames:
            lineoutput(frame)
Example #3
0
def problem_lcsm():
    ''' http://rosalind.info/problems/lcsm/ '''
    from solutions.lcsm import lcsm
    from rutility.parsers import fasta
    f = readfile('rosalind_lcsm.txt')
    with f:
        iterfasta = fasta(f)
        collection = [i.data for i in iterfasta]
        lineoutput(lcsm(collection))
Example #4
0
def problem_gc():
    ''' http://rosalind.info/problems/gc/ '''
    from solutions.gc import gc
    from rutility.parsers import fasta
    f = readfile('rosalind_gc.txt')
    with f:
        iterfasta = fasta(f)
        result = max(iterfasta, key=gc)
        lineoutput(result.name)
        lineoutput(gc(result))
Example #5
0
def problem_splc():
    ''' http://rosalind.info/problems/splc/  '''
    from solutions.splc import splc
    from rutility.parsers import fasta
    f = readfile('rosalind_splc.txt')
    with f:
        iterfasta = fasta(f)
        dna = iterfasta.next().data
        introns = [i.data for i in list(iterfasta)]
        lineoutput(splc(dna, introns))
Example #6
0
def problem_grph():
    ''' http://rosalind.info/problems/grph/ '''
    from solutions.grph import grph
    from rutility.parsers import fasta
    f = readfile('rosalind_grph.txt')
    with f:
        iterfasta = fasta(f)
        gs = grph(iterfasta, 3)
        for g in gs:
            listoutput(g)
Example #7
0
def problem_cons():
    ''' http://rosalind.info/problems/cons/ '''
    from solutions.cons import cons
    from rutility.parsers import fasta
    f = readfile('rosalind_cons.txt')
    with f:
        iterfasta = fasta(f)
        collection = [i.data for i in iterfasta]
        consensus, matrix = cons(collection)
        lineoutput(consensus)
        listoutput(matrix[0], prefix='A: ')
        listoutput(matrix[1], prefix='C: ')
        listoutput(matrix[2], prefix='G: ')
        listoutput(matrix[3], prefix='T: ')