diff --git a/.gitignore b/.gitignore index 2f6ffcd..fd5cb2e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,5 @@ src/ontology/nmdco-redundant.ttl -local/ +downloads/ **/__pycache__/ .DS_Store diff --git a/data-vs-ontology-reports.Makefile b/data-vs-ontology-reports.Makefile new file mode 100644 index 0000000..6240072 --- /dev/null +++ b/data-vs-ontology-reports.Makefile @@ -0,0 +1,45 @@ +RUN=poetry run + +.PHONY: data-vs-ontology-all data-vs-ontology-clean + + +data-vs-ontology-all: data-vs-ontology-clean \ + data-vs-ontology-reports/envo-id-ranges-report.tsv \ + data-vs-ontology-reports/fma-usage-report.tsv + +data-vs-ontology-clean: + rm -rf data-vs-ontology-reports/* + mkdir -p data-vs-ontology-reports + touch data-vs-ontology-reports/.gitkeep + rm -rf downloads/*owl* + mkdir -p downloads + touch downloads/.gitkeep + +downloads/envo-idranges.owl.omn: + @echo "Downloading..." +ifeq ($(shell command -v wget 2> /dev/null),) + @echo "wget is not installed, trying with curl..." + @curl -o $@ https://raw.githubusercontent.com/EnvironmentOntology/envo/master/src/envo/envo-idranges.owl +else + @echo "Downloading with wget..." + @wget -O $@ https://raw.githubusercontent.com/EnvironmentOntology/envo/master/src/envo/envo-idranges.owl +endif + +downloads/envo-idranges.owl.ttl: downloads/envo-idranges.owl.omn + @echo "Converting..." + @robot convert --input $< --output $@ + +data-vs-ontology-reports/envo-id-ranges-report.tsv: downloads/envo-idranges.owl.ttl + @echo "Generating report..." + $(RUN) report-id-ranges \ + --id-ranges-ttl $< \ + --output $@ + +data-vs-ontology-reports/biosample-triad-counts.tsv: + @echo "Generating report..." + $(RUN) report-instantiated-traids \ + --output $@ \ + --counts-output $(subst counts.tsv,report-counts.tsv,$@) + +data-vs-ontology-reports/fma-usage-report.tsv: data-vs-ontology-reports/biosample-triad-counts.tsv + grep 'FMA:' $< > $@ \ No newline at end of file diff --git a/local/.gitkeep b/data-vs-ontology-reports/.gitkeep similarity index 100% rename from local/.gitkeep rename to data-vs-ontology-reports/.gitkeep diff --git a/biosample_triad_report.tsv b/data-vs-ontology-reports/biosample-triad-counts.tsv similarity index 100% rename from biosample_triad_report.tsv rename to data-vs-ontology-reports/biosample-triad-counts.tsv diff --git a/triad_term_counts.tsv b/data-vs-ontology-reports/biosample-triad-report-counts.tsv similarity index 100% rename from triad_term_counts.tsv rename to data-vs-ontology-reports/biosample-triad-report-counts.tsv diff --git a/envo_id_ranges_report.tsv b/data-vs-ontology-reports/envo-id-ranges-report.tsv similarity index 100% rename from envo_id_ranges_report.tsv rename to data-vs-ontology-reports/envo-id-ranges-report.tsv diff --git a/data-vs-ontology-reports/fma-usage-report.tsv b/data-vs-ontology-reports/fma-usage-report.tsv new file mode 100644 index 0000000..44ae53d --- /dev/null +++ b/data-vs-ontology-reports/fma-usage-report.tsv @@ -0,0 +1,33 @@ +nmdc:bsm-11-x80t5771 ENVO:01001002 FMA:14541 FMA:14541 +nmdc:bsm-11-1zsths21 ENVO:01001002 FMA:14541 FMA:14541 +nmdc:bsm-11-pqgnra85 ENVO:01001002 FMA:14541 FMA:14541 +nmdc:bsm-11-aa7wmf63 ENVO:01001002 FMA:14541 FMA:14541 +nmdc:bsm-11-vxy31194 ENVO:01001002 FMA:14541 FMA:14541 +nmdc:bsm-11-adv25093 ENVO:01001002 FMA:14541 FMA:14541 +nmdc:bsm-11-xhpt1920 ENVO:01001002 FMA:14541 FMA:14541 +nmdc:bsm-11-afygsz12 ENVO:01001002 FMA:14541 FMA:14541 +nmdc:bsm-11-f0y72191 ENVO:01001002 FMA:14541 FMA:14541 +nmdc:bsm-11-96cg5y52 ENVO:01001002 FMA:14541 FMA:14541 +nmdc:bsm-11-4fnr9v33 ENVO:01001002 FMA:14541 FMA:14541 +nmdc:bsm-11-y16b7q98 ENVO:01001002 FMA:14541 FMA:14541 +nmdc:bsm-11-8vae2844 ENVO:01001002 FMA:14541 FMA:14541 +nmdc:bsm-11-2xw6s444 ENVO:01001002 FMA:14541 FMA:14541 +nmdc:bsm-11-y4310d70 ENVO:01001002 FMA:14541 FMA:14541 +nmdc:bsm-11-e5n81610 ENVO:01001002 FMA:14541 FMA:14541 +nmdc:bsm-11-dcw37a90 ENVO:01001002 FMA:14541 FMA:14541 +nmdc:bsm-11-spjbg416 ENVO:01001002 FMA:14541 FMA:14541 +nmdc:bsm-11-4ppwq475 ENVO:01001002 FMA:14541 FMA:14541 +nmdc:bsm-11-zxjp0468 ENVO:01001002 FMA:14541 FMA:14541 +nmdc:bsm-11-05fh0s26 ENVO:01001002 FMA:14541 FMA:14541 +nmdc:bsm-11-jxa03j76 ENVO:01001002 FMA:14541 FMA:14541 +nmdc:bsm-11-nvz3sq09 ENVO:01001002 FMA:14541 FMA:14541 +nmdc:bsm-11-sbrsd510 ENVO:01001002 FMA:14541 FMA:14541 +nmdc:bsm-11-5aysb633 ENVO:01001002 FMA:14541 FMA:14541 +nmdc:bsm-11-yvnp5859 ENVO:01001002 FMA:14541 FMA:14541 +nmdc:bsm-11-7yq6an11 ENVO:01001002 FMA:14541 FMA:14541 +nmdc:bsm-11-qhewdm80 ENVO:01001002 FMA:14541 FMA:14541 +nmdc:bsm-11-p9t9wv58 ENVO:01001002 FMA:14541 FMA:14541 +nmdc:bsm-11-dzmzp451 ENVO:01001002 FMA:14541 FMA:14541 +nmdc:bsm-11-datvdm83 ENVO:01001002 FMA:14541 FMA:14541 +nmdc:bsm-11-vh4jjb52 ENVO:01001002 FMA:14541 FMA:14541 +nmdc:bsm-11-0q1w4832 ENVO:01001002 FMA:14541 FMA:14541 diff --git a/downloads/.gitkeep b/downloads/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/maintenance.Makefile b/maintenance.Makefile deleted file mode 100644 index 5f507d3..0000000 --- a/maintenance.Makefile +++ /dev/null @@ -1,21 +0,0 @@ -RUN=poetry run - -local/envo-idranges.owl.omn: - @echo "Downloading..." -ifeq ($(shell command -v wget 2> /dev/null),) - @echo "wget is not installed, trying with curl..." - @curl -o $@ https://raw.githubusercontent.com/EnvironmentOntology/envo/master/src/envo/envo-idranges.owl -else - @echo "Downloading with wget..." - @wget -O $@ https://raw.githubusercontent.com/EnvironmentOntology/envo/master/src/envo/envo-idranges.owl -endif - -local/envo-idranges.owl.ttl: local/envo-idranges.owl.omn - @echo "Converting..." - @robot convert --input $< --output $@ - -envo_id_ranges_report.tsv: local/envo-idranges.owl.ttl - @echo "Generating report..." - $(RUN) report-id-ranges \ - --id-ranges-ttl $< \ - --output $@ \ No newline at end of file diff --git a/nmdc_ontology/__pycache__/__init__.cpython-310.pyc b/nmdc_ontology/__pycache__/__init__.cpython-310.pyc deleted file mode 100644 index 86ad030..0000000 Binary files a/nmdc_ontology/__pycache__/__init__.cpython-310.pyc and /dev/null differ diff --git a/nmdc_ontology/__pycache__/report_instantiated_traids.cpython-310.pyc b/nmdc_ontology/__pycache__/report_instantiated_traids.cpython-310.pyc deleted file mode 100644 index 172cad9..0000000 Binary files a/nmdc_ontology/__pycache__/report_instantiated_traids.cpython-310.pyc and /dev/null differ diff --git a/nmdc_ontology/report_id_ranges.py b/nmdc_ontology/report_id_ranges.py index 6c15368..216d938 100644 --- a/nmdc_ontology/report_id_ranges.py +++ b/nmdc_ontology/report_id_ranges.py @@ -4,7 +4,7 @@ @click.command() -@click.option("--id-ranges-ttl", "-i", default="local/envo-idranges.owl.ttl", help="Input file path") +@click.option("--id-ranges-ttl", "-i", default="downloads/envo-idranges.owl.ttl", help="Input file path") @click.option("--output", "-o", default="envo_id_ranges_report.tsv", help="Output file path") def generate_id_ranges(id_ranges_ttl, output): # Load the Turtle content into an RDF graph diff --git a/nmdc_ontology/report_instantiated_traids.py b/nmdc_ontology/report_instantiated_traids.py index 1e1ea2f..3ab0d61 100644 --- a/nmdc_ontology/report_instantiated_traids.py +++ b/nmdc_ontology/report_instantiated_traids.py @@ -8,9 +8,9 @@ @click.option('--api-url', default="https://api.microbiomedata.org/nmdcschema/biosample_set?max_page_size=9999&projection=env_broad_scale%2Cenv_local_scale%2Cenv_medium", help='URL of the API endpoint') -@click.option('--output-file', default="biosample_triad_report.tsv", help='Output file name') -@click.option('--counts-output-file', default="triad_term_counts.tsv", help='Output file name for value counts') -def main(api_url, output_file, counts_output_file): +@click.option('--output', default="biosample_triad_report.tsv", help='Output file name') +@click.option('--counts-output', default="triad_term_counts.tsv", help='Output file name for value counts') +def main(api_url, output, counts_output): # Send the GET request response = requests.get(api_url) @@ -39,7 +39,7 @@ def main(api_url, output_file, counts_output_file): df = pd.DataFrame(rows) # Save the DataFrame to a TSV file - df.to_csv(output_file, sep="\t", index=False) + df.to_csv(output, sep="\t", index=False) # Combine all values into a single list combined_values = [] @@ -60,7 +60,7 @@ def main(api_url, output_file, counts_output_file): counts_df[['ontology', 'local_id']] = counts_df['Value'].str.split(':', n=1, expand=True) # Save counts DataFrame to a TSV file - counts_df.to_csv(counts_output_file, sep="\t", index=False) + counts_df.to_csv(counts_output, sep="\t", index=False) else: print("Failed to fetch data from the API:", response.status_code)