Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add goal to create general stats #8812

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 50 additions & 0 deletions src/ontology/mondo.Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,56 @@ create-mondo-stats:
$(MAKE) create-mondo-stats-summary-file -B


#######################################
# Create General Statistics for Mondo #
#######################################
GENERAL_STATISTICS_QUERIES = \
$(SPARQLDIR)/reports/COUNT-all_disease_excluding_susceptibility.sparql \
$(SPARQLDIR)/reports/COUNT-all_human_diseases.sparql \
$(SPARQLDIR)/reports/COUNT-all_non-human_diseases.sparql \
$(SPARQLDIR)/reports/COUNT-rare-diseases-classes.sparql \
$(SPARQLDIR)/reports/COUNT-human_diseases_infectious.sparql \
$(SPARQLDIR)/reports/COUNT-non-human_diseases_infectious.sparql \
$(SPARQLDIR)/reports/COUNT-human-genetic-diseases.sparql \
$(SPARQLDIR)/reports/COUNT-non-human-genetic-diseases.sparql

TMP_RESULTS_DIR = $(MONDO_STATS_REPORTS_DIR)/tmp
GEN_STATS_REPORTS_DIR = $(MONDO_STATS_REPORTS_DIR)/mondo-general-stats

OUTPUTS = $(patsubst $(SPARQLDIR)/reports/%.sparql, $(TMP_RESULTS_DIR)/%.tsv, $(GENERAL_STATISTICS_QUERIES))

COMBINED_REPORT = $(GEN_STATS_REPORTS_DIR)/mondo_general_statistics.tsv

create-general-mondo-stats-all: create-general-mondo-stats combine clean-temp

create-general-mondo-stats: $(OUTPUTS)

$(TMP_RESULTS_DIR)/%.tsv: $(SPARQLDIR)/reports/%.sparql mondo.owl
mkdir -p $(TMP_RESULTS_DIR) $(GEN_STATS_REPORTS_DIR)
@echo "Running query $< ..."
$(ROBOT) reason -i mondo.owl query --use-graphs true -f tsv --query $< $@

# Combine all results into a single report
combine: create-general-mondo-stats
@echo "Combining results into $(COMBINED_REPORT)..."
@echo "All Mondo General Statistics created on: $(current_date)" > $(COMBINED_REPORT)
cat $(TMP_RESULTS_DIR)/*.tsv >> $(COMBINED_REPORT)
@echo "Combined report saved to $(COMBINED_REPORT)"

# Remove temporary result files after combining
clean-temp:
rm -f $(TMP_RESULTS_DIR)/*.tsv
@echo "Cleaned up temporary result files."

# Clean everything (temporary + reports)
clean-stats:
rm -f $(TMP_RESULTS_DIR)/*.tsv $(COMBINED_REPORT)
@echo "Cleaned all generated files."

all: create-general-mondo-stats-all



#############################################
##### One-time scripts ######################
#############################################
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX obo: <http://purl.obolibrary.org/obo/>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>

# Get a count of all non-obsolete disease classes excluding 'disease susceptibility'

SELECT (COUNT(DISTINCT ?class) AS ?countAllDiseaseExcludingSusceptibility)
WHERE {
# Find subclasses of MONDO:0000001 'disease'
?class rdfs:subClassOf* obo:MONDO_0000001 .

# Exclude subclasses of MONDO:0042489 'disease susceptibility'
FILTER NOT EXISTS {
?class rdfs:subClassOf* obo:MONDO_0042489 .
}

FILTER NOT EXISTS {
?class owl:deprecated "true"^^xsd:boolean
}

FILTER (isIRI(?class) && STRSTARTS(str(?class), "http://purl.obolibrary.org/obo/MONDO_"))
}
18 changes: 18 additions & 0 deletions src/sparql/reports/COUNT-all_human_diseases.sparql
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX obo: <http://purl.obolibrary.org/obo/>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>

# Get a count of all non-obsolete 'human disease' classes

SELECT (COUNT(DISTINCT ?class) AS ?countHumanDisease)
WHERE {
# Find subclasses of MONDO:0000001 'disease'
?class rdfs:subClassOf* obo:MONDO_0000001 .

FILTER NOT EXISTS {
?class owl:deprecated "true"^^xsd:boolean
}

FILTER (isIRI(?class) && STRSTARTS(str(?class), "http://purl.obolibrary.org/obo/MONDO_"))
}
18 changes: 18 additions & 0 deletions src/sparql/reports/COUNT-all_non-human_diseases.sparql
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX obo: <http://purl.obolibrary.org/obo/>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>

# Get a count of all non-obsolete 'non-human animal disease' classes

SELECT (COUNT(DISTINCT ?class) AS ?countNonHumanAnimalDisease)
WHERE {
# Find subclasses of MONDO:0005583 'non-human animal disease'
?class rdfs:subClassOf* obo:MONDO_0005583 .

FILTER NOT EXISTS {
?class owl:deprecated "true"^^xsd:boolean
}

FILTER (isIRI(?class) && STRSTARTS(str(?class), "http://purl.obolibrary.org/obo/MONDO_"))
}
22 changes: 22 additions & 0 deletions src/sparql/reports/COUNT-human-genetic-diseases.sparql
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX obo: <http://purl.obolibrary.org/obo/>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>


# Get count of human genetic diseases

SELECT (COUNT(DISTINCT ?class) AS ?countHumanGeneticDiseases)
WHERE {
# Find subclasses of MONDO:0003847 'hereditary disease'
?class rdfs:subClassOf* obo:MONDO_0003847 .

# Exclude deprecated terms
FILTER NOT EXISTS {
?class owl:deprecated "true"^^xsd:boolean
}

# Ensure the class is a MONDO term
FILTER (isIRI(?class) && STRSTARTS(str(?class), "http://purl.obolibrary.org/obo/MONDO_"))
}
18 changes: 18 additions & 0 deletions src/sparql/reports/COUNT-human_diseases_infectious.sparql
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX obo: <http://purl.obolibrary.org/obo/>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>

# Count the total number of unique non-obsolete Mondo diseases that are an infectious disease

SELECT (COUNT(DISTINCT ?class) AS ?countHumanDiseaseInfectious)
WHERE {
# 'infectious disease' MONDO_0005550
?class rdfs:subClassOf* obo:MONDO_0005550 .

FILTER NOT EXISTS {
?class owl:deprecated "true"^^xsd:boolean
}

FILTER (isIRI(?class) && STRSTARTS(str(?class), "http://purl.obolibrary.org/obo/MONDO_"))
}
22 changes: 22 additions & 0 deletions src/sparql/reports/COUNT-non-human-genetic-diseases.sparql
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX obo: <http://purl.obolibrary.org/obo/>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>


# Get count of NON-human genetic diseases

SELECT (COUNT(DISTINCT ?class) AS ?countHumanGeneticDiseases)
WHERE {
# Find subclasses of MONDO:1011321 'hereditary disease, non-human animal'
?class rdfs:subClassOf* obo:MONDO_1011321 .

# Exclude deprecated terms
FILTER NOT EXISTS {
?class owl:deprecated "true"^^xsd:boolean
}

# Ensure the class is a MONDO term
FILTER (isIRI(?class) && STRSTARTS(str(?class), "http://purl.obolibrary.org/obo/MONDO_"))
}
18 changes: 18 additions & 0 deletions src/sparql/reports/COUNT-non-human_diseases_infectious.sparql
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX obo: <http://purl.obolibrary.org/obo/>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>

# Count the total number of unique non-obsolete Mondo non-human animal diseases that are an infectious disease

SELECT (COUNT(DISTINCT ?class) AS ?countNonHumanDiseaseInfectious)
WHERE {
# 'infectious disease, non-human animal'
?class rdfs:subClassOf* obo:MONDO_0700049 .

FILTER NOT EXISTS {
?class owl:deprecated "true"^^xsd:boolean
}

FILTER (isIRI(?class) && STRSTARTS(str(?class), "http://purl.obolibrary.org/obo/MONDO_"))
}
19 changes: 19 additions & 0 deletions src/sparql/reports/COUNT-rare-diseases-classes.sparql
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX obo: <http://purl.obolibrary.org/obo/>
PREFIX oboInOwl: <http://www.geneontology.org/formats/oboInOwl#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>

# Count of unique non-obsolete Mondo classes that are in the rare disease subset

SELECT (COUNT(DISTINCT ?class) AS ?countRareSubset)
WHERE {
?class rdfs:subClassOf* obo:MONDO_0000001 ;
oboInOwl:inSubset <http://purl.obolibrary.org/obo/mondo#rare> .

FILTER NOT EXISTS {
?class owl:deprecated "true"^^xsd:boolean
}

FILTER (isIRI(?class) && STRSTARTS(str(?class), "http://purl.obolibrary.org/obo/MONDO_"))
}