def setUp(self): self.cns_filename = "data/rice_v6_sorghum_v1/rice_v6_sorghum_v1.cns.txt" self.pairsfile = "data/rice_v6_sorghum_v1/rice_v6_sorghum_v1.pairs.txt" self.qbed = Bed("data/rice_v6_sorghum_v1/rice_v6.bed") ;self.qbed.fill_dict() self.sbed = Bed("data/rice_v6_sorghum_v1/sorghum_v1.bed") ;self.sbed.fill_dict() self.cns_dict, self.evalue_dict = get_cns_dict(self.cns_filename) self.qpair_map, self.spair_map = make_pair_maps(self.pairsfile, "pair", self.qbed, self.sbed)
def setUp(self): self.cns_filename = "data/rice_v6_sorghum_v1/rice_v6_sorghum_v1.cns.txt" self.pairsfile = "data/rice_v6_sorghum_v1/rice_v6_sorghum_v1.pairs.txt" self.qbed = Bed("data/rice_v6_sorghum_v1/rice_v6.bed") self.qbed.fill_dict() self.sbed = Bed("data/rice_v6_sorghum_v1/sorghum_v1.bed") self.sbed.fill_dict() self.cns_dict, self.evalue_dict = get_cns_dict(self.cns_filename) self.qpair_map, self.spair_map = make_pair_maps( self.pairsfile, "pair", self.qbed, self.sbed)
def main(cnsfile, qbed_file, sbed_file, qorg, sorg, padding): qbed = Bed(qbed_file); qbed.fill_dict() sbed = Bed(sbed_file); sbed.fill_dict() cnsdict = get_cns_dict(cnsfile) out = sys.stdout fmt = "%(qaccn)s,%(qchr)s,%(qstart)i,%(qstop)i,%(qstrand)s," + \ "%(saccn)s,%(schr)s,%(sstart)i,%(sstop)i,%(sstrand)s,%(link)s" print >>out, "#" + fmt.replace("%(","").replace(")s","").replace(")i","") for cns, qfeat, sfeat in assign(cnsdict, qbed, sbed): d = cns_fmt_dict(cns, qfeat, sfeat) d['link'] = assign_url(cns.sstart, cns.schr, cns.qstart, cns.qchr, sorg, qorg, padding) print >>out, fmt % d