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')
Exemple #2
0
 def test_parse_b3_chimeras(self):
     """Parse B3 chimera output"""
     inlines = ["a\t1.2\tparentfoo\tparentbar\n",
                "123x\t1.323\txyz\tabc\n"]
     exp = [('a',1.2,'parentfoo','parentbar'),
            ('123x',1.323,'xyz','abc')]
     obs = parse_b3_chimeras(inlines)
     self.assertEqual(obs,exp)