|
57 | 57 | @echo "" |
58 | 58 | @echo "Ontology Alignment Pipeline:" |
59 | 59 | @echo " make help-alignment - Show detailed alignment pipeline help" |
60 | | - @echo " make alignment-run-all - Run complete alignment pipeline" |
61 | 60 | @echo "" |
62 | 61 | @echo "External Ontology Downloads:" |
63 | 62 | @echo " make download-external-bioportal-ontologies - Download non-OLS ontologies" |
@@ -96,7 +95,7 @@ install-literature: |
96 | 95 | install-databases: |
97 | 96 | uv sync --extra databases |
98 | 97 |
|
99 | | -# Notebooks environment (adds: jupyter, notebook, matplotlib, numpy, chromadb, etc.) |
| 98 | +# Notebooks environment (adds: jupyter, notebook, matplotlib, numpy, etc.) |
100 | 99 | install-notebooks: |
101 | 100 | uv sync --extra notebooks |
102 | 101 |
|
@@ -354,33 +353,14 @@ audit-ids: reports/id-allocation-audit.md |
354 | 353 | # These reports analyze definition coverage and quality in METPO. |
355 | 354 | # Most require the SSSOM mappings file from the alignment pipeline. |
356 | 355 |
|
357 | | -reports/definition_improvement_opportunities.tsv: src/templates/metpo_sheet.tsv notebooks/metpo_relevant_mappings.sssom.tsv |
358 | | - uv run analyze-definition-opportunities \ |
359 | | - --template $< \ |
360 | | - --mappings $(word 2,$^) \ |
361 | | - --output $@ |
362 | | - |
363 | 356 | reports/definition_coverage_by_parent.tsv: src/templates/metpo_sheet.tsv |
364 | 357 | uv run analyze-definition-coverage-by-subtree \ |
365 | 358 | --metpo-tsv $< \ |
366 | 359 | --output $@ \ |
367 | 360 | --sort-by stragglers |
368 | 361 |
|
369 | | -# Note: find-best-definitions requires chromadb optional dependency |
370 | | -# Install with: uv sync --extra notebooks |
371 | | -reports/best_definitions_per_term.tsv: src/templates/metpo_sheet.tsv |
372 | | - uv run find-best-definitions \ |
373 | | - --metpo-tsv $< \ |
374 | | - --output $@ |
375 | | - |
376 | | -reports/definition_comparison_with_hierarchy.tsv: reports/best_definitions_per_term.tsv src/templates/metpo_sheet.tsv |
377 | | - uv run compare-definitions-with-hierarchy \ |
378 | | - --best-definitions $< \ |
379 | | - --metpo-terms $(word 2,$^) \ |
380 | | - --output $@ |
381 | | - |
382 | 362 | .PHONY: definition-reports |
383 | | -definition-reports: reports/definition_improvement_opportunities.tsv reports/definition_coverage_by_parent.tsv |
| 363 | +definition-reports: reports/definition_coverage_by_parent.tsv |
384 | 364 | @echo "Definition analysis reports generated" |
385 | 365 |
|
386 | 366 | .PHONY: clean-definition-reports |
@@ -690,173 +670,6 @@ list-bioportal-releases: |
690 | 670 | @echo "" |
691 | 671 | @echo "Note: Set BIOPORTAL_API_KEY environment variable for authenticated downloads" |
692 | 672 |
|
693 | | -# ============================================================================== |
694 | | -# Ontology Alignment Pipeline - Granular Targets |
695 | | -# ============================================================================== |
696 | | - |
697 | | -.PHONY: alignment-fetch-ontology-names alignment-categorize-ontologies \ |
698 | | - alignment-query-metpo-terms alignment-analyze-matches \ |
699 | | - alignment-analyze-coherence alignment-identify-candidates \ |
700 | | - alignment-run-all clean-alignment-results clean-alignment-all help-alignment |
701 | | - |
702 | | -# Individual pipeline steps |
703 | | -alignment-fetch-ontology-names: notebooks/ontology_catalog.csv |
704 | | - |
705 | | -notebooks/ontology_catalog.csv: data/ontology_assessments/ontology_sizes.csv |
706 | | - @echo "Fetching ontology metadata from OLS4 API..." |
707 | | - uv run python metpo/pipeline/fetch_ontology_names.py \ |
708 | | - --sizes-csv data/ontology_assessments/ontology_sizes.csv \ |
709 | | - --output-csv notebooks/ontology_catalog.csv |
710 | | - |
711 | | -alignment-categorize-ontologies: notebooks/ontologies_very_appealing.csv |
712 | | - |
713 | | -notebooks/ontologies_very_appealing.csv: notebooks/ontology_catalog.csv |
714 | | - @echo "Categorizing ontologies by relevance..." |
715 | | - uv run python metpo/pipeline/categorize_ontologies.py \ |
716 | | - --input-csv notebooks/ontology_catalog.csv \ |
717 | | - --output-prefix notebooks/ontologies |
718 | | - |
719 | | -alignment-query-metpo-terms: notebooks/metpo_relevant_mappings.sssom.tsv |
720 | | - |
721 | | -notebooks/metpo_relevant_mappings.sssom.tsv: notebooks/metpo_relevant_chroma |
722 | | - @echo "Generating SSSOM mappings from METPO terms via ChromaDB..." |
723 | | - @if [ -z "$$OPENAI_API_KEY" ]; then \ |
724 | | - echo "ERROR: OPENAI_API_KEY environment variable not set"; \ |
725 | | - exit 1; \ |
726 | | - fi |
727 | | - uv run python metpo/pipeline/chromadb_semantic_mapper.py \ |
728 | | - --metpo-tsv src/templates/metpo_sheet.tsv \ |
729 | | - --chroma-path notebooks/metpo_relevant_chroma \ |
730 | | - --collection-name metpo_relevant_embeddings \ |
731 | | - --output notebooks/metpo_relevant_mappings.sssom.tsv \ |
732 | | - --top-n 10 \ |
733 | | - --label-only \ |
734 | | - --distance-cutoff 0.35 |
735 | | - |
736 | | -alignment-analyze-matches: notebooks/metpo_relevant_mappings.sssom.tsv |
737 | | - @echo "Analyzing match quality..." |
738 | | - uv run python metpo/pipeline/analyze_matches.py \ |
739 | | - --input-csv notebooks/metpo_relevant_mappings.sssom.tsv \ |
740 | | - --good-match-threshold 0.9 |
741 | | - |
742 | | -alignment-analyze-coherence: notebooks/full_coherence_results.csv |
743 | | - |
744 | | -notebooks/full_coherence_results.csv: notebooks/metpo_relevant_mappings.sssom.tsv |
745 | | - @echo "Computing structural coherence (this may take a while)..." |
746 | | - uv run python metpo/pipeline/analyze_sibling_coherence.py \ |
747 | | - --input-csv notebooks/metpo_relevant_mappings.sssom.tsv \ |
748 | | - --metpo-owl src/ontology/metpo.owl \ |
749 | | - --output-csv notebooks/full_coherence_results.csv |
750 | | - |
751 | | -alignment-identify-candidates: notebooks/alignment_candidates.csv |
752 | | - |
753 | | -notebooks/alignment_candidates.csv: notebooks/full_coherence_results.csv |
754 | | - @echo "Identifying alignment candidates..." |
755 | | - uv run python metpo/pipeline/analyze_coherence_results.py \ |
756 | | - --results-csv notebooks/full_coherence_results.csv \ |
757 | | - --matches-csv notebooks/metpo_relevant_mappings.sssom.tsv |
758 | | - |
759 | | -# Run complete pipeline |
760 | | -alignment-run-all: alignment-identify-candidates |
761 | | - @echo "" |
762 | | - @echo "=========================================" |
763 | | - @echo "Alignment pipeline complete!" |
764 | | - @echo "=========================================" |
765 | | - @echo "Output files:" |
766 | | - @echo " - notebooks/metpo_relevant_mappings.sssom.tsv" |
767 | | - @echo " - notebooks/full_coherence_results.csv" |
768 | | - @echo " - notebooks/alignment_candidates.csv" |
769 | | - |
770 | | -# Clean alignment results |
771 | | -clean-alignment-results: |
772 | | - @echo "Cleaning alignment pipeline results..." |
773 | | - rm -f notebooks/metpo_*_matches.csv |
774 | | - rm -f notebooks/*_coherence_results.csv |
775 | | - rm -f notebooks/alignment_candidates.csv |
776 | | - @echo "Alignment results cleaned (ontology catalog preserved)" |
777 | | - |
778 | | -# Clean everything including ontology catalog |
779 | | - |
780 | | -# ===================================================== |
781 | | -# Non-OLS Embedding Targets |
782 | | -# ===================================================== |
783 | | - |
784 | | -NON_OLS_TSV_FILES = $(foreach ont,$(NON_OLS_BIOPORTAL_ONTOLOGIES),data/pipeline/non-ols-terms/$(ont).tsv) |
785 | | - |
786 | | -.PHONY: embed-non-ols-terms clean-non-ols-terms scan-manifest view-manifest view-logs |
787 | | - |
788 | | -.PHONY: generate-non-ols-tsvs |
789 | | -generate-non-ols-tsvs: $(NON_OLS_TSV_FILES) |
790 | | - @echo "" |
791 | | - @echo "==========================================" |
792 | | - @echo "Query phase complete" |
793 | | - @echo "==========================================" |
794 | | - @echo "Run 'make scan-manifest' to update tracking" |
795 | | - @echo "Run 'make view-logs' to see any failures" |
796 | | - |
797 | | -# Manifest and logging targets |
798 | | -scan-manifest: |
799 | | - @echo "Scanning directories and updating manifest..." |
800 | | - uv run scan-manifest --verbose |
801 | | - |
802 | | -view-manifest: |
803 | | - @if [ -f .ontology_manifest.json ]; then \ |
804 | | - cat .ontology_manifest.json | python -m json.tool; \ |
805 | | - else \ |
806 | | - echo "No manifest found. Run 'make scan-manifest' first."; \ |
807 | | - fi |
808 | | - |
809 | | -view-logs: |
810 | | - @echo "=== Recent Fetch Failures ===" |
811 | | - @if [ -f .ontology_fetch.log ]; then tail -20 .ontology_fetch.log; else echo "No fetch failures logged"; fi |
812 | | - @echo "" |
813 | | - @echo "=== Recent Query Failures ===" |
814 | | - @if [ -f .robot_query.log ]; then grep -E "QUERY_FAILED|QUERY_EMPTY" .robot_query.log | tail -20 || echo "No query failures logged"; else echo "No query log found"; fi |
815 | | - |
816 | | -embed-non-ols-terms: |
817 | | - @echo "Embedding non-OLS terms into ChromaDB..." |
818 | | - uv run python metpo/pipeline/embed_ontology_to_chromadb.py \ |
819 | | - $(foreach tsv,$(wildcard data/pipeline/non-ols-terms/*.tsv),--tsv-file $(tsv)) \ |
820 | | - --chroma-path ./embeddings_chroma \ |
821 | | - --collection-name non_ols_embeddings |
822 | | - @echo "Non-OLS terms embedded successfully." |
823 | | - |
824 | | -clean-non-ols-terms: |
825 | | - @echo "Cleaning generated non-OLS TSV files..." |
826 | | - rm -f $(NON_OLS_TSV_FILES) |
827 | | - @echo "Cleaned non-OLS TSV files" |
828 | | - |
829 | | -clean-alignment-all: clean-alignment-results |
830 | | - @echo "Cleaning all alignment files including ontology catalog..." |
831 | | - rm -f notebooks/ontology_catalog.csv |
832 | | - rm -f notebooks/ontologies_*.csv |
833 | | - @echo "All alignment files cleaned" |
834 | | - |
835 | | -# Help target |
836 | | -help-alignment: |
837 | | - @echo "METPO Ontology Alignment Pipeline Targets:" |
838 | | - @echo "" |
839 | | - @echo " Preparation:" |
840 | | - @echo " make alignment-fetch-ontology-names - Fetch ontology metadata from OLS4" |
841 | | - @echo " make alignment-categorize-ontologies - Categorize by relevance" |
842 | | - @echo "" |
843 | | - @echo " Analysis:" |
844 | | - @echo " make alignment-query-metpo-terms - Query METPO against ChromaDB" |
845 | | - @echo " make alignment-analyze-matches - Analyze match quality" |
846 | | - @echo " make alignment-analyze-coherence - Compute structural coherence" |
847 | | - @echo " make alignment-identify-candidates - Find high-quality candidates" |
848 | | - @echo "" |
849 | | - @echo " Complete workflow:" |
850 | | - @echo " make alignment-run-all - Run entire pipeline" |
851 | | - @echo "" |
852 | | - @echo " Cleanup:" |
853 | | - @echo " make clean-alignment-results - Clean results only" |
854 | | - @echo " make clean-alignment-all - Clean all including catalog" |
855 | | - @echo "" |
856 | | - @echo " Prerequisites:" |
857 | | - @echo " - Set OPENAI_API_KEY environment variable" |
858 | | - @echo " - Ensure ChromaDB collection exists at notebooks/metpo_relevant_chroma" |
859 | | - |
860 | 673 | # ============================================================================== |
861 | 674 | # Sub-Makefile Integration |
862 | 675 | # ============================================================================== |
|
0 commit comments