Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def run_dealer(args):
"""Entry point handler for server."""
set_wakeup()
asyncio.get_event_loop().run_until_complete(main_dealer(args.path, args.outpath, output=args.output, port=args.port))
def run_router(args):
"""Entry point handler for client."""
set_wakeup()
asyncio.get_event_loop().run_until_complete(main_router(args.addr))
suffixes).
:param channels: list of channels to simulate.
:param start_port: port on which to run .fast5 replay server, bwa alignment
server will be run on the following numbered port.
:param targets: list of reference names. If `whitelist` is `False`, reads
aligning to these references will be ejected. If `whitelist` is `True`
any read alinging to a reference other than those contained in this
list will be ejected. Unidentified reads are never ejected.
:param whitelist: see `target`.
"""
logger = logging.getLogger('ReadUntil App')
good_class = 'strand'
time_warp=2
event_loop = asyncio.get_event_loop()
set_wakeup()
port = start_port
# Setup replay service
replay_port = port
replay_server = event_loop.create_task(replayfast5.replay_server(
fast5, channels, replay_port, good_class, time_warp=time_warp
))
port += 1
# Setup alignment service
align_port = port
align_server = event_loop.create_task(bwa.align_server(
bwa_index, align_port
))
identified_reads = {}
def read_until_demo(fast5, channels, port=5555):
"""Simple demo of read until server and client application.
:param fast5: input .fast5 file.
:param channels: list of channels to simulate.
:param port: port on which to run server and cliant.
"""
logger = logging.getLogger('ReadUntil App')
good_class = 'strand'
time_warp=2
event_loop = asyncio.get_event_loop()
set_wakeup()
# Setup replay service
event_loop.create_task(replay_server(
fast5, channels, port, good_class, time_warp=time_warp
))
@asyncio.coroutine
def read_until(port):
client = yield replay_client(port)
counter = 0
while True:
#This can be mostly rewritten for any real app
for channel in channels:
read_block = yield from client.call.get_events(channel)
if read_block is None:
logger.debug("Channel not in '{}' classification".format(good_class))
else:
def _run():
set_wakeup()
server = yield from align_server(
args.index, args.port, args.aligner, opts=args.opts
)
logger.info('Alignment server running, awaiting requests...')
yield from server.wait_closed()