genoverse 4.0.7 → 4.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "genoverse",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.8",
|
|
4
4
|
"description": "Genoverse is a portable, customizable, back-end independent JavaScript and HTML5 based genome browser which allows the user to explore data in a dynamic and interactive manner.",
|
|
5
5
|
"main": "src/js/Genoverse.js",
|
|
6
6
|
"directories": {
|
|
@@ -1,46 +1,64 @@
|
|
|
1
1
|
import View from '../Gene';
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* Provides a function setFeatureColor for defining the feature colour and legend label
|
|
5
|
+
* for ensembl genes and transcripts based on their logic_name and biotype properties.
|
|
6
|
+
*
|
|
7
|
+
* Biotypes are defined in
|
|
8
|
+
* https://www.ensembl.org/info/genome/genebuild/biotypes.html
|
|
9
|
+
*
|
|
10
|
+
* Ensembl colours are defined in
|
|
11
|
+
* https://github.com/Ensembl/ensembl-webcode/blob/main/conf/ini-files/COLOUR.ini
|
|
12
|
+
*/
|
|
13
|
+
|
|
3
14
|
export default View.extend({
|
|
4
15
|
setFeatureColor: function (feature) {
|
|
5
16
|
const processedTranscript = {
|
|
6
|
-
'sense_intronic'
|
|
7
|
-
'sense_overlapping'
|
|
8
|
-
'processed_transcript'
|
|
9
|
-
'nonsense_mediated_decay'
|
|
10
|
-
'non_stop_decay'
|
|
11
|
-
'antisense'
|
|
12
|
-
'retained_intron'
|
|
13
|
-
'tec'
|
|
14
|
-
'non_coding'
|
|
15
|
-
'ambiguous_orf'
|
|
16
|
-
'disrupted_domain'
|
|
17
|
-
'3prime_overlapping_ncrna'
|
|
17
|
+
'sense_intronic' : 1,
|
|
18
|
+
'sense_overlapping' : 1,
|
|
19
|
+
'processed_transcript' : 1,
|
|
20
|
+
'nonsense_mediated_decay' : 1,
|
|
21
|
+
'non_stop_decay' : 1,
|
|
22
|
+
'antisense' : 1,
|
|
23
|
+
'retained_intron' : 1,
|
|
24
|
+
'tec' : 1,
|
|
25
|
+
'non_coding' : 1,
|
|
26
|
+
'ambiguous_orf' : 1,
|
|
27
|
+
'disrupted_domain' : 1,
|
|
28
|
+
'3prime_overlapping_ncrna' : 1,
|
|
29
|
+
'protein_coding_CDS_not_defined' : 1, // new in e108
|
|
18
30
|
};
|
|
19
31
|
|
|
20
32
|
feature.color = '#000000';
|
|
21
33
|
|
|
22
|
-
|
|
34
|
+
const logicName = feature.logic_name || '';
|
|
35
|
+
const biotype = (feature.biotype || '').toLowerCase();
|
|
36
|
+
|
|
37
|
+
if (logicName.indexOf('ensembl_havana') === 0) {
|
|
23
38
|
feature.color = '#CD9B1D';
|
|
24
39
|
feature.labelColor = '#B78000';
|
|
25
40
|
feature.legend = 'Merged Ensembl/Havana';
|
|
26
|
-
} else if (processedTranscript[
|
|
41
|
+
} else if (processedTranscript[biotype]) {
|
|
27
42
|
feature.color = '#0000FF';
|
|
28
43
|
feature.legend = 'Processed transcript';
|
|
29
|
-
} else if (feature.biotype
|
|
44
|
+
} else if (feature.biotype.indexOf('protein_coding') > -1) {
|
|
30
45
|
feature.color = '#A00000';
|
|
31
46
|
feature.legend = 'Protein coding';
|
|
32
|
-
} else if (feature.biotype.indexOf('pseudogene') > -1) {
|
|
47
|
+
} else if (feature.biotype === 'artifact' || biotype.indexOf('pseudogene') > -1) {
|
|
33
48
|
feature.color = '#666666';
|
|
34
49
|
feature.legend = 'Pseudogene';
|
|
35
|
-
} else if (/rna
|
|
50
|
+
} else if (/rna/.test(biotype) || biotype === 'ribozyme') {
|
|
36
51
|
feature.color = '#8B668B';
|
|
37
52
|
feature.legend = 'RNA gene';
|
|
38
|
-
} else if (/^
|
|
53
|
+
} else if (/^tr(?:_.+)?_gene$/.test(biotype)) {
|
|
39
54
|
feature.color = '#CD6600';
|
|
40
55
|
feature.legend = 'TR gene';
|
|
41
|
-
} else if (/^ig_.+_gene
|
|
56
|
+
} else if (/^ig_.+_gene$/.test(biotype)) {
|
|
42
57
|
feature.color = '#8B4500';
|
|
43
58
|
feature.legend = 'IG gene';
|
|
59
|
+
} else if (biotype === 'lrg_gene') {
|
|
60
|
+
feature.color = '#8080FF';
|
|
61
|
+
feature.legend = 'LRG gene';
|
|
44
62
|
}
|
|
45
63
|
|
|
46
64
|
feature.labelColor = feature.labelColor || feature.color;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
const { $, Genoverse, afterTest } = require('../utils');
|
|
2
|
+
|
|
3
|
+
describe('All ensembl biotypes should be categorised by setFeatureColor:', () => {
|
|
4
|
+
afterEach(afterTest);
|
|
5
|
+
|
|
6
|
+
// select * from (select distinct(biotype) from transcript union select distinct(biotype) from gene) biotypes order by biotype;
|
|
7
|
+
const ensemblBiotypes = [ 'artifact', 'IG_C_gene', 'IG_C_pseudogene', 'IG_D_gene', 'IG_J_gene', 'IG_J_pseudogene', 'IG_pseudogene', 'IG_V_gene', 'IG_V_pseudogene', 'lncRNA', 'LRG_gene', 'miRNA', 'misc_RNA', 'Mt_rRNA', 'Mt_tRNA', 'nonsense_mediated_decay', 'non_stop_decay', 'processed_pseudogene', 'processed_transcript', 'protein_coding', 'protein_coding_LoF', 'pseudogene', 'retained_intron', 'ribozyme', 'rRNA', 'rRNA_pseudogene', 'scaRNA', 'scRNA', 'snoRNA', 'snRNA', 'sRNA', 'TEC', 'transcribed_processed_pseudogene', 'transcribed_unitary_pseudogene', 'transcribed_unprocessed_pseudogene', 'translated_processed_pseudogene', 'translated_unprocessed_pseudogene', 'TR_C_gene', 'TR_D_gene', 'TR_J_gene', 'TR_J_pseudogene', 'TR_V_gene', 'TR_V_pseudogene', 'unitary_pseudogene', 'unprocessed_pseudogene', 'vault_RNA' ];
|
|
8
|
+
|
|
9
|
+
ensemblBiotypes.forEach(
|
|
10
|
+
biotype => it(
|
|
11
|
+
`${biotype} should be categorised by setFeatureColor`, () => {
|
|
12
|
+
const feature = { logic_name: '', biotype: biotype };
|
|
13
|
+
|
|
14
|
+
const [ track ] = new Genoverse({
|
|
15
|
+
chr : 1,
|
|
16
|
+
start : 1,
|
|
17
|
+
end : 100,
|
|
18
|
+
chromosomeSize : 100,
|
|
19
|
+
tracks : [ Genoverse.Track.Gene.extend($.extend(true, {}, { data: [ feature ] })) ],
|
|
20
|
+
}).tracks;
|
|
21
|
+
|
|
22
|
+
track.view.setFeatureColor(feature);
|
|
23
|
+
|
|
24
|
+
expect(feature.legend).toBeDefined();
|
|
25
|
+
}
|
|
26
|
+
)
|
|
27
|
+
);
|
|
28
|
+
});
|