Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
minerva
core
Commits
8b368097
Commit
8b368097
authored
Jul 05, 2018
by
Piotr Gawron
Browse files
vcf file created for variants doesn't include nulls
parent
a816341e
Changes
3
Hide whitespace changes
Inline
Side-by-side
frontend-js/src/main/js/map/data/GeneVariant.js
View file @
8b368097
"
use strict
"
;
/**
*
* @param {Object} javaObject
* @param {number} javaObject.position
* @param {string} javaObject.originalDna
* @param {string} javaObject.modifiedDna
* @param {string} javaObject.referenceGenomeType
* @param {string} javaObject.referenceGenomeVersion
* @param {string} javaObject.contig
* @param {null|number} [javaObject.allelFrequency]
* @param {null|string} [javaObject.variantIdentifier]
*
* @constructor
*/
function
GeneVariant
(
javaObject
)
{
this
.
setPosition
(
javaObject
.
position
);
this
.
setOriginalDna
(
javaObject
.
originalDna
);
...
...
@@ -11,68 +25,139 @@ function GeneVariant(javaObject) {
this
.
setVariantIdentifier
(
javaObject
.
variantIdentifier
);
}
GeneVariant
.
prototype
.
setPosition
=
function
(
position
)
{
/**
*
* @param {number} position
*/
GeneVariant
.
prototype
.
setPosition
=
function
(
position
)
{
this
.
_position
=
position
;
};
GeneVariant
.
prototype
.
getPosition
=
function
()
{
/**
*
* @returns {number}
*/
GeneVariant
.
prototype
.
getPosition
=
function
()
{
return
this
.
_position
;
};
GeneVariant
.
prototype
.
setOriginalDna
=
function
(
originalDna
)
{
/**
*
* @param {string} originalDna
*/
GeneVariant
.
prototype
.
setOriginalDna
=
function
(
originalDna
)
{
this
.
_original
=
originalDna
;
};
GeneVariant
.
prototype
.
getOriginalDna
=
function
()
{
/**
*
* @returns {string}
*/
GeneVariant
.
prototype
.
getOriginalDna
=
function
()
{
return
this
.
_original
;
};
GeneVariant
.
prototype
.
setModifiedDna
=
function
(
modifiedDna
)
{
/**
*
* @param {string} modifiedDna
*/
GeneVariant
.
prototype
.
setModifiedDna
=
function
(
modifiedDna
)
{
this
.
_modifiedDna
=
modifiedDna
;
};
GeneVariant
.
prototype
.
getModifiedDna
=
function
()
{
/**
*
* @returns {string}
*/
GeneVariant
.
prototype
.
getModifiedDna
=
function
()
{
return
this
.
_modifiedDna
;
};
GeneVariant
.
prototype
.
setContig
=
function
(
contig
)
{
/**
*
* @param {string} contig
*/
GeneVariant
.
prototype
.
setContig
=
function
(
contig
)
{
this
.
_contig
=
contig
;
};
GeneVariant
.
prototype
.
getContig
=
function
()
{
/**
*
* @returns {string}
*/
GeneVariant
.
prototype
.
getContig
=
function
()
{
return
this
.
_contig
;
};
GeneVariant
.
prototype
.
setAllelFrequency
=
function
(
allelFrequency
)
{
this
.
_allelFrequency
=
allelFrequency
;
/**
*
* @param {number} allelFrequency
*/
GeneVariant
.
prototype
.
setAllelFrequency
=
function
(
allelFrequency
)
{
if
(
allelFrequency
===
null
)
{
this
.
_allelFrequency
=
undefined
;
}
else
{
this
.
_allelFrequency
=
allelFrequency
;
}
};
GeneVariant
.
prototype
.
getAllelFrequency
=
function
()
{
/**
*
* @returns {number}
*/
GeneVariant
.
prototype
.
getAllelFrequency
=
function
()
{
return
this
.
_allelFrequency
;
};
GeneVariant
.
prototype
.
setVariantIdentifier
=
function
(
variantIdentifier
)
{
this
.
_variantIdentifier
=
variantIdentifier
;
/**
*
* @param {string} variantIdentifier
*/
GeneVariant
.
prototype
.
setVariantIdentifier
=
function
(
variantIdentifier
)
{
if
(
variantIdentifier
===
null
)
{
this
.
_variantIdentifier
=
undefined
;
}
else
{
this
.
_variantIdentifier
=
variantIdentifier
;
}
};
GeneVariant
.
prototype
.
getVariantIdentifier
=
function
()
{
/**
*
* @returns {string}
*/
GeneVariant
.
prototype
.
getVariantIdentifier
=
function
()
{
return
this
.
_variantIdentifier
;
};
GeneVariant
.
prototype
.
setReferenceGenomeType
=
function
(
referenceGenomeType
)
{
/**
*
* @param {string} referenceGenomeType
*/
GeneVariant
.
prototype
.
setReferenceGenomeType
=
function
(
referenceGenomeType
)
{
this
.
_referenceGenomeType
=
referenceGenomeType
;
};
GeneVariant
.
prototype
.
getReferenceGenomeType
=
function
()
{
/**
*
* @returns {string}
*/
GeneVariant
.
prototype
.
getReferenceGenomeType
=
function
()
{
return
this
.
_referenceGenomeType
;
};
GeneVariant
.
prototype
.
setReferenceGenomeVersion
=
function
(
referenceGenomeVersion
)
{
/**
*
* @param {string} referenceGenomeVersion
*/
GeneVariant
.
prototype
.
setReferenceGenomeVersion
=
function
(
referenceGenomeVersion
)
{
this
.
_referenceGenomeVersion
=
referenceGenomeVersion
;
};
GeneVariant
.
prototype
.
getReferenceGenomeVersion
=
function
()
{
/**
*
* @returns {string}
*/
GeneVariant
.
prototype
.
getReferenceGenomeVersion
=
function
()
{
return
this
.
_referenceGenomeVersion
;
};
...
...
frontend-js/src/main/js/map/window/AliasInfoWindow.js
View file @
8b368097
...
...
@@ -355,15 +355,15 @@ AliasInfoWindow.prototype.createGenomicDiv = function () {
if
(
genomeUrls
.
length
===
0
)
{
contentElement
.
innerHTML
=
"
No reference genome data available on minerva platform
"
;
}
else
{
for
(
var
i
ter
=
0
;
i
ter
<
self
.
layoutAliases
.
length
;
i
ter
++
)
{
if
(
globalGeneVariants
[
i
ter
].
length
>
0
)
{
var
vcfContent
=
self
.
createVcfString
(
globalGeneVariants
[
i
ter
]);
for
(
var
i
=
0
;
i
<
self
.
layoutAliases
.
length
;
i
++
)
{
if
(
globalGeneVariants
[
i
].
length
>
0
)
{
var
vcfContent
=
self
.
createVcfString
(
globalGeneVariants
[
i
]);
pileupSource
.
push
({
viz
:
pileup
.
viz
.
variants
(),
data
:
pileup
.
formats
.
vcf
({
content
:
vcfContent
}),
name
:
self
.
layoutNames
[
i
ter
]
+
'
- Variants
'
,
name
:
self
.
layoutNames
[
i
]
+
'
- Variants
'
,
options
:
{
variantHeightByFrequency
:
true
}
...
...
frontend-js/src/test/js/map/window/AliasInfoWindow-test.js
View file @
8b368097
...
...
@@ -8,6 +8,7 @@ var functions = require('../../../../main/js/Functions');
var
Alias
=
require
(
'
../../../../main/js/map/data/Alias
'
);
var
Drug
=
require
(
'
../../../../main/js/map/data/Drug
'
);
var
GeneVariant
=
require
(
'
../../../../main/js/map/data/GeneVariant
'
);
var
AliasInfoWindow
=
require
(
'
../../../../main/js/map/window/AliasInfoWindow
'
);
var
IdentifiedElement
=
require
(
'
../../../../main/js/map/data/IdentifiedElement
'
);
var
DataOverlay
=
require
(
'
../../../../main/js/map/data/DataOverlay
'
);
...
...
@@ -361,4 +362,37 @@ describe('AliasInfoWindow', function () {
});
});
it
(
"
createVcfString
"
,
function
()
{
var
map
=
helper
.
createCustomMap
();
var
alias
=
helper
.
createAlias
(
map
);
var
aliasWindow
=
new
AliasInfoWindow
({
alias
:
alias
,
map
:
map
,
marker
:
helper
.
createMarker
({
element
:
alias
,
map
:
map
})
});
var
nullVal
=
null
;
var
variant
=
new
GeneVariant
({
contig
:
"
11
"
,
modifiedDna
:
"
T
"
,
originalDna
:
"
C
"
,
position
:
233067
,
referenceGenomeType
:
"
UCSC
"
,
referenceGenomeVersion
:
"
hg19
"
,
allelFrequency
:
nullVal
,
variantIdentifier
:
nullVal
});
var
variant2
=
new
GeneVariant
({
contig
:
"
11
"
,
modifiedDna
:
"
T
"
,
originalDna
:
"
C
"
,
position
:
233068
,
referenceGenomeType
:
"
UCSC
"
,
referenceGenomeVersion
:
"
hg19
"
});
var
str
=
aliasWindow
.
createVcfString
([
variant
,
variant2
]);
assert
.
ok
(
str
.
indexOf
(
"
null
"
)
===
-
1
,
"
null shouldn't appear in vcf format
"
);
});
});
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment