From 7d76a3519003778da67caa74d5c29c8b99ff972e Mon Sep 17 00:00:00 2001 From: Kamassau Date: Thu, 20 Jul 2023 14:26:53 +0200 Subject: [PATCH 01/16] Add Hectar loader (#31) --- cli/genoboo.js | 39 +++++ imports/api/genes/hectar/addHectar.js | 143 +++++++++++++++++++ imports/api/genes/hectar/hectar.test.js | 64 +++++++++ imports/api/genes/hectar/hectarCollection.js | 41 ++++++ imports/api/jobqueue/process-hectar.js | 57 ++++++++ private/data/Bnigra_hectar.tab | 2 + 6 files changed, 346 insertions(+) create mode 100644 imports/api/genes/hectar/addHectar.js create mode 100644 imports/api/genes/hectar/hectar.test.js create mode 100644 imports/api/genes/hectar/hectarCollection.js create mode 100644 imports/api/jobqueue/process-hectar.js create mode 100644 private/data/Bnigra_hectar.tab diff --git a/cli/genoboo.js b/cli/genoboo.js index 59328c65..22a032ca 100755 --- a/cli/genoboo.js +++ b/cli/genoboo.js @@ -755,6 +755,45 @@ Example: }) .exitOverride(customExitOverride(addEggnog)); +// Add Hectar annotations file. +const addHectar = add.command('hectar'); + +addHectar + .description('Add Hectar results to a running GeneNoteBook server') + .usage('[options] ') + .arguments('') + .requiredOption( + '-u, --username ', + 'GeneNoteBook admin username' + ) + .requiredOption( + '-p, --password ', + 'GeneNoteBook admin password' + ) + .option( + '--port [port]', + 'Port on which GeneNoteBook is running. Default: 3000' + ) + .action((file, { username, password, port = 3000 }) => { + if (typeof file !== 'string') addHectar.help(); + + const fileName = path.resolve(file); + if (!(fileName && username && password)) { + addHectar.help(); + } + + new GeneNoteBookConnection({ username, password, port }).call('addHectar', { + fileName, + }); + }) + .on('--help', () => { + console.log(` +Example: + genenotebook add hectar hectar_annotations.tab -u admin -p admin + `); + }) + .exitOverride(customExitOverride(addHectar)); + // add orthogroups. const addOrthogroups = add.command('orthogroups'); diff --git a/imports/api/genes/hectar/addHectar.js b/imports/api/genes/hectar/addHectar.js new file mode 100644 index 00000000..b08d8806 --- /dev/null +++ b/imports/api/genes/hectar/addHectar.js @@ -0,0 +1,143 @@ +import { hectarCollection } from '/imports/api/genes/hectar/hectarCollection.js'; +import jobQueue, { Job } from '/imports/api/jobqueue/jobqueue.js'; +import { ValidatedMethod } from 'meteor/mdg:validated-method'; +import { Genes } from '/imports/api/genes/geneCollection.js'; +import logger from '/imports/api/util/logger.js'; +import { Roles } from 'meteor/alanning:roles'; +import SimpleSchema from 'simpl-schema'; +import { Meteor } from 'meteor/meteor'; + +class HectarProcessor { + constructor() { + // Not a bulk mongo suite. + this.genesDb = Genes.rawCollection(); + this.nHectar = 0; + } + + /** + * Function that returns the total number of insertions or updates in the + * hectar collection. + * @function + * @return {Number} Return the total number of insertions or updates of + * hectar. + */ + getNumberHectar() { + return this.nHectar; + } + + parse = (line) => { + if (!(line[0] === '#' || line.split('\t').length <= 1)) { + // Get all hectar informations line by line and separated by tabs. + const [ + proteinId, + predictedTargetingCategory, + signalPeptideScore, + signalPeptideCleavageSite, + typeIISignalAnchorScore, + chloroplastScore, + mitochondrionScore, + otherScore, + ] = line.split('\t'); + + // Organize data in a dictionary. + const annotations = { + protein_id: proteinId, + predicted_targeting_category: predictedTargetingCategory, + signal_peptide_score: signalPeptideScore, + signal_peptide_cleavage_site: signalPeptideCleavageSite, + typeII_signal_anchor_score: typeIISignalAnchorScore, + chloroplast_score: chloroplastScore, + mitochondrion_score: mitochondrionScore, + other_score: otherScore, + }; + + // Filters undefined data (with a dash) and splits into an array for + // comma-separated data. + for (const [key, value] of Object.entries(annotations)) { + if (value[0] === '-') { + annotations[key] = undefined; + } + if (value.indexOf(',') > -1) { + annotations[key] = value.split(','); + } + } + + // If subfeatures is found in genes database (e.g: ID = + // MMUCEDO_000002-T1). + const subfeatureIsFound = Genes.findOne({ + $or: [ + { 'subfeatures.ID': protein_id }, + { 'subfeatures.protein_id': protein_id }, + ], + }); + + if (typeof subfeatureIsFound !== 'undefined') { + // Increment hectar. + this.nHectar += 1; + + // Update or insert if no matching documents were found. + const documentHectar = hectarCollection.upsert( + { protein_id: proteinId }, // selector. + annotations, // modifier. + ); + + // Update hectarId in genes database. + if (typeof documentHectar.insertedId !== 'undefined') { + // Hectar _id is created. + return this.genesDb.update({ + $or: [ + { 'subfeatures.ID': proteinId }, + { 'subfeatures.protein_id': proteinId }, + ]}, + { $set: { hectarId: documentHectar.insertedId } }, + ); + } else { + // Hectar already exists. + const hectarIdentifiant = hectarCollection.findOne({ protein_id: proteinId })._id; + return this.genesDb.update( + { $or: [{'subfeatures.ID': proteinId}, {'subfeatures.protein_id': proteinId}] }, + { $set: { hectarId: hectarIdentifiant } }, + ); + } + } else { + logger.warn(` +Warning ! ${proteinId} hectar annotation did +not find a matching protein domain in the genes database. +${proteinId} is not added to the hectar database.`); + } + } + }; +} + +const addHectar = new ValidatedMethod({ + name: 'addHectar', + validate: new SimpleSchema({ + fileName: { type: String }, + }).validator(), + applyOptions: { + noRetry: true, + }, + run({ fileName }) { + if (!this.userId) { + throw new Meteor.Error('not-authorized'); + } + if (!Roles.userIsInRole(this.userId, 'admin')) { + throw new Meteor.Error('not-authorized'); + } + + logger.log('file :', { fileName }); + const job = new Job(jobQueue, 'addHectar', { fileName }); + const jobId = job.priority('high').save(); + + let { status } = job.doc; + logger.debug(`Job status: ${status}`); + while ((status !== 'completed') && (status !== 'failed')) { + const { doc } = job.refresh(); + status = doc.status; + } + return { result: job.doc.result, jobStatus: status}; + }, +}); + +export default addHectar; +export { HectarProcessor }; diff --git a/imports/api/genes/hectar/hectar.test.js b/imports/api/genes/hectar/hectar.test.js new file mode 100644 index 00000000..b9bebd0a --- /dev/null +++ b/imports/api/genes/hectar/hectar.test.js @@ -0,0 +1,64 @@ +/* eslint-env mocha */ +import { resetDatabase } from 'meteor/xolvio:cleaner'; +import chai from 'chai'; +import logger from '../../util/logger'; +import { hectarCollection } from './hectarCollection'; +import addhectar from './addHectar'; +import { addTestUsers, addTestGenome } from '../../../startup/server/fixtures/addTestData'; +import '../../jobqueue/process-hectar'; + +describe('hectar', function testHectar() { + let adminId; + let newUserId; + let adminContext; + let userContext; + + logger.log('Testing Hectar methods'); + + beforeEach(() => { + ({ adminId, newUserId } = addTestUsers()); + adminContext = { userId: adminId }; + userContext = { userId: newUserId }; + }); + + afterEach(() => { + resetDatabase(); + }); + + it('Should add Hectar tab file', function importhectar() { + // Increase timeout + this.timeout(20000); + + addTestGenome(annot = true); + + const hectarParams = { + fileName: 'assets/app/data/Bnigra_hectar.tsv', + }; + + // Should fail for non-logged in + chai.expect(() => { + addHectar._execute({}, hectarParams); + }).to.throw('[not-authorized]'); + + // Should fail for non admin user + chai.expect(() => { + addHectar._execute(userContext, hectarParams); + }).to.throw('[not-authorized]'); + + const { result } = addHectar._execute(adminContext, hectarParams); + + chai.assert.equal(result.nInserted, 1) + + const hecs = hectarCollection.find({ protein_id: 'BniB01g000010.2N.1-P' }).fetch(); + + chai.assert.lengthOf(hecs, 1, 'No hectar data found'); + + const hec = hecs[0]; + + chai.assert.equal(hec.predicted_targeting_category, 'other localisation'); + chai.assert.equal(hec.signal_peptide_score, '0.0583'); + chai.assert.equal(hec.typeII_signal_anchor_score, '0.0228'); + chai.assert.equal(hec.mitochondrion_score, '0.1032'); + chai.assert.equal(hec.other_score, '0.8968'); + }); +}); diff --git a/imports/api/genes/hectar/hectarCollection.js b/imports/api/genes/hectar/hectarCollection.js new file mode 100644 index 00000000..bf7dad3f --- /dev/null +++ b/imports/api/genes/hectar/hectarCollection.js @@ -0,0 +1,41 @@ +import SimpleSchema from 'simpl-schema'; +import { Mongo } from 'meteor/mongo'; + +const hectarSchema = new SimpleSchema({ + protein_id: { + type: String, + label: 'Query sequence name and type.', + }, + predicted_targeting_category: { + type: String, + label: 'Predicted sub-cellular localization.', + }, + signal_peptide_score: { + type: String, + label: 'Probability (score) to be a signal peptide.', + }, + signal_peptide_cleavage_site: { + type: String, + label: 'Predicted cleavage site of signal peptide.', + }, + typeII_signal_anchor_score: { + type: String, + label: 'Probability (score) to be a type II signal anchor.', + }, + chloroplast_score: { + type: String, + label: 'Probability (score) to be in chloroplast.', + }, + mitochondrion_score: { + type: String, + label: 'Probability (score) to be in mitochondrion.', + }, + other_score: { + type: String, + label: 'Probability (score) to be elsewhere .', + }, +}); + +const hectarCollection = new Mongo.Collection('hectar'); + +export { hectarCollection, hectarSchema }; diff --git a/imports/api/jobqueue/process-hectar.js b/imports/api/jobqueue/process-hectar.js new file mode 100644 index 00000000..4338b288 --- /dev/null +++ b/imports/api/jobqueue/process-hectar.js @@ -0,0 +1,57 @@ +import { HectarProcessor } from '/imports/api/genes/hectar/addHectar.js'; +import logger from '/imports/api/util/logger.js'; +import jobQueue from './jobqueue.js'; +import readline from 'readline'; +import fs from 'fs'; + +jobQueue.processJobs( + 'addHectar', + { + concurrency: 4, + payload: 1, + }, + async (job, callback) => { + const { fileName } = job.data; + logger.log(`Add ${fileName} hectar file.`); + + const lineProcessor = new HectarProcessor(); + + const rl = readline.createInterface({ + input: fs.createReadStream(fileName, 'utf8'), + crlfDelay: Infinity, + }); + + const { size: fileSize } = await fs.promises.stat(fileName); + let processedBytes = 0; + let processedLines = 0; + let nHectar = 0; + + for await (const line of rl) { + processedBytes += line.length + 1; // also count \n + processedLines += 1; + + if ((processedLines % 100) === 0) { + await job.progress( + processedBytes, + fileSize, + { echo: true }, + (err) => { + if (err) logger.error(err); + }, + ); + } + + try { + await lineProcessor.parse(line); + nHectar = lineProcessor.getNumberHectar(); + } catch (err) { + logger.error(err); + job.fail({ err }); + callback(); + } + } + logger.log(`Inserted ${nHectar} Hectar`); + job.done({ nInserted: nHectar }); + callback(); + }, +); diff --git a/private/data/Bnigra_hectar.tab b/private/data/Bnigra_hectar.tab new file mode 100644 index 00000000..7d62a5ec --- /dev/null +++ b/private/data/Bnigra_hectar.tab @@ -0,0 +1,2 @@ +protein id predicted targeting category signal peptide score signal peptide cleavage site type II signal anchor score chloroplast score mitochondrion score other score +BniB01g000010.2N.1-P other localisation 0.0583 - 0.0228 - 0.1032 0.8968 From 4ffb519abf7b958ffaea26621b21bb3072a91afe Mon Sep 17 00:00:00 2001 From: Kamassau Date: Wed, 26 Jul 2023 13:59:57 +0200 Subject: [PATCH 02/16] import hectar (#31) --- imports/api/api.js | 1 + 1 file changed, 1 insertion(+) diff --git a/imports/api/api.js b/imports/api/api.js index d552add6..6632a5dd 100644 --- a/imports/api/api.js +++ b/imports/api/api.js @@ -19,6 +19,7 @@ import './genomes/annotation/addAnnotation.js'; import './genes/interproscan.js'; import './genes/addInterproscan.js'; import './genes/eggnog/addEggnog.js'; +import './genes/hectar/addHectar.js'; import './genes/scanGeneAttributes.js'; import './genes/updateAttributeInfo.js'; import './genes/updateGene.js'; From 39473b485317a9b220f26850fff4a50e61d8eaa1 Mon Sep 17 00:00:00 2001 From: Kamassau Date: Wed, 26 Jul 2023 14:00:39 +0200 Subject: [PATCH 03/16] Modify prot name to correspond in gff --- private/data/Bnigra_hectar.tab | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/private/data/Bnigra_hectar.tab b/private/data/Bnigra_hectar.tab index 7d62a5ec..d32d333f 100644 --- a/private/data/Bnigra_hectar.tab +++ b/private/data/Bnigra_hectar.tab @@ -1,2 +1,2 @@ protein id predicted targeting category signal peptide score signal peptide cleavage site type II signal anchor score chloroplast score mitochondrion score other score -BniB01g000010.2N.1-P other localisation 0.0583 - 0.0228 - 0.1032 0.8968 +BniB01g000010.2N.1 other localisation 0.0583 - 0.0228 - 0.1032 0.8968 From 99e743953081486ff5360c5dea05ca9ae8001f79 Mon Sep 17 00:00:00 2001 From: Kamassau Date: Wed, 26 Jul 2023 15:53:28 +0200 Subject: [PATCH 04/16] Add Hectar to ui (#31) --- imports/ui/singleGenePage/SingleGenePage.jsx | 1 + imports/ui/singleGenePage/hectar/Hectar.jsx | 271 +++++++++++++++++++ imports/ui/singleGenePage/hectar/hectar.scss | 4 + 3 files changed, 276 insertions(+) create mode 100644 imports/ui/singleGenePage/hectar/Hectar.jsx create mode 100644 imports/ui/singleGenePage/hectar/hectar.scss diff --git a/imports/ui/singleGenePage/SingleGenePage.jsx b/imports/ui/singleGenePage/SingleGenePage.jsx index 4ff5cccf..3782901f 100644 --- a/imports/ui/singleGenePage/SingleGenePage.jsx +++ b/imports/ui/singleGenePage/SingleGenePage.jsx @@ -16,6 +16,7 @@ import Genemodel from './Genemodel.jsx'; import Seq from './Seq.jsx'; import ProteinDomains from './ProteinDomains.jsx'; import Eggnog from './eggnog/Eggnog.jsx'; +import Hectar from './hectar/Hectar.jsx'; import SequenceSimilarity from './alignment/SequenceSimilarity.jsx'; import Orthogroup from './orthoGroup/Orthogroup.jsx'; diff --git a/imports/ui/singleGenePage/hectar/Hectar.jsx b/imports/ui/singleGenePage/hectar/Hectar.jsx new file mode 100644 index 00000000..e0679680 --- /dev/null +++ b/imports/ui/singleGenePage/hectar/Hectar.jsx @@ -0,0 +1,271 @@ +/* eslint-disable react/prop-types */ +import { hectarCollection } from '/imports/api/genes/hectar/hectarCollection.js'; +import { branch, compose } from '/imports/ui/util/uiUtil.jsx'; +import { Genes } from '/imports/api/genes/geneCollection.js'; +import { withTracker } from 'meteor/react-meteor-data'; +import React, { useEffect, useState } from 'react'; +import { Meteor } from 'meteor/meteor'; +import './hectar.scss'; + +function Header() { + return ( + <> +
+

Hectar annotations

+ + ); +} + +function hasNoHectar({ hectar }) { + return typeof hectar === 'undefined'; +} + +function NoHectar({ showHeader }) { + return ( + <> + {showHeader &&
} +
+
+

No Hectar annotations found

+
+
+ + ); +} + +function hectarDataTracker({ gene }) { + const hectarSub = Meteor.subscribe('hectar', gene.hectarId); + const loading = !hectarSub.ready(); + const hectar = hectarCollection.findOne({}); + + return { + loading, + gene, + hectar, + }; +} + +function Localisation({ annot }) { + return ( + + { annot } + + ); +} + +function SigPepScore({ sigPep }) { + return ( + + { sigPep } + + ); +} + +function SigPepClivScore({ sigPepCli }) { + return ( + + { sigPepCli } + + ); +} + +function TIISigAncScore({ sigAnchor }) { + return ( + + { sigAnchor } + + ); +} + +function ChloroScore({ chloro }) { + return ( + + { chloro } + + ); +} + +function MitoScore({ mito }) { + return ( + + { mito } + + ); +} + + +function OtherScore({ other }) { + return ( + + { other } + + ); +} + +function HectarGeneralInformations({ informations, maxArray = 5 }) { + const maxChar = 70; + const maxArrayLines = maxArray; + const infoIsArray = Array.isArray(informations); + const isMaxArray = informations.length > maxArrayLines; + const isMaxChar = informations.length > maxChar; + + const [openInfo, setOpenInfo] = useState(false); + const [descArray, setDescArray] = useState([]); + const [descChar, setDescChar] = useState(''); + + useEffect(() => { + if (infoIsArray) { + if (openInfo) { + setDescArray(informations); + } else { + setDescArray(informations.slice(0, maxArrayLines)); + } + } else { + if (informations.length > maxChar) { + if (openInfo === false) { + const descNoArray = informations + ? `${informations.slice(0, maxChar)} ... ` + : informations; + setDescChar(descNoArray); + } else { + setDescChar(informations); + } + } else { + setDescChar(informations); + } + } + }, [openInfo]); + + const buttonText = (() => { + if (infoIsArray) { + if (openInfo) { + return 'Show less'; + } + return `Show ${informations.length - maxArrayLines} more ...`; + } else { + if (openInfo) { + return 'Show less'; + } + return 'Show more ...'; + } + })(); + + return ( + <> + { + infoIsArray + ( +
{ descChar }
+ ) + } + + ); +} + +function ArrayHectarAnnotations({ hectar }) { + return ( +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ General informations +
+ Sub-cellular localisation prediction + + { hectar.predicted_targeting_category && } +
+ Signal peptide score + + { hectar.signal_peptide_score && } +
+ Signal peptide cleavage site score + + { hectar.signal_peptide_cleavage_site && } +
+ TypeII signal anchor score + + { + hectar.typeII_signal_anchor_score + && ( + + ) + } +
+ Chloroplastic protein score + + { + hectar.chloroplast_score + && ( + + ) + } +
+ Mitochondrial protein score + + { + hectar.mitochondrion_score + && ( + + ) + } +
+ Other localisation score + + { + hectar.other_score + && ( + + ) + } +
+
+ ); +} + +function HectarAnnotation({ showHeader = false, hectar }) { + return ( + <> + { showHeader &&
} +
+ +
+ + ); +} + +export default compose( + withTracker(hectarDataTracker), + branch(hasNoHectar, NoHectar), +)(HectarAnnotation); diff --git a/imports/ui/singleGenePage/hectar/hectar.scss b/imports/ui/singleGenePage/hectar/hectar.scss new file mode 100644 index 00000000..98be477b --- /dev/null +++ b/imports/ui/singleGenePage/hectar/hectar.scss @@ -0,0 +1,4 @@ +.table-hectar { + width: 100%; + table-layout: fixed; +} From 5cbdc7d6dbfbbec5dc01cd40dceaa56b1fc49856 Mon Sep 17 00:00:00 2001 From: Kamassau Date: Wed, 26 Jul 2023 15:56:22 +0200 Subject: [PATCH 05/16] add Hectar infos (#31) --- imports/api/genes/geneCollection.js | 6 ++++++ imports/api/publications.js | 5 +++++ tests/main.js | 1 + 3 files changed, 12 insertions(+) diff --git a/imports/api/genes/geneCollection.js b/imports/api/genes/geneCollection.js index c741c79e..cc093e3e 100644 --- a/imports/api/genes/geneCollection.js +++ b/imports/api/genes/geneCollection.js @@ -173,6 +173,12 @@ const GeneSchema = new SimpleSchema( optional: true, label: 'eggnog DB identifier (_id in eggnog collection)', }, + hectarId: { + type: String, + index: true, + optional: true, + label: 'Hectar identifier (_id in hectar collection)', + }, seqid: { type: String, label: 'ID of the sequence on which the gene is, e.g. chr1', diff --git a/imports/api/publications.js b/imports/api/publications.js index b8f14428..e82906bb 100644 --- a/imports/api/publications.js +++ b/imports/api/publications.js @@ -9,6 +9,7 @@ import { attributeCollection } from '/imports/api/genes/attributeCollection.js'; import { dbxrefCollection } from '/imports/api/genes/dbxrefCollection.js'; import { EditHistory } from '/imports/api/genes/edithistory_collection.js'; import { eggnogCollection } from '/imports/api/genes/eggnog/eggnogCollection.js'; +import { hectarCollection } from '/imports/api/genes/hectar/hectarCollection.js'; import { interproscanCollection } from '/imports/api/genes/interproscan/interproscanCollection.js'; import { similarSequencesCollection } from '/imports/api/genes/alignment/similarSequenceCollection.js'; // orthogroups @@ -179,6 +180,10 @@ Meteor.publish({ const eggnog = eggnogCollection.find({_id: query}); return eggnog; }, + hectar(query) { + const hectar = hectarCollection.find({_id: query}); + return hectar; + }, alignment(gene) { const diamond = similarSequencesCollection.find( { diff --git a/tests/main.js b/tests/main.js index 7b3a444a..aa6a4c5d 100644 --- a/tests/main.js +++ b/tests/main.js @@ -10,6 +10,7 @@ if (Meteor.isServer) { import '../imports/api/genomes/annotation/addAnnotation.test'; import '../imports/api/genes/alignment/alignment.test.js'; import '../imports/api/genes/eggnog/eggnog.test.js'; + import '../imports/api/genes/hectar/hectar.test.js'; import '../imports/api/genes/interproscan/interproscan.test.js'; import '../imports/api/transcriptomes/transcriptomes.test.js'; import '../imports/api/genes/download/download.test.js'; From d923337b26372217d7b4452803bba960390f3471 Mon Sep 17 00:00:00 2001 From: Kamassau Date: Wed, 26 Jul 2023 16:08:49 +0200 Subject: [PATCH 06/16] Fix hectar main page (#31) --- imports/ui/singleGenePage/SingleGenePage.jsx | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/imports/ui/singleGenePage/SingleGenePage.jsx b/imports/ui/singleGenePage/SingleGenePage.jsx index 3782901f..983cce10 100644 --- a/imports/ui/singleGenePage/SingleGenePage.jsx +++ b/imports/ui/singleGenePage/SingleGenePage.jsx @@ -116,6 +116,11 @@ function SingleGenePage({ gene, genome = {} }) { EggNOG +
  • + + Hectar + +
  • Sequence Similarity @@ -148,6 +153,9 @@ function SingleGenePage({ gene, genome = {} }) {
    +
    + +
    From 9dc798f7fa16500054ea14b0297afbd4144c5fcd Mon Sep 17 00:00:00 2001 From: Kamassau Date: Thu, 27 Jul 2023 11:18:45 +0200 Subject: [PATCH 07/16] Fix (#31) --- imports/api/api.js | 1 + imports/api/genes/hectar/addHectar.js | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/imports/api/api.js b/imports/api/api.js index 6632a5dd..486c50aa 100644 --- a/imports/api/api.js +++ b/imports/api/api.js @@ -55,5 +55,6 @@ import './jobqueue/process-blast.js'; import './jobqueue/process-download.js'; import './jobqueue/process-addGenome.js'; import './jobqueue/process-eggnog.js'; +import './jobqueue/process-hectar.js'; import './jobqueue/process-similarsequences.js'; import './jobqueue/process-orthogroup.js'; diff --git a/imports/api/genes/hectar/addHectar.js b/imports/api/genes/hectar/addHectar.js index b08d8806..43ab76cc 100644 --- a/imports/api/genes/hectar/addHectar.js +++ b/imports/api/genes/hectar/addHectar.js @@ -66,8 +66,8 @@ class HectarProcessor { // MMUCEDO_000002-T1). const subfeatureIsFound = Genes.findOne({ $or: [ - { 'subfeatures.ID': protein_id }, - { 'subfeatures.protein_id': protein_id }, + { 'subfeatures.ID': proteinId }, + { 'subfeatures.protein_id': proteinId }, ], }); From c5f0678dbaeaa2787982a163867596dc7fa68677 Mon Sep 17 00:00:00 2001 From: Kamassau Date: Thu, 27 Jul 2023 11:37:53 +0200 Subject: [PATCH 08/16] Tab instead of spaces (#31) --- private/data/Bnigra_hectar.tab | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/private/data/Bnigra_hectar.tab b/private/data/Bnigra_hectar.tab index d32d333f..3926ca41 100644 --- a/private/data/Bnigra_hectar.tab +++ b/private/data/Bnigra_hectar.tab @@ -1,2 +1,2 @@ -protein id predicted targeting category signal peptide score signal peptide cleavage site type II signal anchor score chloroplast score mitochondrion score other score -BniB01g000010.2N.1 other localisation 0.0583 - 0.0228 - 0.1032 0.8968 +protein id predicted targeting category signal peptide score signal peptide cleavage site type II signal anchor score chloroplast score mitochondrion score other score +BniB01g000010.2N.1 other localisation 0.0583 - 0.0228 - 0.1032 0.8968 From 4604f9228ce2d8d677d2917a6981ab88c8811184 Mon Sep 17 00:00:00 2001 From: Kamassau Date: Thu, 27 Jul 2023 11:46:13 +0200 Subject: [PATCH 09/16] Remove links (#31) --- imports/ui/singleGenePage/hectar/Hectar.jsx | 88 ++++----------------- 1 file changed, 14 insertions(+), 74 deletions(-) diff --git a/imports/ui/singleGenePage/hectar/Hectar.jsx b/imports/ui/singleGenePage/hectar/Hectar.jsx index e0679680..ec22abe0 100644 --- a/imports/ui/singleGenePage/hectar/Hectar.jsx +++ b/imports/ui/singleGenePage/hectar/Hectar.jsx @@ -47,118 +47,58 @@ function hectarDataTracker({ gene }) { function Localisation({ annot }) { return ( -
    +

    { annot } - +

    ); } function SigPepScore({ sigPep }) { return ( - +

    { sigPep } - +

    ); } function SigPepClivScore({ sigPepCli }) { return ( - +

    { sigPepCli } - +

    ); } function TIISigAncScore({ sigAnchor }) { return ( - +

    { sigAnchor } - +

    ); } function ChloroScore({ chloro }) { return ( - +

    { chloro } - +

    ); } function MitoScore({ mito }) { return ( - +

    { mito } - +

    ); } function OtherScore({ other }) { return ( - +

    { other } - - ); -} - -function HectarGeneralInformations({ informations, maxArray = 5 }) { - const maxChar = 70; - const maxArrayLines = maxArray; - const infoIsArray = Array.isArray(informations); - const isMaxArray = informations.length > maxArrayLines; - const isMaxChar = informations.length > maxChar; - - const [openInfo, setOpenInfo] = useState(false); - const [descArray, setDescArray] = useState([]); - const [descChar, setDescChar] = useState(''); - - useEffect(() => { - if (infoIsArray) { - if (openInfo) { - setDescArray(informations); - } else { - setDescArray(informations.slice(0, maxArrayLines)); - } - } else { - if (informations.length > maxChar) { - if (openInfo === false) { - const descNoArray = informations - ? `${informations.slice(0, maxChar)} ... ` - : informations; - setDescChar(descNoArray); - } else { - setDescChar(informations); - } - } else { - setDescChar(informations); - } - } - }, [openInfo]); - - const buttonText = (() => { - if (infoIsArray) { - if (openInfo) { - return 'Show less'; - } - return `Show ${informations.length - maxArrayLines} more ...`; - } else { - if (openInfo) { - return 'Show less'; - } - return 'Show more ...'; - } - })(); - - return ( - <> - { - infoIsArray - ( -

    { descChar }
    - ) - } - +

    ); } From f01d7d9fa36c49ecc5c1c93e0abf60c870f6e96a Mon Sep 17 00:00:00 2001 From: Kamassau Date: Thu, 27 Jul 2023 14:20:40 +0200 Subject: [PATCH 10/16] Pass first line of file (#31) --- imports/api/genes/hectar/addHectar.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/imports/api/genes/hectar/addHectar.js b/imports/api/genes/hectar/addHectar.js index 43ab76cc..413af13d 100644 --- a/imports/api/genes/hectar/addHectar.js +++ b/imports/api/genes/hectar/addHectar.js @@ -26,7 +26,7 @@ class HectarProcessor { } parse = (line) => { - if (!(line[0] === '#' || line.split('\t').length <= 1)) { + if (!(line.slice(0,10) === 'protein id' || line.split('\t').length <= 1)) { // Get all hectar informations line by line and separated by tabs. const [ proteinId, @@ -61,7 +61,7 @@ class HectarProcessor { annotations[key] = value.split(','); } } - + console.log(proteinId); // If subfeatures is found in genes database (e.g: ID = // MMUCEDO_000002-T1). const subfeatureIsFound = Genes.findOne({ @@ -72,6 +72,7 @@ class HectarProcessor { }); if (typeof subfeatureIsFound !== 'undefined') { + console.log("if loop" + typeof subfeatureIsFound); // Increment hectar. this.nHectar += 1; From aa4445e956d7c095e9d571eeaea459d3a849a3d7 Mon Sep 17 00:00:00 2001 From: Kamassau Date: Mon, 21 Aug 2023 10:55:08 +0200 Subject: [PATCH 11/16] Remove console.log --- imports/api/genes/hectar/addHectar.js | 1 - 1 file changed, 1 deletion(-) diff --git a/imports/api/genes/hectar/addHectar.js b/imports/api/genes/hectar/addHectar.js index 413af13d..7c8ebf6d 100644 --- a/imports/api/genes/hectar/addHectar.js +++ b/imports/api/genes/hectar/addHectar.js @@ -61,7 +61,6 @@ class HectarProcessor { annotations[key] = value.split(','); } } - console.log(proteinId); // If subfeatures is found in genes database (e.g: ID = // MMUCEDO_000002-T1). const subfeatureIsFound = Genes.findOne({ From 23c01f6cb95607d21f1d343be2c569e78a2963f1 Mon Sep 17 00:00:00 2001 From: Kamassau Date: Mon, 21 Aug 2023 11:57:28 +0200 Subject: [PATCH 12/16] Fix typo --- imports/api/genes/hectar/hectar.test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/imports/api/genes/hectar/hectar.test.js b/imports/api/genes/hectar/hectar.test.js index b9bebd0a..c63e74b3 100644 --- a/imports/api/genes/hectar/hectar.test.js +++ b/imports/api/genes/hectar/hectar.test.js @@ -3,7 +3,7 @@ import { resetDatabase } from 'meteor/xolvio:cleaner'; import chai from 'chai'; import logger from '../../util/logger'; import { hectarCollection } from './hectarCollection'; -import addhectar from './addHectar'; +import addHectar from './addHectar'; import { addTestUsers, addTestGenome } from '../../../startup/server/fixtures/addTestData'; import '../../jobqueue/process-hectar'; From f5d16d96b6e2e66c0c4e0a1ea5f4c27225b461fd Mon Sep 17 00:00:00 2001 From: Kamassau Date: Mon, 21 Aug 2023 12:08:53 +0200 Subject: [PATCH 13/16] Fix typo and protein_id --- imports/api/genes/hectar/hectar.test.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/imports/api/genes/hectar/hectar.test.js b/imports/api/genes/hectar/hectar.test.js index c63e74b3..dbc210f8 100644 --- a/imports/api/genes/hectar/hectar.test.js +++ b/imports/api/genes/hectar/hectar.test.js @@ -32,7 +32,7 @@ describe('hectar', function testHectar() { addTestGenome(annot = true); const hectarParams = { - fileName: 'assets/app/data/Bnigra_hectar.tsv', + fileName: 'assets/app/data/Bnigra_hectar.tab', }; // Should fail for non-logged in @@ -49,7 +49,7 @@ describe('hectar', function testHectar() { chai.assert.equal(result.nInserted, 1) - const hecs = hectarCollection.find({ protein_id: 'BniB01g000010.2N.1-P' }).fetch(); + const hecs = hectarCollection.find({ protein_id: 'BniB01g000010.2N.1' }).fetch(); chai.assert.lengthOf(hecs, 1, 'No hectar data found'); From 5c65623b1e1d542ab44e0b94c1c34a2fe1adf856 Mon Sep 17 00:00:00 2001 From: mboudet Date: Tue, 19 Sep 2023 16:30:56 +0200 Subject: [PATCH 14/16] Update fetchDbxref.js --- imports/api/methods/fetchDbxref.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/imports/api/methods/fetchDbxref.js b/imports/api/methods/fetchDbxref.js index 64e0f47f..90f6e300 100644 --- a/imports/api/methods/fetchDbxref.js +++ b/imports/api/methods/fetchDbxref.js @@ -25,7 +25,7 @@ const fetchDbxref = new ValidatedMethod({ switch (true) { case DBXREF_REGEX.go.test(dbxrefId): publicUrl = `http://amigo.geneontology.org/amigo/term/${dbxrefId}`; - apiUrl = `http://api.geneontology.org/api/bioentity/${dbxrefId}`; + apiUrl = `https://api.geneontology.org/api/go/${dbxrefId}`; dbType = 'go'; break; case DBXREF_REGEX.interpro.test(dbxrefId): From c342f094e5abbbb11fcf832494ee1aae5cb78727 Mon Sep 17 00:00:00 2001 From: mboudet Date: Tue, 19 Sep 2023 16:58:27 +0200 Subject: [PATCH 15/16] Update CHANGELOG.md --- CHANGELOG.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 53e85e28..6f66b44d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,16 @@ 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.5] 2023-09-19 + +### Added + +- Added Hector loader + +### Changed + +- Changed GO API url due to changes + ## [0.4.4] 2023-06-23 ### Changed From 9c77c8c45ff6a5430f5e3dd253beef589040cd2a Mon Sep 17 00:00:00 2001 From: mboudet Date: Tue, 19 Sep 2023 16:59:28 +0200 Subject: [PATCH 16/16] Update package.json --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 9881af92..fd490b65 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "genoboo", - "version": "0.4.4", + "version": "0.4.5", "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",