def make_basecall_input_multi(fast5_files, section='template', window=[-1, 0, 1], trim=10, min_len=1000, max_len=9000, event_detect=True, ed_params={'window_lengths':[3, 6], 'thresholds':[1.4, 1.1], 'peak_height':0.2}, sloika_model=False): """Like the above, but doesn't yields directly events. The point here is to be fully consistent with the currennt interface but allow use of the python library """ for f in fast5_files: with Fast5(f) as fh: if event_detect: # These parameters make no sense to me, but hey-ho # TODO: expose to user events = minknow_event_detect( fh.get_read(raw=True), fh.sample_rate, **ed_params ) else: events = fh.get_read() events, _ = segment(events, section=section) try: X = events_to_features(events, window=window, sloika_model=sloika_model) except TypeError: continue try: X = X[trim:-trim] events = events[trim:-trim] except: continue else: if len(X) < min_len or len(X) > max_len: continue yield f, X, events
def basecall_file(fname=None, event_detect=True): """Read event data from file and print scrappie basecall. :param fname: filename to read data from (if not given assumed to be given on command line. :param event_detect: do event detection? :returns: tuple (basecall score, sequence). """ is_main = False if fname is None: #called as entrypoint fname = sys.argv[1] is_main = True # magic numbers ed_params = { 'window_lengths':[4, 8], 'thresholds': [1.5, 9.0], 'peak_height': 0.2, } with Fast5(fname) as fh: if event_detect: events = minknow_event_detect( fh.get_read(raw=True), fh.sample_rate, **ed_params ) else: events = fh.get_read() events, _ = segment(events, section='template') results = basecall_events(events) if results is None: return None if is_main: print("{} score={}\n{}".format(fname, *results)) else: return results
def basecall_file(fname=None, event_detect=True): """Read event data from file and print scrappie basecall. :param fname: filename to read data from (if not given assumed to be given on command line. :param event_detect: do event detection? :returns: tuple (basecall score, sequence). """ is_main = False if fname is None: #called as entrypoint fname = sys.argv[1] is_main = True # magic numbers ed_params = { 'window_lengths': [4, 8], 'thresholds': [1.5, 9.0], 'peak_height': 0.2, } with Fast5(fname) as fh: if event_detect: events = minknow_event_detect(fh.get_read(raw=True), fh.sample_rate, **ed_params) else: events = fh.get_read() events, _ = segment(events, section='template') results = basecall_events(events) if results is None: return None if is_main: print("{} score={}\n{}".format(fname, *results)) else: return results