Exemplo n.º 1
0
    2668,
    3186,
    3189,
    3916,
    3947,
    4089,
    4092,
]

count = 0
of = open(ofn, "w")
for entry in open(mtgs_fn, "U"):
    count += 1
    if count not in expect_to_fail:
        entry = entry.strip()
        entry = entry.replace("-", "")
        try:
            sites = seq2sites(entry)
            seq = sites2seq(sites, what="all")
            seq = seq.replace("-", "")
            if entry != seq:
                print count, "FAILED"
                of.write("%d\n" % count)
            else:
                print count, "PASSED"
        except:
            print count, "FAILED"
            of.write("%d\n" % count)
        of.flush()
of.close()
here = os.path.abspath(os.path.dirname(__file__))
module_dir = os.path.join(here, '..')
genographic_sites_filepath = os.path.join(here, 'genographic_sites.txt')

import sys
sys.path = [module_dir] + sys.path

outfn = os.path.join(here, 'fail_genographic.txt')
outf = open(outfn, 'w')

from oldowan.mitomotifs import sites2seq
from oldowan.mitomotifs import seq2sites
from oldowan.mitomotifs import str2sites

count = 0
for line in open(genographic_sites_filepath, 'rU'):
    count += 1
    line = line.upper()
    sites = str2sites(line)
    sites.sort()
    seq = sites2seq(sites, region=range(16000,16570))
    roundtrip_sites = seq2sites(seq)
    roundtrip_sites.sort()
    if sites != roundtrip_sites:
        outf.write("%d,%s,%s\n" % (count, sites, roundtrip_sites))
    else:
        print "%d,good" % count
    outf.flush()

outf.close()
Exemplo n.º 3
0
DLOOPplus = range(15800,16570) + range(1,1500)

dloops_fn   = os.path.join(here, 'dloops.fasta')
ofn         = os.path.join(here, 'fail_dloop.txt')
fail_fn     = os.path.join(here, 'dloop_expect_to_fail.txt')

expect_to_fail = []
for line in open(fail_fn, 'U'):
    expect_to_fail.append(int(line.strip()[:-1]))

of = open(ofn, 'w')

count = 0
for entry in fasta(dloops_fn):
    count += 1
    if count not in expect_to_fail:
        try:
            sites = seq2sites(entry["sequence"])
            seq = sites2seq(sites, region=DLOOPplus)
            seq = seq.replace('-', '')
            if entry["sequence"] in seq:
                print count, entry["name"], sites2str(sites)
            else:
                print 'FAILED', count, entry["name"]
                of.write('%d, %s\n' % (count, entry["name"]))
        except Exception, e:
            print 'FAILED',e, count, entry["name"]
            of.write('%d, %s\n' % (count, entry["name"]))
            of.flush()
of.close()