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_determine_taxon_conflict(self): """determine if there is a taxon conflict""" taxmap = {1:['a','b','c','d','e','f','g'], 2:['a','b','c','d','e','f','x'], 3:['a','b','z','q','w','t','y']} self.assertFalse(determine_taxon_conflict(taxmap, 1,2)) self.assertTrue(determine_taxon_conflict(taxmap, 1,3))
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_determine_taxon_conflict(self): """determine if there is a taxon conflict""" taxmap = { 1: ['a', 'b', 'c', 'd', 'e', 'f', 'g'], 2: ['a', 'b', 'c', 'd', 'e', 'f', 'x'], 3: ['a', 'b', 'z', 'q', 'w', 't', 'y'] } self.assertFalse(determine_taxon_conflict(taxmap, 1, 2)) self.assertTrue(determine_taxon_conflict(taxmap, 1, 3))
def main(): option_parser, opts, args = parse_command_line_parameters(**script_info) taxlookup = load_consensus_map(open(opts.ref_taxonomy_map)) uchime_results = parse_uchime_chimeras(open(opts.input_uchime)) output = open(opts.output, 'w') output.write("#accession\treason\tnote\tnote\n") for id_, score, parent_a, parent_b in uchime_results: if determine_taxon_conflict(taxlookup, parent_a, parent_b): o = [id_, "Class conflict found by UCHIME"] 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)) uchime_results = parse_uchime_chimeras(open(opts.input_uchime)) output = open(opts.output,'w') output.write("#accession\treason\tnote\tnote\n") for id_, score, parent_a, parent_b in uchime_results: if determine_taxon_conflict(taxlookup, parent_a, parent_b): o = [id_,"Class conflict found by UCHIME"] 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')