Skip to content

Commit

Permalink
#1368 generate-import-slots-regardless --mixs-schema-url option
Browse files Browse the repository at this point in the history
  • Loading branch information
turbomam committed Nov 17, 2023
1 parent 82115c7 commit 9becea7
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 15 deletions.
32 changes: 18 additions & 14 deletions nmdc_schema/generate_import_slots_regardless.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,19 @@


class ImportSlotsRegardless:
mixs_slots_used_in_schema_tsv = "../assets/mixs_slots_used_in_schema.tsv"
mixs_slots_used_in_schema = list()

static_value_dict = {
"source class": "soil MIMS",
# "source file or URL": "https://raw.githubusercontent.com/GenomicsStandardsConsortium/mixs/main/model/schema/mixs.yaml",
"source file or URL": "https://raw.githubusercontent.com/microbiomedata/mixs/1da849346a80b717810a02d7c8ed74a22bcd84de/model/schema/mixs.yaml",
"slot": "",
"section": "",
"column order": "",
"destination class": "placeholder_class"
}

def __init__(self, mixs_schema_url, slots_tsv):
self.static_value_dict = {
"source class": "soil MIMS",
"source file or URL": mixs_schema_url,
"slot": "",
"section": "",
"column order": "",
"destination class": "placeholder_class"
}

self.mixs_slots_used_in_schema_tsv = slots_tsv
self.mixs_slots_used_in_schema = list()

def populate_mixs_slots_used_in_schema(self, input_file):
with open(input_file, 'r') as file:
Expand Down Expand Up @@ -44,8 +45,11 @@ def write_import_slots_regardless_rows(self, output_file, input_file):
@click.command()
@click.option("--input_file", required=True, help="input file path from get-mixs-slots-used-in-schema")
@click.option("--output_file", required=True, help="output file path for sheets_and_friends")
def main(output_file, input_file):
import_slots = ImportSlotsRegardless()
@click.option("--slots-tsv", default="assets/mixs_slots_used_in_schema.tsv")
@click.option("--mixs-schema-url",
default="https://raw.githubusercontent.com/microbiomedata/mixs/1da849346a80b717810a02d7c8ed74a22bcd84de/model/schema/mixs.yaml")
def main(output_file, input_file, slots_tsv, mixs_schema_url):
import_slots = ImportSlotsRegardless(mixs_schema_url=mixs_schema_url, slots_tsv=slots_tsv)
import_slots.write_import_slots_regardless_rows(output_file, input_file)
click.echo("Import slots regardless file generated successfully.")

Expand Down
6 changes: 5 additions & 1 deletion project.Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,11 @@ local/mixs_regen/slots_associated_with_biosample_omics_processing.tsv

local/mixs_regen/import_slots_regardless_gen.tsv: \
local/mixs_regen/mixs_slots_associated_with_biosample_omics_processing.tsv
$(RUN) generate-import-slots-regardless --input_file $< --output_file $@
$(RUN) generate-import-slots-regardless \
--input_file $< \
--mixs-schema-url "https://raw.githubusercontent.com/microbiomedata/mixs/1da849346a80b717810a02d7c8ed74a22bcd84de/model/schema/mixs.yaml" \
--output_file $@ \
--slots-tsv assets/mixs_slots_used_in_schema.tsv

local/mixs_regen/mixs_subset.yaml: local/mixs_regen/import_slots_regardless_gen.tsv
$(RUN) do_shuttle \
Expand Down

0 comments on commit 9becea7

Please sign in to comment.