def make_graph(max_hetdimer_bind, outfile): '''Selects all active primers and outputs a primer compatibility graph.''' # Reset all the primer IDs (as ids are only used for set_finder) Primer.update(_id = -1).execute() primers = list(Primer.select().where(Primer.active == True) .order_by(Primer.ratio.desc()).execute()) if len(primers) == 0: swga.error("No active sets found. Run `swga filter` first.") for i, p in enumerate(primers): p._id = i + 1 update_in_chunks(primers, show_progress=False) swga.message("Composing primer compatibility graph...") edges = graph.test_pairs(primers, max_hetdimer_bind) if len(edges) == 0: swga.error("No compatible primers. Try relaxing your parameters.", exception=False) with open(outfile, 'wb') as out: graph.write_graph(primers, edges, out)
def deactivate_all_primers(): """Resets all active marks on primers.""" Primer.update(active=False).execute()
def activate(primers): '''Marks a list of primers as active.''' n = Primer.update(active=True).where( Primer.seq << primers).execute() return n