Skip to content

Commit fcddfa0

Browse files
committed
sanitize min/maxSpotId args, see #21
1 parent a146e7c commit fcddfa0

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

parallel-fastq-dump

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,20 @@ import tempfile
66
import subprocess
77
import argparse
88

9-
__version__ = "0.6.4"
9+
__version__ = "0.6.5"
1010

1111
def pfd(args, srr_id, extra_args):
1212
tmp_dir = tempfile.TemporaryDirectory(prefix="pfd_",dir=args.tmpdir)
1313
sys.stderr.write("tempdir: {}\n".format(tmp_dir.name))
1414

1515
n_spots = get_spot_count(srr_id)
1616
sys.stderr.write("{} spots: {}\n".format(srr_id,n_spots))
17-
start = args.minSpotId
18-
end = args.maxSpotId if args.maxSpotId is not None else n_spots
17+
18+
# minSpotId cant be lower than 1
19+
start = max(args.minSpotId, 1)
20+
# maxSpotId cant be higher than n_spots
21+
end = min(args.maxSpotId, n_spots) if args.maxSpotId is not None else n_spots
22+
1923
blocks = split_blocks(start, end, args.threads)
2024
sys.stderr.write("blocks: {}\n".format(blocks))
2125

0 commit comments

Comments
 (0)