Ejemplo n.º 1
0
def main():
    if len(sys.argv) < 3:
        print("USAGE: python thisScript.py /path/to/file.fast5 /path/to/destination")

    if len(sys.argv) == 3:
        # setup
        out_file = open(sys.argv[2], 'w')
        # load and transform
        npRead = NanoporeRead(sys.argv[1])
        npRead.get_2d_event_map()
        npRead.transform_events(npRead.template_events, npRead.template_drift)
        npRead.transform_events(npRead.complement_events, npRead.complement_drift)
        # output
        # line 1
        print(len(npRead.twoD_read_sequence), end=' ', file=out_file) # 2D read length
        print(len(npRead.template_events), end=' ', file=out_file)    # nb of template events
        print(len(npRead.complement_events), end=' ', file=out_file)  # nb of complement events
        print(npRead.template_scale, end=' ', file=out_file)          # template scale
        print(npRead.template_shift, end=' ', file=out_file)          # template shift
        print(npRead.template_var, end=' ', file=out_file)            # template var
        print(npRead.template_scale_sd, end=' ', file=out_file)       # template scale_sd
        print(npRead.template_var_sd, end=' ', file=out_file)         # template var_sd
        print(npRead.complement_scale, end=' ', file=out_file)        # complement scale
        print(npRead.complement_shift, end=' ', file=out_file)        # complement shift
        print(npRead.complement_var, end=' ', file=out_file)          # complement var
        print(npRead.complement_scale_sd, end=' ', file=out_file)     # complement scale_sd
        print(npRead.complement_var_sd, end='\n', file=out_file)      # complement var_sd

        # line 2
        print(npRead.twoD_read_sequence, end='\n', file=out_file)

        # line 3
        for _ in npRead.template_event_map:
            print(_, end=' ', file=out_file)
        print("", end="\n", file=out_file)

        # line 4
        for mean, start, stdev, length in npRead.template_events:
            print(mean, stdev, length, sep=' ', end=' ', file=out_file)
        print("", end="\n", file=out_file)

        # line 5
        for _ in npRead.complement_event_map:
            print(_, end=' ', file=out_file)
        print("", end="\n", file=out_file)

        # line 6
        for mean, start, stdev, length in npRead.complement_events:
            print(mean, stdev, length, sep=' ', end=' ', file=out_file)
        print("", end="\n", file=out_file)