Skip to content

Commit

Permalink
Merge pull request #46 from mboudet/dev_version
Browse files Browse the repository at this point in the history
Manage multiple annotation versions
  • Loading branch information
mboudet authored Oct 20, 2023
2 parents 3a3c44e + cb046a2 commit f575f82
Show file tree
Hide file tree
Showing 67 changed files with 2,610 additions and 6,093 deletions.
13 changes: 12 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.8] Unreleased
## [0.4.8] 2023-10-20

### Added

Expand All @@ -18,6 +18,17 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- 'query_param' : optional get parameter to use for the query
- 'field_param': optional get parameter to use to restrict the results to the gene_field value
- 'count_param': optional get parameter to restrict the number of results
- Multiple annotations for the same genome
- When adding an annotation, you must now set the '--annot' to set the annotation name.
- When integrating data afterward, you can use the --annot tag to specify the annotation you are aiming for.
- If you have multiple genes with the same ID, and do not specify '--annot', the results may be variables
- You can specify --annotations multiple time when integrating orthogroups
- Will now decode proteins and genes IDs when integrating data. (It was already done when integrating gffs, so there was some mismatch with IDs)

## Changed

- Various UI fixes to better fit multiple annotation versions
- Including an 'annotation' selector in the gene list

## [0.4.7] 2023-09-26

Expand Down
67 changes: 58 additions & 9 deletions cli/genoboo.js
Original file line number Diff line number Diff line change
Expand Up @@ -318,10 +318,14 @@ addAnnotation
.arguments('<file>')
.option('-u, --username <username>', 'GeneNoteBook admin username')
.option('-p, --password <password>', 'GeneNoteBook admin password')
.option(
.requiredOption(
'-n, --name <genome-name>',
'Reference genome name to which the annotation should be added.',
)
.requiredOption(
'--annot <annotation-name>',
'Annotation name',
)
.option(
'-r, --re_protein <pattern>',
'Replacement string for the protein name using capturing groups defined by --re_protein_capture. Make sure to use JS-style groups ($1 for group 1)',
Expand Down Expand Up @@ -352,6 +356,7 @@ addAnnotation
password,
port = 3000,
name,
annot,
re_protein,
re_protein_capture,
attr_protein,
Expand Down Expand Up @@ -389,6 +394,7 @@ addAnnotation
{
fileName,
genomeName: name,
annotationName: annot,
re_protein,
re_protein_capture: correctProteinCapture,
attr_protein,
Expand Down Expand Up @@ -433,6 +439,10 @@ running GeneNoteBook server.`
'--port [port]',
'Port on which GeneNoteBook is running. Default: 3000'
)
.option(
'--annot <annotation-ame>',
'Annotation name',
)
.option(
'-fmt, --format [parser]',
`Choose a parser for the diamond output format. Parses .xml, .txt
Expand All @@ -455,7 +465,7 @@ running GeneNoteBook server.`
.action(
(
file,
{ username, password, port = 3000, format, algorithm, matrix, database }
{ username, password, port = 3000, annot, format, algorithm, matrix, database }
) => {
if (typeof file !== 'string') addDiamond.help();

Expand Down Expand Up @@ -490,6 +500,7 @@ file extension is not "xml", "txt"`);
fileName,
parser: parserType,
program: 'diamond',
annot: annot,
algorithm: algorithm,
matrix: matrix,
database: database,
Expand All @@ -502,7 +513,7 @@ file extension is not "xml", "txt"`);
Example:
genenotebook add diamond mmucedo.xml -u admin -p admin
or
genenotebook add diamond mmucedo.txt --format txt --program blastp --matrix BLOSUM90 -db "Non-reundant protein sequences (nr)" -u admin -p admin
genenotebook add diamond mmucedo.txt --format txt --matrix BLOSUM90 -db "Non-reundant protein sequences (nr)" -u admin -p admin
`);
})
.exitOverride(customExitOverride(addDiamond));
Expand All @@ -525,6 +536,10 @@ running GeneNoteBook server.`
'-p, --password <adminPassword>',
'GeneNoteBook admin password'
)
.option(
'--annot <annotation-ame>',
'Annotation name',
)
.option(
'--port [port]',
'Port on which GeneNoteBook is running. Default: 3000'
Expand All @@ -548,7 +563,7 @@ running GeneNoteBook server.`
.action(
(
file,
{ username, password, port = 3000, format, algorithm, matrix, database }
{ username, password, port = 3000, annot, format, algorithm, matrix, database }
) => {
if (typeof file !== 'string') addBlast.help();

Expand Down Expand Up @@ -584,6 +599,7 @@ file extension is not "xml", "txt"`);
parser: parserType,
program: 'blast',
algorithm: algorithm,
annot: annot,
matrix: matrix,
database: database,
}
Expand Down Expand Up @@ -619,6 +635,10 @@ addExpression
'-d, --sample-description <description>',
'Description of the experiment'
)
.option(
'--annot <annotation-ame>',
'Annotation name',
)
.option(
'-r, --replicas <replicas...>',
'Comma-separated column positions, which are part of the same replica group. Can be set multiple times for multiple groups. The replica group name will be the first column, unless replica-names is set'
Expand All @@ -639,7 +659,7 @@ addExpression
const replicas = opts.replicas || [];
const replicaNames = opts.replicaNames || [];
const isPublic = opts.public;

const annot = opts.annot
if (!(fileName && username && password)) {
program.help();
}
Expand All @@ -648,6 +668,7 @@ addExpression
{
fileName,
description,
annot,
replicas,
replicaNames,
isPublic
Expand Down Expand Up @@ -680,6 +701,10 @@ addExpression
'-d, --sample-description <description>',
'Description of the experiment'
)
.option(
'--annot <annotation-ame>',
'Annotation name',
)
.option(
'--public',
'Set the generated replica groups as public. Default: false',
Expand All @@ -692,6 +717,7 @@ addExpression
const replicaGroup = opts.replicaGroup || fileName;
const description = opts.sampleDescription || 'description';
const isPublic = opts.public
const anot = opts.annot

if (!(fileName && username && password)) {
program.help();
Expand All @@ -701,6 +727,7 @@ addExpression
{
fileName,
sampleName,
annot: annot,
replicaGroup,
description,
isPublic
Expand Down Expand Up @@ -728,12 +755,16 @@ addInterproscan
'--port [port]',
'Port on which GeneNoteBook is running. Default: 3000'
)
.option(
'--annot <annotation-ame>',
'Annotation name',
)
.option(
'--format [parser]',
`Choose a parser for the interproscan output files. Parses .gff3 and .tsv
extensions.`
)
.action((file, { username, password, port = 3000, format }) => {
.action((file, { username, password, port = 3000, format, annot }) => {
if (typeof file !== 'string') addInterproscan.help();

const fileName = path.resolve(file);
Expand Down Expand Up @@ -766,6 +797,7 @@ file extension is not "tsv", "gff3" or "xml".`);
{
fileName,
parser: parserType,
annot: annot
}
);
})
Expand Down Expand Up @@ -794,11 +826,15 @@ addEggnog
'-p, --password <adminPassword>',
'GeneNoteBook admin password'
)
.option(
'--annot <annotation-ame>',
'Annotation name',
)
.option(
'--port [port]',
'Port on which GeneNoteBook is running. Default: 3000'
)
.action((file, { username, password, port = 3000 }) => {
.action((file, { username, password, port = 3000, annot }) => {
if (typeof file !== 'string') addEggnog.help();

const fileName = path.resolve(file);
Expand All @@ -808,6 +844,7 @@ addEggnog

new GeneNoteBookConnection({ username, password, port }).call('addEggnog', {
fileName,
annot: annot
});
})
.on('--help', () => {
Expand All @@ -833,11 +870,15 @@ addHectar
'-p, --password <adminPassword>',
'GeneNoteBook admin password'
)
.option(
'--annot <annotation-ame>',
'Annotation name',
)
.option(
'--port [port]',
'Port on which GeneNoteBook is running. Default: 3000'
)
.action((file, { username, password, port = 3000 }) => {
.action((file, { username, password, port = 3000, annot }) => {
if (typeof file !== 'string') addHectar.help();

const fileName = path.resolve(file);
Expand All @@ -847,6 +888,7 @@ addHectar

new GeneNoteBookConnection({ username, password, port }).call('addHectar', {
fileName,
annot: annot
});
})
.on('--help', () => {
Expand Down Expand Up @@ -878,17 +920,23 @@ addOrthogroups
'-f, --force [force]',
'Ignore the use of prefixes.',
)
.option(
'-a, --annotations <annotations...>',
'Name of the annotation to use for gene matching. Can be set multiple times'
)
.requiredOption('-u, --username <username>', 'GeneNoteBook admin username')
.requiredOption('-p, --password <password>', 'GeneNoteBook admin password')
.option(
'--port [port]',
'Port on which GeneNoteBook is running. Default: 3000'
)
.action((file, { prefixe, list, force, username, password, port = 3000 }) => {
.action((file, { prefixe, list, force, annotations, username, password, port = 3000 }) => {
if (typeof file !== 'string') addOrthogroups.help();
const folderName = path.resolve(file);
const prefixes = (typeof list !== 'undefined' ? list : path.resolve(prefixe));

annotations = annotations || []

if (!(folderName && username && password)) {
addOrthogroups.help();
}
Expand All @@ -899,6 +947,7 @@ addOrthogroups
folderName,
force,
prefixes,
annotations
},
);
})
Expand Down
1 change: 0 additions & 1 deletion imports/api/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import './genomes/removeGenome.js';
import './genomes/annotation/removeAnnotationTrack.js';
import './genomes/annotation/addAnnotation.js';

import './genes/interproscan.js';
import './genes/addInterproscan.js';
import './genes/eggnog/addEggnog.js';
import './genes/hectar/addHectar.js';
Expand Down
20 changes: 14 additions & 6 deletions imports/api/genes/addInterproscan.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,16 @@ import { Meteor } from 'meteor/meteor';
* @method finalize
*/
class InterproscanProcessor {
constructor() {
constructor(annot) {
this.bulkOp = interproscanCollection.rawCollection().initializeUnorderedBulkOp();
this.geneBulkOp = Genes.rawCollection().initializeUnorderedBulkOp();
this.currentProt = ""
this.currentGene = ""
this.currentContent = []
this.currentDB = []
this.currentOnto = []
this.currentOnto = [],
this.currentAnnotationName = "",
this.annot = annot
}

finalize = () => {
Expand All @@ -31,7 +33,7 @@ class InterproscanProcessor {
if (this.bulkOp.length > 0){
return this.bulkOp.execute();
}
return { nMatched: 0 }
return { nUpserted: 0 }
}

updateGenes = () => {
Expand All @@ -47,11 +49,13 @@ class InterproscanProcessor {
this.bulkOp.find({
gene_id: this.currentGene,
protein_id: this.currentProt,
annotationName: this.currentAnnotationName
}).upsert().update(
{
$set: {
gene_id: this.currentGene,
protein_id: this.currentProt,
annotationName: this.currentAnnotationName,
protein_domains: this.currentContent
},
},
Expand All @@ -63,7 +67,7 @@ class InterproscanProcessor {
}

if (this.currentDB != [] || this.currentOnto != []){
this.geneBulkOp.find({ID: this.currentGene}).update({
this.geneBulkOp.find({ID: this.currentGene, annotationName: this.currentAnnotationName}).update({
$addToSet: {
'attributes.Ontology_term': { $each: this.currentOnto },
'attributes.Dbxref': { $each: this.currentDB }
Expand All @@ -80,6 +84,10 @@ const addInterproscan = new ValidatedMethod({
name: 'addInterproscan',
validate: new SimpleSchema({
fileName: { type: String },
annot: {
type: String,
optional: true,
},
parser: {
type: String,
allowedValues: ['tsv', 'gff3'],
Expand All @@ -88,15 +96,15 @@ const addInterproscan = new ValidatedMethod({
applyOptions: {
noRetry: true,
},
run({ fileName, parser }) {
run({ fileName, annot, parser }) {
if (!this.userId) {
throw new Meteor.Error('not-authorized');
}
if (!Roles.userIsInRole(this.userId, 'admin')) {
throw new Meteor.Error('not-authorized');
}

const job = new Job(jobQueue, 'addInterproscan', { fileName, parser });
const job = new Job(jobQueue, 'addInterproscan', { fileName, annot, parser });
const jobId = job.priority('high').save();

// Continue with synchronous processing
Expand Down
Loading

0 comments on commit f575f82

Please sign in to comment.