Parse the arguments to process the single cell collection.
Source code in bionemo/scdl/scripts/convert_h5ad_to_scdl.py
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48 | def main():
"""Parse the arguments to process the single cell collection."""
parser = argparse.ArgumentParser()
parser.add_argument(
"--num-workers", type=int, default=4, help="The number of AnnData loaders to run in parallel [4]."
)
parser.add_argument(
"--use-mp",
action="store_true",
default=False,
help="Use a subprocess for each worker rather than a lightweight OS thread [False].",
)
parser.add_argument(
"--data-path",
type=str,
required=True,
help="A path containing AnnData files. Note: These will all be concatenated.",
)
parser.add_argument(
"--save-path", required=True, type=str, help="An output path where an SCDataset will be stored."
)
args = parser.parse_args()
with tempfile.TemporaryDirectory() as temp_dir:
coll = SingleCellCollection(temp_dir)
coll.load_h5ad_multi(args.data_path, max_workers=args.num_workers, use_processes=args.use_mp)
coll.flatten(args.save_path, destroy_on_copy=True)
|