From d7968a0d1c1d0be068b65e0969a41ffea7b725da Mon Sep 17 00:00:00 2001 From: mboudet Date: Fri, 24 Nov 2023 17:50:09 +0100 Subject: [PATCH 1/3] Some fixes & trying some stuff with annotation and ES --- imports/api/publications.js | 17 +++++++++++++---- imports/ui/singleGenePage/SingleGenePage.jsx | 17 +++++++++++++++-- 2 files changed, 28 insertions(+), 6 deletions(-) diff --git a/imports/api/publications.js b/imports/api/publications.js index 16a3e58b..982be6be 100644 --- a/imports/api/publications.js +++ b/imports/api/publications.js @@ -86,13 +86,14 @@ Meteor.publish({ let url = config.externalSearchOptions.url.replace(/,+$/, "") + "/"; let paramsDict = {} let geneField = config.externalSearchOptions.gene_field ? config.externalSearchOptions.gene_field : "geneId" + let annotationField = config.externalSearchOptions.annotation_field ? config.externalSearchOptions.annotation_field : "annotation" if (config.externalSearchOptions.query_param){ paramsDict[config.externalSearchOptions.query_param] = query.query } else { url += query.query } if (config.externalSearchOptions.field_param){ - paramsDict[config.externalSearchOptions.field_param] = geneField + paramsDict[config.externalSearchOptions.field_param] = geneField + "," + annotationField } if (config.externalSearchOptions.count_param){ @@ -103,9 +104,11 @@ Meteor.publish({ url = url + "?" + new URLSearchParams(paramsDict) const response = HTTP.get(url); if (response.statusCode === 200){ - geneResults = response.data.data.map(result => result._source[geneField]) + geneResults = response.data.data.map(result => { + return {"ID": result._source[geneField], "annotationName": result._source[annotationField]} + }) } - transformedQuery = {genomeId: { $in: queryGenomeIds }, ID: { $in: geneResults }} + transformedQuery = {genomeId: { $in: queryGenomeIds }, $or: geneResults} } else { transformedQuery = { ...query, genomeId: { $in: queryGenomeIds } }; } @@ -120,7 +123,13 @@ Meteor.publish({ if (typeof geneId === 'undefined') { Object.assign(query, { 'subfeatures.ID': transcriptId }); } else { - Object.assign(query, { ID: geneId }); + Object.assign(query, { + $or: [ + {'ID': geneId}, + { 'subfeatures.ID': geneId }, + { 'subfeatures.protein_id': geneId }, + ], + }); } return Genes.find(query); diff --git a/imports/ui/singleGenePage/SingleGenePage.jsx b/imports/ui/singleGenePage/SingleGenePage.jsx index 39e91f62..5b5ba7dd 100644 --- a/imports/ui/singleGenePage/SingleGenePage.jsx +++ b/imports/ui/singleGenePage/SingleGenePage.jsx @@ -84,9 +84,22 @@ function geneDataTracker({ match, genomeDataCache, location }) { const geneSub = Meteor.subscribe('singleGene', { geneId }); let genes if (annotation) { - genes = Genes.find({ ID: geneId, annotationName: annotation }).fetch(); + genes = Genes.find({ + $or: [ + {'ID': geneId}, + { 'subfeatures.ID': geneId }, + { 'subfeatures.protein_id': geneId }, + ], + annotationName: annotation + }).fetch(); } else { - genes = Genes.find({ ID: geneId }).fetch(); + genes = Genes.find({ + $or: [ + {'ID': geneId}, + { 'subfeatures.ID': geneId }, + { 'subfeatures.protein_id': geneId }, + ] + }).fetch(); } const loading = !geneSub.ready(); From ed8ff300393a7c12c19e47f963fdb15c6088b542 Mon Sep 17 00:00:00 2001 From: mboudet Date: Wed, 29 Nov 2023 10:29:04 +0000 Subject: [PATCH 2/3] Some changes and prepare release --- CHANGELOG.md | 8 ++++++++ config.json.template | 1 + imports/api/publications.js | 13 ++++++++++--- package.json | 2 +- 4 files changed, 20 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 14fe05c5..0dc87270 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,14 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html) +## [0.4.10] 2023-11-29 + +### Added + +- Added 'annotation_field" config option, for external ES search +- Added redirection from Gene subentity to Gene in url + + ## [0.4.10] 2023-11-23 ### Added diff --git a/config.json.template b/config.json.template index 8abc5b85..6c878fb4 100644 --- a/config.json.template +++ b/config.json.template @@ -13,6 +13,7 @@ "externalSearchOptions": { "url": "http://0.0.0.0:80", "gene_field": "gene_id", + "annotation_field": "annotation", "query_param": "q", "field_param": "display_fields", "count_param": "max_results" diff --git a/imports/api/publications.js b/imports/api/publications.js index 982be6be..a3387300 100644 --- a/imports/api/publications.js +++ b/imports/api/publications.js @@ -86,14 +86,17 @@ Meteor.publish({ let url = config.externalSearchOptions.url.replace(/,+$/, "") + "/"; let paramsDict = {} let geneField = config.externalSearchOptions.gene_field ? config.externalSearchOptions.gene_field : "geneId" - let annotationField = config.externalSearchOptions.annotation_field ? config.externalSearchOptions.annotation_field : "annotation" + let annotationField = config.externalSearchOptions.annotation_field ? config.externalSearchOptions.annotation_field : "" if (config.externalSearchOptions.query_param){ paramsDict[config.externalSearchOptions.query_param] = query.query } else { url += query.query } if (config.externalSearchOptions.field_param){ - paramsDict[config.externalSearchOptions.field_param] = geneField + "," + annotationField + paramsDict[config.externalSearchOptions.field_param] = geneField + if (config.externalSearchOptions.annotation_field) { + paramsDict[config.externalSearchOptions.field_param] += "," + annotationField + } } if (config.externalSearchOptions.count_param){ @@ -105,7 +108,11 @@ Meteor.publish({ const response = HTTP.get(url); if (response.statusCode === 200){ geneResults = response.data.data.map(result => { - return {"ID": result._source[geneField], "annotationName": result._source[annotationField]} + if (config.externalSearchOptions.annotation_field){ + return {"ID": result._source[geneField], "annotationName": result._source[annotationField]} + } else { + return {"ID": result._source[geneField]} + } }) } transformedQuery = {genomeId: { $in: queryGenomeIds }, $or: geneResults} diff --git a/package.json b/package.json index 595b0675..b93ac179 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "genoboo", - "version": "0.4.10", + "version": "0.4.11", "repository": "https://github.com/gogepp/genoboo", "description": "A portable website for browsing and querying genome sequences and annotations. Forked from genenotebook", "license": "AGPL-3.0", From 2815d71c9bd61c0bace7deb0f5f784b962249c8e Mon Sep 17 00:00:00 2001 From: mboudet Date: Wed, 29 Nov 2023 11:40:22 +0100 Subject: [PATCH 3/3] Update CHANGELOG.md --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0dc87270..674e743f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,7 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html) -## [0.4.10] 2023-11-29 +## [0.4.11] 2023-11-29 ### Added