monarch-initiative / koza

Data transformation framework for LinkML data models
https://koza.monarchinitiative.org/
BSD 3-Clause "New" or "Revised" License
47 stars 4 forks source link

Add koza split cli command to split up a kgx file based on field values #139

Closed kevinschaper closed 3 weeks ago

kevinschaper commented 3 months ago

Adds a koza split cli command that breaks up an existing kgx node or edge file based on values in specified fields, example:

koza split monarch-kg_nodes.tsv category, in_taxon_label --output-dir ./split-nodes

kevinschaper commented 3 months ago

It's a little bit rough, but I think this might be a good first half of addressing #138 (I also want to add support for choosing to write or not write to extra kgx files)

Can you try checking this branch out @hrshdhgd and playing with this command?

koza split input-file.tsv field1,field2 --output-dir my-output-dir

hrshdhgd commented 3 months ago

@kevinschaper , I installed this branch as a package (after uninstalling koza) and I got : No such command 'split'.

koza --help yields

 Usage: koza [OPTIONS] COMMAND [ARGS]...                                                                                               

╭─ Options ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ --version                                                                                                                           │
│ --install-completion          Install completion for the current shell.                                                             │
│ --show-completion             Show completion for the current shell, to copy it or customize the installation.                      │
│ --help                        Show this message and exit.                                                                           │
╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
╭─ Commands ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ transform   Transform a source file                                                                                                 │
│ validate    Validate a source file                                                                                                  │
╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
kevinschaper commented 3 weeks ago

Happy to make changes later, but I'm going to bring this in so that I can hook it up to the ncbi gene ingest