Пример #1
0
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)
Пример #2
0
 def test_update_in_chunks(self, initdb, tprimers, seqs):
     '''Must push all the updates successfully..'''
     for primer in tprimers:
         primer.fg_freq = 100
     database.update_in_chunks(tprimers)
     primers = Primer.select().where(Primer.seq << seqs)
     for primer in primers:
         assert primer.fg_freq == 100