def test_to_string(): f = "tests/data/tabd.blast" for line in open(f): a = BlastLine(line) b = BlastLine(a.to_blast_line()) # works better than string comparison because of floats. for attr in some_attrs: assert getattr(a, attr) == getattr(b, attr), (a, b, attr)
def test_query_subject_props(): f = "tests/data/tabd.blast" line = BlastLine(open(f).readline()) line.query = "asdf" line.subject = "dddd" assert line.query == "asdf" assert line.subject == "dddd" assert "asdf" in line.to_blast_line() assert "dddd" in line.to_blast_line()
QSEQ = '2' SSEQ = '4' print >>sys.stderr, ortho[(QSEQ, SSEQ)] for line in open(fblast): b = BlastLine(line) q = gff[b.query] s = gff[b.subject] if not (q.seqid == QSEQ and s.seqid == SSEQ): continue b.qstart += q.start b.qstop += q.start b.sstart += s.start b.sstop += s.start print b.to_blast_line() xs.append(b.qstart) ys.append(b.sstart) import matplotlib.pyplot as plt from matplotlib.patches import Rectangle f = plt.figure() ax = f.add_subplot(1, 1, 1) for xmin, xmax, ymin, ymax in ortho[('2', '4')]: r = Rectangle((xmin, ymin), width=xmax-xmin, height=ymax-ymin, ec='r', fc='none') ax.add_patch(r)
QSEQ = '2' SSEQ = '4' print >> sys.stderr, ortho[(QSEQ, SSEQ)] for line in open(fblast): b = BlastLine(line) q = gff[b.query] s = gff[b.subject] if not (q.seqid == QSEQ and s.seqid == SSEQ): continue b.qstart += q.start b.qstop += q.start b.sstart += s.start b.sstop += s.start print b.to_blast_line() xs.append(b.qstart) ys.append(b.sstart) import matplotlib.pyplot as plt from matplotlib.patches import Rectangle f = plt.figure() ax = f.add_subplot(1, 1, 1) for xmin, xmax, ymin, ymax in ortho[('2', '4')]: r = Rectangle((xmin, ymin), width=xmax - xmin, height=ymax - ymin, ec='r',