geoseeq 0.6.14.dev3__py3-none-any.whl → 0.6.14.dev4__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- geoseeq/cli/download.py +52 -8
- geoseeq/cli/main.py +1 -1
- {geoseeq-0.6.14.dev3.dist-info → geoseeq-0.6.14.dev4.dist-info}/METADATA +1 -1
- {geoseeq-0.6.14.dev3.dist-info → geoseeq-0.6.14.dev4.dist-info}/RECORD +8 -8
- {geoseeq-0.6.14.dev3.dist-info → geoseeq-0.6.14.dev4.dist-info}/LICENSE +0 -0
- {geoseeq-0.6.14.dev3.dist-info → geoseeq-0.6.14.dev4.dist-info}/WHEEL +0 -0
- {geoseeq-0.6.14.dev3.dist-info → geoseeq-0.6.14.dev4.dist-info}/entry_points.txt +0 -0
- {geoseeq-0.6.14.dev3.dist-info → geoseeq-0.6.14.dev4.dist-info}/top_level.txt +0 -0
geoseeq/cli/download.py
CHANGED
@@ -384,17 +384,21 @@ def _get_sample_result_files_with_names(sample, module_name=None, first=False):
|
|
384
384
|
continue
|
385
385
|
result_files_with_names = []
|
386
386
|
for folder_name, result_files in folder.items():
|
387
|
-
for result_file in result_files:
|
387
|
+
for lane_num, result_file in enumerate(result_files):
|
388
|
+
lane_num = lane_num + 1 # 1 indexed
|
388
389
|
if read_type in ["short_read::paired_end"]:
|
390
|
+
key = (sample, read_type, 1, lane_num) # sample name, read type, read number, lane number
|
389
391
|
result_files_with_names.append(
|
390
|
-
(result_file[0], result_file[0].get_referenced_filename())
|
392
|
+
(result_file[0], result_file[0].get_referenced_filename(), key)
|
391
393
|
)
|
394
|
+
key = (sample, read_type, 2, lane_num)
|
392
395
|
result_files_with_names.append(
|
393
|
-
(result_file[1], result_file[1].get_referenced_filename())
|
396
|
+
(result_file[1], result_file[1].get_referenced_filename(), key)
|
394
397
|
)
|
395
398
|
else:
|
399
|
+
key = (sample, read_type, 1, lane_num)
|
396
400
|
result_files_with_names.append(
|
397
|
-
(result_file, result_file.get_referenced_filename())
|
401
|
+
(result_file, result_file.get_referenced_filename(), key)
|
398
402
|
)
|
399
403
|
if first:
|
400
404
|
break
|
@@ -402,6 +406,43 @@ def _get_sample_result_files_with_names(sample, module_name=None, first=False):
|
|
402
406
|
return result_files_with_names
|
403
407
|
|
404
408
|
|
409
|
+
def _make_read_configs(download_results, config_dir="."):
|
410
|
+
"""Make JSON config files that look like this.
|
411
|
+
|
412
|
+
{
|
413
|
+
"sample_name": "small",
|
414
|
+
"reads_1": ["small.fq.gz"],
|
415
|
+
"reads_2": [],
|
416
|
+
"fastq_checksum": "",
|
417
|
+
"data_type": "short-read",
|
418
|
+
"bdx_result_dir": "results",
|
419
|
+
"geoseeq_uuid": "05bf22e9-9d25-42db-af25-31bc538a7006"
|
420
|
+
}
|
421
|
+
"""
|
422
|
+
config_blobs = {} # sample ids -> config_blobs
|
423
|
+
download_results = sorted(download_results, key=lambda x: x[1][3]) # sort by lane number
|
424
|
+
for local_path, (sample, read_type, read_num, lane_num), _ in download_results:
|
425
|
+
if sample.name not in config_blobs:
|
426
|
+
config_blobs[sample.name] = {
|
427
|
+
"sample_name": sample.name,
|
428
|
+
"reads_1": [],
|
429
|
+
"reads_2": [],
|
430
|
+
"fastq_checksum": "",
|
431
|
+
"data_type": "short-read",
|
432
|
+
"bdx_result_dir": "results",
|
433
|
+
"geoseeq_uuid": sample.uuid,
|
434
|
+
}
|
435
|
+
if read_num == 1:
|
436
|
+
config_blobs[sample.name]["reads_1"].append(local_path) # sorted by lane number
|
437
|
+
else:
|
438
|
+
config_blobs[sample.name]["reads_2"].append(local_path)
|
439
|
+
|
440
|
+
for sample_name, config_blob in config_blobs.items():
|
441
|
+
config_path = join(config_dir, f"{sample_name}.config.json")
|
442
|
+
with open(config_path, "w") as f:
|
443
|
+
json.dump(config_blob, f, indent=4)
|
444
|
+
|
445
|
+
|
405
446
|
@cli_download.command("fastqs")
|
406
447
|
@use_common_state
|
407
448
|
@cores_option
|
@@ -409,6 +450,7 @@ def _get_sample_result_files_with_names(sample, module_name=None, first=False):
|
|
409
450
|
@yes_option
|
410
451
|
@click.option("--first/--all", default=False, help="Download only the first folder of fastq files for each sample.")
|
411
452
|
@click.option("--download/--urls-only", default=True, help="Download files or just print urls")
|
453
|
+
@click.option("--config-dir", default=None, help="Directory to write read config files. If unset do not write config files.")
|
412
454
|
@module_option(FASTQ_MODULE_NAMES, use_default=False)
|
413
455
|
@ignore_errors_option
|
414
456
|
@alt_id_option
|
@@ -420,6 +462,7 @@ def cli_download_fastqs(state,
|
|
420
462
|
yes,
|
421
463
|
first,
|
422
464
|
download,
|
465
|
+
config_dir,
|
423
466
|
module_name,
|
424
467
|
ignore_errors,
|
425
468
|
alt_sample_id,
|
@@ -496,8 +539,8 @@ def cli_download_fastqs(state,
|
|
496
539
|
log_level=state.log_level,
|
497
540
|
progress_tracker_factory=PBarManager().get_new_bar,
|
498
541
|
)
|
499
|
-
for result_file, filename in result_files_with_names:
|
500
|
-
download_manager.add_download(result_file, join(target_dir, filename))
|
542
|
+
for result_file, filename, key in result_files_with_names:
|
543
|
+
download_manager.add_download(result_file, join(target_dir, filename), key=key)
|
501
544
|
if not download:
|
502
545
|
print(download_manager.get_url_string(), file=state.outfile)
|
503
546
|
else:
|
@@ -505,5 +548,6 @@ def cli_download_fastqs(state,
|
|
505
548
|
if not yes:
|
506
549
|
click.confirm('Continue?', abort=True)
|
507
550
|
logger.info(f'Downloading {len(download_manager)} files to {target_dir}')
|
508
|
-
download_manager.download_files()
|
509
|
-
|
551
|
+
download_results = download_manager.download_files()
|
552
|
+
if config_dir:
|
553
|
+
_make_read_configs(download_results, config_dir)
|
geoseeq/cli/main.py
CHANGED
@@ -55,7 +55,7 @@ def version():
|
|
55
55
|
Use of this tool implies acceptance of the GeoSeeq End User License Agreement.
|
56
56
|
Run `geoseeq eula show` to view the EULA.
|
57
57
|
"""
|
58
|
-
click.echo('0.6.
|
58
|
+
click.echo('0.6.14dev4') # remember to update pyproject.toml
|
59
59
|
|
60
60
|
|
61
61
|
@main.group('advanced')
|
@@ -20,11 +20,11 @@ geoseeq/cli/__init__.py,sha256=4WnK87K5seRK3SGJAxNWnQTqyg5uBhdhrOrzB1D4b3M,24
|
|
20
20
|
geoseeq/cli/constants.py,sha256=Do5AUf9lMO9_P8KpFJ3XwwFBAWsxSjZ6sx9_QEGyC_c,176
|
21
21
|
geoseeq/cli/copy.py,sha256=02U9kdrAIbbM8MlRMLL6p-LMYFSuRObE3h5jyvcL__M,2275
|
22
22
|
geoseeq/cli/detail.py,sha256=q8Suu-j2k18knfSVFG-SWWGNsKM-n8y9RMA3LcIIi9Y,4132
|
23
|
-
geoseeq/cli/download.py,sha256=
|
23
|
+
geoseeq/cli/download.py,sha256=Aul4Gk49e0Y0R4kH7sD1iJ9SgJDJsrRfXjfRo88-SJE,21309
|
24
24
|
geoseeq/cli/fastq_utils.py,sha256=-bmeQLaiMBm57zWOF0R5OlWTU0_3sh1JBC1RYw2BOFM,3083
|
25
25
|
geoseeq/cli/find_grn.py,sha256=oMDxkzGQBQb2_cCuvmwoeHOsFHqyO9RLeJzrB6bAe5M,439
|
26
26
|
geoseeq/cli/get_eula.py,sha256=79mbUwyiF7O1r0g6UTxG9kJGQEqKuH805E6eLkPC6Y4,997
|
27
|
-
geoseeq/cli/main.py,sha256=
|
27
|
+
geoseeq/cli/main.py,sha256=olfB8IkiY7bO2XbppkWrTdm-PMG0u_jccZk-2Aj0GMM,3987
|
28
28
|
geoseeq/cli/manage.py,sha256=wGXAcVaXqE5JQEU8Jh6OlHr02nB396bpS_SFcOZdrEo,5929
|
29
29
|
geoseeq/cli/progress_bar.py,sha256=p1Xl01nkYxSBZCB30ue2verIIi22W93m3ZAMAxipD0g,738
|
30
30
|
geoseeq/cli/project.py,sha256=V5SdXm2Hwo2lxrkpwRDedw-mAE4XnM2uwT-Gj1D90VQ,3030
|
@@ -87,9 +87,9 @@ geoseeq/vc/vc_stub.py,sha256=IQr8dI0zsWKVAeY_5ybDD6n49_3othcgfHS3P0O9tuY,3110
|
|
87
87
|
tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
88
88
|
tests/test_api_client.py,sha256=TS5njc5pcPP_Ycy-ljcfPVT1hQRBsFVdQ0lCqBmoesU,12810
|
89
89
|
tests/test_plotting.py,sha256=TcTu-2ARr8sxZJ7wPQxmbs3-gHw7uRvsgrhhhg0qKik,784
|
90
|
-
geoseeq-0.6.14.
|
91
|
-
geoseeq-0.6.14.
|
92
|
-
geoseeq-0.6.14.
|
93
|
-
geoseeq-0.6.14.
|
94
|
-
geoseeq-0.6.14.
|
95
|
-
geoseeq-0.6.14.
|
90
|
+
geoseeq-0.6.14.dev4.dist-info/LICENSE,sha256=IuhIl1XCxXLPLJT_coN1CNqQU4Khlq7x4IdW7ioOJD8,1067
|
91
|
+
geoseeq-0.6.14.dev4.dist-info/METADATA,sha256=5d01roEOeHuNDH3Jgh2ScJyhc7mdn3JbB2rq32vV90k,4937
|
92
|
+
geoseeq-0.6.14.dev4.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
93
|
+
geoseeq-0.6.14.dev4.dist-info/entry_points.txt,sha256=yF-6KDM8zXib4Al0qn49TX-qM7PUkWUIcYtsgt36rjM,45
|
94
|
+
geoseeq-0.6.14.dev4.dist-info/top_level.txt,sha256=zZk7mmeaqAYqFJG8nq2DTgSQPbflRjJwkDIhNURPDEU,14
|
95
|
+
geoseeq-0.6.14.dev4.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|