Skip to content

Commit 7b4df1f

Browse files
authored
Merge pull request #71 from gogepp/dev
Release v0.4.16
2 parents e45eba9 + 6cc5ac8 commit 7b4df1f

5 files changed

Lines changed: 41 additions & 6 deletions

File tree

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ 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.16] 2024-06-12
9+
10+
- Better management for mongo error when adding annotation
11+
- Manage empty genes (no subentities)
12+
- Manage CDS with same IDs in the same gene
13+
814
## [0.4.15] 2024-04-05
915

1016
### Fixed

imports/api/genomes/annotation/addAnnotation.test.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,15 @@ describe('AddAnnotation', function testAnnotation() {
6363
chai.assert.equal(gene.start, 13640);
6464
chai.assert.equal(gene.end, 15401);
6565

66-
chai.assert.lengthOf(gene.subfeatures, 13, 'Number of subfeatures is not 13');
66+
chai.assert.lengthOf(gene.subfeatures, 14, 'Number of subfeatures is not 14');
67+
68+
// Check CDS with the same ID
69+
has_default_cds = gene.subfeatures.some((sub) => sub.type == "CDS" && sub.ID == "Bni|B01g000010.2N.1.cds1")
70+
has_new_cds = gene.subfeatures.some((sub) => sub.type == "CDS" && sub.ID == "Bni|B01g000010.2N.1.cds1.1")
71+
72+
chai.assert.isTrue(has_default_cds, "Bni|B01g000010.2N.1.cds1 was not found")
73+
chai.assert.isTrue(has_default_cds, "Bni|B01g000010.2N.1.cds1.1 was not found")
74+
6775
});
6876

6977
it('Should add multiple copies of genes with different annotation names', function addAnnotationGff3() {

imports/api/genomes/annotation/parser/annotationParserGff3.js

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ class AnnotationProcessor {
5151
// (this.IdParents[parents[0]] in addChildren function).
5252
this.IdParents = {};
5353
this.indexIdParent = 0;
54+
55+
this.cds_ids = {};
5456
}
5557

5658
/**
@@ -358,6 +360,8 @@ class AnnotationProcessor {
358360
features.attributes,
359361
);
360362
this.geneLevelHierarchy.attributes = attributesFiltered;
363+
364+
this.geneLevelHierarchy.subfeatures = [];
361365
} else {
362366
// Create an array if not exists for the subfeatures (exons, cds ...) of
363367
// the gene.
@@ -387,7 +391,18 @@ class AnnotationProcessor {
387391
);
388392
}
389393

390-
const identifiant = features.ID
394+
let identifiant = features.ID
395+
396+
// Manage case of discontinuous CDS: Same ID -> we add a suffix to avoid crashing
397+
if (typeAttr === 'CDS'){
398+
if (identifiant in this.cds_ids){
399+
identifiant = identifiant + "." + this.cds_ids[identifiant]
400+
this.cds_ids[identifiant] += 1
401+
} else {
402+
this.cds_ids[identifiant] = 1
403+
}
404+
}
405+
391406
let proteinID
392407

393408
// Complete ID parents.
@@ -446,7 +461,7 @@ class AnnotationProcessor {
446461
GeneSchema.validate(geneWithoutId);
447462
} catch (err) {
448463
logger.error(err)
449-
throw new Error('There is something wrong with the gene collection schema');
464+
throw new Error('Current gene is not valid, stopping');
450465
}
451466
return true;
452467
};
@@ -528,7 +543,7 @@ class AnnotationProcessor {
528543
// Increment.
529544
this.nAnnotation += 1;
530545

531-
const protein_ids = this.geneLevelHierarchy.subfeatures.flatMap(children => {
546+
const protein_ids = this.geneLevelHierarchy.subfeatures.flatMap(children => {
532547
if(typeof children.protein_id === 'undefined'){
533548
return []
534549
} else {
@@ -538,6 +553,9 @@ class AnnotationProcessor {
538553

539554
this.geneLevelHierarchy.children = this.geneLevelHierarchy.children.concat(protein_ids)
540555

556+
// Validate schema before adding to bulk
557+
this.isValidateGeneSchema();
558+
541559
// Add to bulk operation.
542560
this.geneBulkOperation.insert(this.geneLevelHierarchy)
543561

@@ -547,14 +565,16 @@ class AnnotationProcessor {
547565
this.shiftSequence = 0;
548566
this.IdParents = {};
549567
this.indexIdParent = 0;
568+
this.cds_ids = {};
550569

551570
// Init new gene.
552571
this.initGeneHierarchy(features);
553572

554573
// Arbitrary break up of batch size to save ram
555574
if (this.geneBulkOperation.length > 500) {
556575
this.isReset = true
557-
return this.geneBulkOperation.execute();
576+
let execute = Meteor.wrapAsync(this.geneBulkOperation.execute, this.geneBulkOperation);
577+
return execute()
558578
}
559579
}
560580
} else {

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.15",
3+
"version": "0.4.16",
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",

private/data/Bnigra.gff3

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ B1 AAFC_GIFS exon 14210 14284 . - . ID=Bni%7CB01g000010.2N.1.exon4;Parent=Bni%7C
88
B1 AAFC_GIFS exon 13970 14062 . - . ID=Bni%7CB01g000010.2N.1.exon5;Parent=Bni%7CB01g000010.2N.1
99
B1 AAFC_GIFS exon 13640 13870 . - . ID=Bni%7CB01g000010.2N.1.exon6;Parent=Bni%7CB01g000010.2N.1
1010
B1 AAFC_GIFS CDS 14702 15401 . - 0 ID=Bni%7CB01g000010.2N.1.cds1;Parent=Bni%7CB01g000010.2N.1
11+
B1 AAFC_GIFS CDS 14702 15401 . - 0 ID=Bni%7CB01g000010.2N.1.cds1;Parent=Bni%7CB01g000010.2N.1
1112
B1 AAFC_GIFS CDS 14557 14636 . - 2 ID=Bni%7CB01g000010.2N.1.cds2;Parent=Bni%7CB01g000010.2N.1
1213
B1 AAFC_GIFS CDS 14403 14486 . - 0 ID=Bni%7CB01g000010.2N.1.cds3;Parent=Bni%7CB01g000010.2N.1
1314
B1 AAFC_GIFS CDS 14210 14284 . - 0 ID=Bni%7CB01g000010.2N.1.cds4;Parent=Bni%7CB01g000010.2N.1

0 commit comments

Comments
 (0)