Commit c737e516 authored by Piotr Gawron's avatar Piotr Gawron
Browse files

gene variants can store information about amino acid change

parent a89e2f70
Pipeline #6546 failed with stage
in 6 minutes and 39 seconds
......@@ -9,7 +9,8 @@
* @param {string} javaObject.referenceGenomeType
* @param {string} javaObject.referenceGenomeVersion
* @param {string} javaObject.contig
* @param {null|number} [javaObject.allelFrequency]
* @param {string} [javaObject.aminoAcidChange]
* @param {null|string} [javaObject.allelFrequency]
* @param {null|string} [javaObject.variantIdentifier]
*
* @constructor
......@@ -23,8 +24,25 @@ function GeneVariant(javaObject) {
this.setContig(javaObject.contig);
this.setAllelFrequency(javaObject.allelFrequency);
this.setVariantIdentifier(javaObject.variantIdentifier);
this.setAminoAcidChange(javaObject.aminoAcidChange);
}
/**
*
* @param {string} aminoAcidChange
*/
GeneVariant.prototype.setAminoAcidChange = function (aminoAcidChange) {
this._aminoAcidChange = aminoAcidChange;
};
/**
*
* @returns {string}
*/
GeneVariant.prototype.getAminoAcidChange = function () {
return this._aminoAcidChange;
};
/**
*
* @param {number} position
......@@ -91,13 +109,13 @@ GeneVariant.prototype.getContig = function () {
/**
*
* @param {number} allelFrequency
* @param {string} allelFrequency
*/
GeneVariant.prototype.setAllelFrequency = function (allelFrequency) {
if (allelFrequency === null) {
this._allelFrequency = undefined;
} else {
this._allelFrequency = allelFrequency;
this._allelFrequency = parseFloat(allelFrequency);
}
};
......
......@@ -5,6 +5,7 @@ var assert = require('assert');
describe('GeneVariant', function () {
it("constructor", function () {
// noinspection SpellCheckingInspection
var data = {
position: 12,
originalDna: "A",
......@@ -13,7 +14,8 @@ describe('GeneVariant', function () {
referenceGenomeVersion: "v1",
contig: "1",
allelFrequency: "0.2",
variantIdentifier: "id"
variantIdentifier: "id",
aminoAcidChange: "LRRK2:NM_198578:exon1:c.T45C:p.T15T"
};
var variant = new GeneVariant(data);
assert.equal(variant.getPosition(), data.position);
......@@ -24,5 +26,6 @@ describe('GeneVariant', function () {
assert.equal(variant.getAllelFrequency(), data.allelFrequency);
assert.equal(variant.getVariantIdentifier(), data.variantIdentifier);
assert.equal(variant.getReferenceGenomeVersion(), data.referenceGenomeVersion);
assert.equal(variant.getAminoAcidChange(), data.aminoAcidChange);
});
});
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment