Example #1
0
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')
Example #2
0
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')
Example #3
0
 def test_parse_cs_chimeras(self):
     """Parse ChimeraSlayer output"""
     inlines = ["a\tparentfoo\tparentbar\n",
                "123x\txyz\tabc\n"]
     exp = [('a','parentfoo','parentbar'),
            ('123x','xyz','abc')]
     obs = parse_cs_chimeras(inlines)
     self.assertEqual(obs,exp)