Skip to content

Commit

Permalink
Merge pull request #53 from gogepp/dev
Browse files Browse the repository at this point in the history
Release 0.4.11
  • Loading branch information
mboudet committed Nov 29, 2023
2 parents 9e216f4 + 2815d71 commit 54cd72b
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 6 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.11] 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
Expand Down
1 change: 1 addition & 0 deletions config.json.template
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
22 changes: 19 additions & 3 deletions imports/api/publications.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +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 : ""
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
if (config.externalSearchOptions.annotation_field) {
paramsDict[config.externalSearchOptions.field_param] += "," + annotationField
}
}

if (config.externalSearchOptions.count_param){
Expand All @@ -103,9 +107,15 @@ 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 => {
if (config.externalSearchOptions.annotation_field){
return {"ID": result._source[geneField], "annotationName": result._source[annotationField]}
} else {
return {"ID": result._source[geneField]}
}
})
}
transformedQuery = {genomeId: { $in: queryGenomeIds }, ID: { $in: geneResults }}
transformedQuery = {genomeId: { $in: queryGenomeIds }, $or: geneResults}
} else {
transformedQuery = { ...query, genomeId: { $in: queryGenomeIds } };
}
Expand All @@ -120,7 +130,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);
Expand Down
17 changes: 15 additions & 2 deletions imports/ui/singleGenePage/SingleGenePage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down

0 comments on commit 54cd72b

Please sign in to comment.