Skip to content

Commit

Permalink
Merge pull request #1499 from microbiomedata/hotfix-1496-fix-gene-search
Browse files Browse the repository at this point in the history
Fix metap ingest
  • Loading branch information
naglepuff authored Dec 23, 2024
2 parents a6bef5a + 204bcd6 commit 9c6f640
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion nmdc_server/data_object_filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class WorkflowActivityTypeEnum(Enum):
metabolomics_analysis = "nmdc:MetabolomicsAnalysis"
metagenome_assembly = "nmdc:MetagenomeAssembly"
metagenome_annotation = "nmdc:MetagenomeAnnotation"
metaproteomic_analysis = "nmdc:MetaproteomicAnalysis"
metaproteomic_analysis = "nmdc:MetaproteomicsAnalysis"
metatranscriptome = "nmdc:MetatranscriptomeAnalysis"
metatranscriptome_assembly = "nmdc:MetatranscriptomeAssembly"
metatranscriptome_annotation = "nmdc:MetatranscriptomeAnnotation"
Expand Down
2 changes: 1 addition & 1 deletion nmdc_server/ingest/all.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ def load(db: Session, function_limit=None, skip_annotation=False):
pipeline.load(
db,
mongodb[workflow_set].find(
{"type": "nmdc:MetaproteomicsAnalysis"},
{"type": WorkflowActivityTypeEnum.metaproteomic_analysis.value},
no_cursor_timeout=True,
),
pipeline.load_mp_analysis,
Expand Down
4 changes: 1 addition & 3 deletions nmdc_server/ingest/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,15 +92,13 @@ def load_mp_analysis(db: Session, obj: Dict[str, Any], **kwargs) -> LoadObjectRe
"gene_function_id": {
"$regex": gene_regex,
},
"best_protein": True,
},
no_cursor_timeout=True,
projection={
"_id": False,
"was_generated_by": True,
"count": True,
"gene_function_id": True,
"best_protein": True,
},
)
if kwargs.get("function_limit"):
Expand All @@ -116,7 +114,7 @@ def load_mp_analysis(db: Session, obj: Dict[str, Any], **kwargs) -> LoadObjectRe
metaproteomic_analysis_id=pipeline.id,
gene_function_id=function_id,
count=annotation["count"],
best_protein=annotation["best_protein"],
best_protein=True,
)
)
if metap_gene_function_aggregations:
Expand Down
8 changes: 7 additions & 1 deletion nmdc_server/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,13 @@ def query(self, db) -> Query:

# Gene function queries are treated differently because they join
# in three different places (metaT, metaG and metaP).
if table == Table.gene_function:
if table in [
Table.gene_function,
Table.kegg_function,
Table.go_function,
Table.pfam_function,
Table.cog_function,
]:
metag_matches = filter.matches(db, self.table)
metap_conditions = [
SimpleConditionSchema(
Expand Down

0 comments on commit 9c6f640

Please sign in to comment.