Ejemplo n.º 1
0
def problem_mrna():
    ''' http://rosalind.info/problems/mrna/ '''
    from solutions.mrna import mrna
    f = readfile('rosalind_mrna.txt')
    with f:
        prot = f.next().strip()
        lineoutput(mrna(prot) % 1000000)
Ejemplo n.º 2
0
def problem_rna():
    ''' http://rosalind.info/problems/rna/ '''
    from solutions.rna import rna
    f = readfile('rosalind_rna.txt')
    with f:
        for line in f:
            lineoutput(rna(line))
Ejemplo n.º 3
0
def problem_dna():
    ''' http://rosalind.info/problems/dna/ '''
    from solutions.dna import dna
    f = readfile('rosalind_dna.txt')
    with f:
        for line in f:
            listoutput(dna(line))
Ejemplo n.º 4
0
def problem_revc():
    ''' http://rosalind.info/problems/revc/ '''
    from solutions.revc import revc
    f = readfile('rosalind_revc.txt')
    with f:
        for line in f:
            lineoutput(revc(line))
Ejemplo n.º 5
0
def problem_iprb():
    ''' http://rosalind.info/problems/iprb/ '''
    from solutions.iprb import iprb
    f = readfile('rosalind_iprb.txt')
    with f:
        d, h, r = [int(i) for i in f.next().split()]
        lineoutput(iprb(d, h, r))
Ejemplo n.º 6
0
def problem_hamm():
    ''' http://rosalind.info/problems/hamm/ '''
    from solutions.hamm import hamm
    f = readfile('rosalind_hamm.txt')
    with f:
        s, t = f.next(), f.next()
        lineoutput(hamm(s, t))
Ejemplo n.º 7
0
def problem_prot():
    ''' http://rosalind.info/problems/prot/ '''
    from solutions.prot import prot
    f = readfile('rosalind_prot.txt')
    with f:
        for line in f:
            lineoutput(prot(line))
Ejemplo n.º 8
0
def problem_fibd():
    ''' http://rosalind.info/problems/fibd/ '''
    from solutions.fibd import fibd
    f = readfile('rosalind_fibd.txt')
    with f:
        m, n = [int(i) for i in f.next().split()]
        lineoutput(fibd(m, n))
Ejemplo n.º 9
0
def problem_lia():
    ''' http://rosalind.info/problems/lia/ '''
    from solutions.lia import lia
    f = readfile('rosalind_lia.txt')
    with f:
        k, n = [int(i) for i in f.next().split()]
        lineoutput(lia(k, n))
Ejemplo n.º 10
0
def problem_fib():
    ''' http://rosalind.info/problems/fib/ '''
    from solutions.fib import fib
    f = readfile('rosalind_fib.txt')
    with f:
        n, k = [int(i) for i in f.next().split()]
        lineoutput(fib(n, k))
Ejemplo n.º 11
0
def problem_subs():
    ''' http://rosalind.info/problems/subs/ '''
    from solutions.subs import subs
    f = readfile('rosalind_subs.txt')
    with f:
        dna, sub = f.next(), f.next()
        listoutput(subs(dna, sub))
Ejemplo n.º 12
0
def problem_lexf():
    ''' http://rosalind.info/problems/lexf/ '''
    from solutions.lexf import lexf
    f = readfile('rosalind_lexf.txt')
    with f:
        lex = f.next().strip()
        perm = int(f.next())
        for p in lexf(lex, perm):
            lineoutput(p)
Ejemplo n.º 13
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)
Ejemplo n.º 14
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)
Ejemplo n.º 15
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))
Ejemplo n.º 16
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))
Ejemplo n.º 17
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))
Ejemplo n.º 18
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)
Ejemplo n.º 19
0
def problem_perm():
    ''' http://rosalind.info/problems/perm/ '''
    from solutions.perm import perm
    f = readfile('rosalind_perm.txt')
    with f:
        n = int(f.next())
        total, perms = perm(n)
        lineoutput(total)
        for p in perms:
            listoutput(p)
Ejemplo n.º 20
0
def problem_mprt():
    ''' http://rosalind.info/problems/mprt/ '''
    from solutions.mprt import mprt
    from rutility.parsers import uniprot
    f = readfile('rosalind_mprt.txt')
    with f:
        for line in f:
            prot = uniprot(line.strip())
            locations = mprt(prot.data, 'N{P}[ST]{P}')
            if locations:
                lineoutput(line.strip())
                listoutput(locations)
Ejemplo n.º 21
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: ')
Ejemplo n.º 22
0
def problem_iev():
    ''' http://rosalind.info/problems/iev/ '''
    from solutions.iev import iev
    f = readfile('rosalind_iev.txt')
    with f:
        lineoutput(iev([int(i) for i in f.next().split()]))
Ejemplo n.º 23
0
def problem_prtm():
    ''' http://rosalind.info/problems/prtm/ '''
    from solutions.prtm import prtm
    f = readfile('rosalind_prtm.txt')
    with f:
        lineoutput(prtm(f.next().strip()))