Skip to content
Open
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
7 changes: 7 additions & 0 deletions src/ensembl/production/metadata/api/search/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ class GenomeSearchDocument(BaseModel):
coding_genes: int
has_variation: bool = False
has_regulation: bool = False
has_homology: bool = False
genebuild_provider: str
genebuild_method_display: str

Expand Down Expand Up @@ -188,6 +189,7 @@ def to_search_entry(self) -> SearchEntry:
SearchField(name="n50", value=str(self.contig_n50)),
SearchField(name="has_variation", value=self.has_variation),
SearchField(name="has_regulation", value=self.has_regulation),
SearchField(name="has_homology", value=self.has_homology),
SearchField(name="annotation_method", value=self.genebuild_method_display),
SearchField(name="annotation_provider", value=self.genebuild_provider),
SearchField(name="genome_uuid", value=self.genome_uuid),
Expand Down Expand Up @@ -325,6 +327,10 @@ def has_regulation(self) -> bool:
"""Check if genome has regulatory features data"""
return self._has_dataset_type("regulatory_features")

def has_homology(self) -> bool:
"""Check if genome has homology data"""
return self._has_dataset_type("homologies")

def get_genebuild_provider(self) -> str:
"""
Get genebuild provider name.
Expand Down Expand Up @@ -833,6 +839,7 @@ def create_search_document(
"coding_genes": dataset_extractor.get_coding_genes(),
"has_variation": dataset_extractor.has_variation(),
"has_regulation": dataset_extractor.has_regulation(),
"has_homology": dataset_extractor.has_homology(),
"genebuild_provider": dataset_extractor.get_genebuild_provider(),
"genebuild_method_display": dataset_extractor.get_genebuild_method_display(),
}
Expand Down