Skip to content

Commit 06a80e5

Browse files
authored
Merge pull request #52 from mboudet/dev_version
Fix redirect and add annotation management in ES.
2 parents c807550 + ed8ff30 commit 06a80e5

5 files changed

Lines changed: 44 additions & 6 deletions

File tree

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,14 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
66
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html)
77

8+
## [0.4.10] 2023-11-29
9+
10+
### Added
11+
12+
- Added 'annotation_field" config option, for external ES search
13+
- Added redirection from Gene subentity to Gene in url
14+
15+
816
## [0.4.10] 2023-11-23
917

1018
### Added

config.json.template

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
"externalSearchOptions": {
1414
"url": "http://0.0.0.0:80",
1515
"gene_field": "gene_id",
16+
"annotation_field": "annotation",
1617
"query_param": "q",
1718
"field_param": "display_fields",
1819
"count_param": "max_results"

imports/api/publications.js

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,13 +86,17 @@ Meteor.publish({
8686
let url = config.externalSearchOptions.url.replace(/,+$/, "") + "/";
8787
let paramsDict = {}
8888
let geneField = config.externalSearchOptions.gene_field ? config.externalSearchOptions.gene_field : "geneId"
89+
let annotationField = config.externalSearchOptions.annotation_field ? config.externalSearchOptions.annotation_field : ""
8990
if (config.externalSearchOptions.query_param){
9091
paramsDict[config.externalSearchOptions.query_param] = query.query
9192
} else {
9293
url += query.query
9394
}
9495
if (config.externalSearchOptions.field_param){
9596
paramsDict[config.externalSearchOptions.field_param] = geneField
97+
if (config.externalSearchOptions.annotation_field) {
98+
paramsDict[config.externalSearchOptions.field_param] += "," + annotationField
99+
}
96100
}
97101

98102
if (config.externalSearchOptions.count_param){
@@ -103,9 +107,15 @@ Meteor.publish({
103107
url = url + "?" + new URLSearchParams(paramsDict)
104108
const response = HTTP.get(url);
105109
if (response.statusCode === 200){
106-
geneResults = response.data.data.map(result => result._source[geneField])
110+
geneResults = response.data.data.map(result => {
111+
if (config.externalSearchOptions.annotation_field){
112+
return {"ID": result._source[geneField], "annotationName": result._source[annotationField]}
113+
} else {
114+
return {"ID": result._source[geneField]}
115+
}
116+
})
107117
}
108-
transformedQuery = {genomeId: { $in: queryGenomeIds }, ID: { $in: geneResults }}
118+
transformedQuery = {genomeId: { $in: queryGenomeIds }, $or: geneResults}
109119
} else {
110120
transformedQuery = { ...query, genomeId: { $in: queryGenomeIds } };
111121
}
@@ -120,7 +130,13 @@ Meteor.publish({
120130
if (typeof geneId === 'undefined') {
121131
Object.assign(query, { 'subfeatures.ID': transcriptId });
122132
} else {
123-
Object.assign(query, { ID: geneId });
133+
Object.assign(query, {
134+
$or: [
135+
{'ID': geneId},
136+
{ 'subfeatures.ID': geneId },
137+
{ 'subfeatures.protein_id': geneId },
138+
],
139+
});
124140
}
125141

126142
return Genes.find(query);

imports/ui/singleGenePage/SingleGenePage.jsx

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,22 @@ function geneDataTracker({ match, genomeDataCache, location }) {
8484
const geneSub = Meteor.subscribe('singleGene', { geneId });
8585
let genes
8686
if (annotation) {
87-
genes = Genes.find({ ID: geneId, annotationName: annotation }).fetch();
87+
genes = Genes.find({
88+
$or: [
89+
{'ID': geneId},
90+
{ 'subfeatures.ID': geneId },
91+
{ 'subfeatures.protein_id': geneId },
92+
],
93+
annotationName: annotation
94+
}).fetch();
8895
} else {
89-
genes = Genes.find({ ID: geneId }).fetch();
96+
genes = Genes.find({
97+
$or: [
98+
{'ID': geneId},
99+
{ 'subfeatures.ID': geneId },
100+
{ 'subfeatures.protein_id': geneId },
101+
]
102+
}).fetch();
90103
}
91104

92105
const loading = !geneSub.ready();

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "genoboo",
3-
"version": "0.4.10",
3+
"version": "0.4.11",
44
"repository": "https://github.com/gogepp/genoboo",
55
"description": "A portable website for browsing and querying genome sequences and annotations. Forked from genenotebook",
66
"license": "AGPL-3.0",

0 commit comments

Comments
 (0)