Mercurial > repos > jpayne > gtsubsampler
comparison subsamplr.py @ 5:3852b3edc8a4 tip
"planemo upload for repository https://toolrepo.galaxytrakr.org/"
author | jpayne |
---|---|
date | Fri, 19 Feb 2021 17:51:59 -0500 |
parents | a90a883f88f9 |
children |
comparison
equal
deleted
inserted
replaced
4:a90a883f88f9 | 5:3852b3edc8a4 |
---|---|
41 fin, rin, fout, rout, cov, gen_size, *opts = argv[1:] | 41 fin, rin, fout, rout, cov, gen_size, *opts = argv[1:] |
42 ins = [fin, rin] | 42 ins = [fin, rin] |
43 outs = [fout, rout] | 43 outs = [fout, rout] |
44 except ValueError: # not enough values to unpack | 44 except ValueError: # not enough values to unpack |
45 try: | 45 try: |
46 fin, fout, cov, gen_size, *ops = argv[1:] | 46 fin, fout, cov, gen_size, *opts = argv[1:] |
47 ins = [fin] | 47 ins = [fin] |
48 outs = [fout] | 48 outs = [fout] |
49 except ValueError: | 49 except ValueError: |
50 print(usage) | 50 print(usage) |
51 quit(1) | 51 quit(1) |
68 ins = [stack.enter_context(openn(path, 'r')) for openn, path in zip(file_openers, ins)] # opened input files | 68 ins = [stack.enter_context(openn(path, 'r')) for openn, path in zip(file_openers, ins)] # opened input files |
69 inns = [iter(grouper(inn, 4)) for inn in ins] # stateful 4-ply iterator over lines in the input | 69 inns = [iter(grouper(inn, 4)) for inn in ins] # stateful 4-ply iterator over lines in the input |
70 outs = [stack.enter_context(openn(path, 'w')) for openn, path in zip(file_openers, outs)] # opened output files | 70 outs = [stack.enter_context(openn(path, 'w')) for openn, path in zip(file_openers, outs)] # opened output files |
71 | 71 |
72 for file in ins: | 72 for file in ins: |
73 print(file.name) | 73 if hasattr(file, "name"): |
74 print(file.name) | |
74 | 75 |
75 # https://en.m.wikipedia.org/wiki/Reservoir_sampling | 76 # https://en.m.wikipedia.org/wiki/Reservoir_sampling |
76 | 77 |
77 reservoir = [] | 78 reservoir = [] |
78 # this is going to be 1 or 2-tuples of 4-tuples representing the 4 lines of the fastq file | 79 # this is going to be 1 or 2-tuples of 4-tuples representing the 4 lines of the fastq file |