def main(): option_parser, opts, args = parse_command_line_parameters(**script_info) taxlookup = load_consensus_map(open(opts.ref_taxonomy_map), False) cs_results = parse_cs_chimeras(open(opts.input_cs)) b3_results = parse_b3_chimeras(open(opts.input_bellerophon)) output = open(opts.output, 'w') output.write("#accession\treason\tnote\tnote\n") overlap = get_overlap(b3_results, cs_results) for id_ in overlap: output.write("%s\tFound by both Bellerophon and ChimeraSlayer\n" % id_) for id_, score, parent_a, parent_b in b3_results: if id_ in overlap: continue if determine_taxon_conflict(taxlookup, parent_a, parent_b): o = [id_, "Class conflict found by Bellerophon"] o.append("%s: %s" % (parent_a, '; '.join(taxlookup[parent_a]))) o.append("%s: %s" % (parent_b, '; '.join(taxlookup[parent_b]))) output.write('\t'.join(o)) output.write('\n') for id_, parent_a, parent_b in cs_results: if id_ in overlap: continue if determine_taxon_conflict(taxlookup, parent_a, parent_b): o = [id_, "Class conflict found by ChimeraSlayer"] o.append("%s: %s" % (parent_a, '; '.join(taxlookup[parent_a]))) o.append("%s: %s" % (parent_b, '; '.join(taxlookup[parent_b]))) output.write('\t'.join(o)) output.write('\n')
def main(): option_parser, opts, args = parse_command_line_parameters(**script_info) taxlookup = load_consensus_map(open(opts.ref_taxonomy_map), False) cs_results = parse_cs_chimeras(open(opts.input_cs)) b3_results = parse_b3_chimeras(open(opts.input_bellerophon)) output = open(opts.output,'w') output.write("#accession\treason\tnote\tnote\n") overlap = get_overlap(b3_results, cs_results) for id_ in overlap: output.write("%s\tFound by both Bellerophon and ChimeraSlayer\n" % id_) for id_, score, parent_a, parent_b in b3_results: if id_ in overlap: continue if determine_taxon_conflict(taxlookup, parent_a, parent_b): o = [id_,"Class conflict found by Bellerophon"] o.append("%s: %s" % (parent_a, '; '.join(taxlookup[parent_a]))) o.append("%s: %s" % (parent_b, '; '.join(taxlookup[parent_b]))) output.write('\t'.join(o)) output.write('\n') for id_, parent_a, parent_b in cs_results: if id_ in overlap: continue if determine_taxon_conflict(taxlookup, parent_a, parent_b): o = [id_,"Class conflict found by ChimeraSlayer"] o.append("%s: %s" % (parent_a, '; '.join(taxlookup[parent_a]))) o.append("%s: %s" % (parent_b, '; '.join(taxlookup[parent_b]))) output.write('\t'.join(o)) output.write('\n')
def test_get_overlap(self): """get overlap on ids""" b3 = [(1,2,3,4),(5,6,7,8),(9,10,11,12)] cs = [(5,6,7),(2,3,4)] exp = set([5]) obs = get_overlap(b3, cs) self.assertEqual(obs,exp)
def test_get_overlap(self): """get overlap on ids""" b3 = [(1, 2, 3, 4), (5, 6, 7, 8), (9, 10, 11, 12)] cs = [(5, 6, 7), (2, 3, 4)] exp = set([5]) obs = get_overlap(b3, cs) self.assertEqual(obs, exp)