8
8
import numcodecs
9
9
import tabulate
10
10
11
- from . import icf , plink , provenance , vcf , vcf_utils
11
+ from . import plink , provenance , vcf2zarr , vcf_utils
12
+ from .vcf2zarr import icf as icf_mod
12
13
13
14
logger = logging .getLogger (__name__ )
14
15
@@ -167,7 +168,7 @@ def check_overwrite_dir(path, force):
167
168
def get_compressor (cname ):
168
169
if cname is None :
169
170
return None
170
- config = icf .ICF_DEFAULT_COMPRESSOR .get_config ()
171
+ config = icf_mod .ICF_DEFAULT_COMPRESSOR .get_config ()
171
172
config ["cname" ] = cname
172
173
return numcodecs .get_codec (config )
173
174
@@ -198,7 +199,7 @@ def explode(
198
199
"""
199
200
setup_logging (verbose )
200
201
check_overwrite_dir (icf_path , force )
201
- icf .explode (
202
+ vcf2zarr .explode (
202
203
icf_path ,
203
204
vcfs ,
204
205
worker_processes = worker_processes ,
@@ -235,7 +236,7 @@ def dexplode_init(
235
236
"""
236
237
setup_logging (verbose )
237
238
check_overwrite_dir (icf_path , force )
238
- work_summary = icf .explode_init (
239
+ work_summary = vcf2zarr .explode_init (
239
240
icf_path ,
240
241
vcfs ,
241
242
target_num_partitions = num_partitions ,
@@ -263,7 +264,7 @@ def dexplode_partition(icf_path, partition, verbose, one_based):
263
264
setup_logging (verbose )
264
265
if one_based :
265
266
partition -= 1
266
- icf .explode_partition (icf_path , partition )
267
+ vcf2zarr .explode_partition (icf_path , partition )
267
268
268
269
269
270
@click .command
@@ -274,7 +275,7 @@ def dexplode_finalise(icf_path, verbose):
274
275
Final step for distributed conversion of VCF(s) to intermediate columnar format.
275
276
"""
276
277
setup_logging (verbose )
277
- icf .explode_finalise (icf_path )
278
+ vcf2zarr .explode_finalise (icf_path )
278
279
279
280
280
281
@click .command
@@ -285,7 +286,7 @@ def inspect(path, verbose):
285
286
Inspect an intermediate columnar format or Zarr path.
286
287
"""
287
288
setup_logging (verbose )
288
- data = vcf .inspect (path )
289
+ data = vcf2zarr .inspect (path )
289
290
click .echo (tabulate .tabulate (data , headers = "keys" ))
290
291
291
292
@@ -296,7 +297,7 @@ def mkschema(icf_path):
296
297
Generate a schema for zarr encoding
297
298
"""
298
299
stream = click .get_text_stream ("stdout" )
299
- vcf .mkschema (icf_path , stream )
300
+ vcf2zarr .mkschema (icf_path , stream )
300
301
301
302
302
303
@click .command
@@ -327,7 +328,7 @@ def encode(
327
328
"""
328
329
setup_logging (verbose )
329
330
check_overwrite_dir (zarr_path , force )
330
- vcf .encode (
331
+ vcf2zarr .encode (
331
332
icf_path ,
332
333
zarr_path ,
333
334
schema_path = schema ,
@@ -378,7 +379,7 @@ def dencode_init(
378
379
"""
379
380
setup_logging (verbose )
380
381
check_overwrite_dir (zarr_path , force )
381
- work_summary = vcf .encode_init (
382
+ work_summary = vcf2zarr .encode_init (
382
383
icf_path ,
383
384
zarr_path ,
384
385
target_num_partitions = num_partitions ,
@@ -406,7 +407,7 @@ def dencode_partition(zarr_path, partition, verbose, one_based):
406
407
setup_logging (verbose )
407
408
if one_based :
408
409
partition -= 1
409
- vcf .encode_partition (zarr_path , partition )
410
+ vcf2zarr .encode_partition (zarr_path , partition )
410
411
411
412
412
413
@click .command
@@ -417,7 +418,7 @@ def dencode_finalise(zarr_path, verbose):
417
418
Final step for distributed conversion of ICF to VCF Zarr.
418
419
"""
419
420
setup_logging (verbose )
420
- vcf .encode_finalise (zarr_path , show_progress = True )
421
+ vcf2zarr .encode_finalise (zarr_path , show_progress = True )
421
422
422
423
423
424
@click .command (name = "convert" )
@@ -442,7 +443,7 @@ def convert_vcf(
442
443
"""
443
444
setup_logging (verbose )
444
445
check_overwrite_dir (zarr_path , force )
445
- vcf .convert (
446
+ vcf2zarr .convert (
446
447
vcfs ,
447
448
zarr_path ,
448
449
variants_chunk_size = variants_chunk_size ,
@@ -453,8 +454,8 @@ def convert_vcf(
453
454
454
455
455
456
@version
456
- @click .group (cls = NaturalOrderGroup )
457
- def vcf2zarr ():
457
+ @click .group (cls = NaturalOrderGroup , name = "vcf2zarr" )
458
+ def vcf2zarr_main ():
458
459
"""
459
460
Convert VCF file(s) to the vcfzarr format.
460
461
@@ -506,18 +507,17 @@ def vcf2zarr():
506
507
"""
507
508
508
509
509
- # TODO figure out how to get click to list these in the given order.
510
- vcf2zarr .add_command (convert_vcf )
511
- vcf2zarr .add_command (inspect )
512
- vcf2zarr .add_command (explode )
513
- vcf2zarr .add_command (mkschema )
514
- vcf2zarr .add_command (encode )
515
- vcf2zarr .add_command (dexplode_init )
516
- vcf2zarr .add_command (dexplode_partition )
517
- vcf2zarr .add_command (dexplode_finalise )
518
- vcf2zarr .add_command (dencode_init )
519
- vcf2zarr .add_command (dencode_partition )
520
- vcf2zarr .add_command (dencode_finalise )
510
+ vcf2zarr_main .add_command (convert_vcf )
511
+ vcf2zarr_main .add_command (inspect )
512
+ vcf2zarr_main .add_command (explode )
513
+ vcf2zarr_main .add_command (mkschema )
514
+ vcf2zarr_main .add_command (encode )
515
+ vcf2zarr_main .add_command (dexplode_init )
516
+ vcf2zarr_main .add_command (dexplode_partition )
517
+ vcf2zarr_main .add_command (dexplode_finalise )
518
+ vcf2zarr_main .add_command (dencode_init )
519
+ vcf2zarr_main .add_command (dencode_partition )
520
+ vcf2zarr_main .add_command (dencode_finalise )
521
521
522
522
523
523
@click .command (name = "convert" )
0 commit comments