Skip to content
Snippets Groups Projects
Commit a6e2c39a authored by Piotr Gawron's avatar Piotr Gawron
Browse files

gene variant allel frequency support added

parent 8def8394
No related branches found
No related tags found
1 merge request!5Frontend refactor
......@@ -41,6 +41,9 @@ public class GeneVariation implements Serializable {
*/
private String contig;
private String allelFrequency;
private String variantIdentifier;
/**
* Reference genome type.
*/
......@@ -70,6 +73,8 @@ public class GeneVariation implements Serializable {
this.setReferenceGenomeVersion(original.getReferenceGenomeVersion());
this.addReferences(original.getReferences());
this.setContig(original.getContig());
this.setAllelFrequency(original.getAllelFrequency());
this.setVariantIdentifier(original.getVariantIdentifier());
}
/**
......@@ -235,4 +240,38 @@ public class GeneVariation implements Serializable {
this.position = (long) position;
}
/**
* @return the allelFrequency
* @see #allelFrequency
*/
public String getAllelFrequency() {
return allelFrequency;
}
/**
* @param allelFrequency
* the allelFrequency to set
* @see #allelFrequency
*/
public void setAllelFrequency(String allelFrequency) {
this.allelFrequency = allelFrequency;
}
/**
* @return the variantIdentifier
* @see #variantIdentifier
*/
public String getVariantIdentifier() {
return variantIdentifier;
}
/**
* @param variantIdentifier
* the variantIdentifier to set
* @see #variantIdentifier
*/
public void setVariantIdentifier(String variantIdentifier) {
this.variantIdentifier = variantIdentifier;
}
}
......@@ -151,6 +151,8 @@ public class ColorSchemaReader {
Integer contigColumn = schemaColumns.get(ColorSchemaColumn.CONTIG);
Integer nameColumn = schemaColumns.get(ColorSchemaColumn.NAME);
Integer identifierColumn = schemaColumns.get(ColorSchemaColumn.IDENTIFIER);
Integer variantIdentifierColumn = schemaColumns.get(ColorSchemaColumn.VARIANT_IDENTIFIER);
Integer allelFrequencyColumn = schemaColumns.get(ColorSchemaColumn.ALLEL_FREQUENCY);
Integer compartmentColumn = schemaColumns.get(ColorSchemaColumn.COMPARTMENT);
Integer typeColumn = schemaColumns.get(ColorSchemaColumn.TYPE);
Integer positionColumn = schemaColumns.get(ColorSchemaColumn.POSITION);
......@@ -233,6 +235,12 @@ public class ColorSchemaReader {
if (originalDnaColumn != null) {
gv.setOriginalDna(values[originalDnaColumn]);
}
if (allelFrequencyColumn != null) {
gv.setAllelFrequency(values[allelFrequencyColumn]);
}
if (variantIdentifierColumn != null) {
gv.setVariantIdentifier(values[variantIdentifierColumn]);
}
if (alternativeDnaColumn != null) {
gv.setModifiedDna(values[alternativeDnaColumn]);
}
......
......@@ -97,6 +97,10 @@ public enum ColorSchemaColumn {
* Contig where variant was observed.
*/
CONTIG("contig", new ColorSchemaType[] { ColorSchemaType.GENETIC_VARIANT }), //
ALLEL_FREQUENCY("allel_frequency", new ColorSchemaType[] { ColorSchemaType.GENETIC_VARIANT }), //
VARIANT_IDENTIFIER("variant_identifier", new ColorSchemaType[] { ColorSchemaType.GENETIC_VARIANT }), //
/**
* Should the direction of reaction be reversed.
......
......@@ -99,6 +99,39 @@ public class ColorSchemaReaderTest extends ServiceTestFunctions {
}
}
@Test
public void testReadGeneVariantsSchemaWithAF() throws Exception {
try {
File f = new File("testFiles/coloring/gene_variants_all_freq.txt");
InputStream in = new FileInputStream(f);
byte[] buff = new byte[8000];
int bytesRead = 0;
ByteArrayOutputStream bao = new ByteArrayOutputStream();
while ((bytesRead = in.read(buff)) != -1) {
bao.write(buff, 0, bytesRead);
}
in.close();
bao.close();
byte[] data = bao.toByteArray();
ByteArrayInputStream bin = new ByteArrayInputStream(data);
ColorSchemaReader reader = new ColorSchemaReader();
Collection<ColorSchema> schemas = reader.readColorSchema(bin, TextFileUtils.getHeaderParametersFromFile(new ByteArrayInputStream(data)));
assertNotNull(schemas);
assertEquals(2, schemas.size());
} catch (Exception e) {
e.printStackTrace();
throw e;
}
}
@Test
public void testReadInvalidGeneVariantsSchema() throws Exception {
try {
......
#TYPE=GENETIC_VARIANT
#GENOME_TYPE=UCSC
#GENOME_VERSION=hg38
position original_dna alternative_dna name description color contig allel_frequency variant_identifier
10146 AC A DDX11L1 upstream #ff0000 chr1 0.8 identifier_1
10439 AC A DDX11L1;WASH7P upstream;downstream #ff0001 chr1 0.5 identifier_2
10441 AC A DDX11L1;WASH7P upstream;downstream #ff0001 chr1 0.2 identifier_3
10443 AC A DDX11L1;WASH7P upstream;downstream #ff0001 chr1 0.9 identifier_4
/**
* Class representing info window that should be opened when clicking on alias.
*/
function AliasInfoWindow(alias, map) {
// call super constructor
AbstractInfoWindow.call(this, alias, map);
if (alias instanceof AliasMarker) {
this.alias = alias.getAliasData();
} else {
this.alias = alias;
}
var self = this;
if (this.alias != null) {
var point = new google.maps.Point(this.alias.x + this.alias.width / 2,
this.alias.y + this.alias.height / 2);
var latLng = this.customMap.fromPointToLatLng(point);
this.googleInfowindow = new google.maps.InfoWindow({
content : this.content,
position : latLng
});
this.googleInfowindow.open(this.customMap.map, this.getGoogleMarker());
} else {
logger.warn("Opening window without alias specified");
}
this.update(alias);
};
AliasInfoWindow.prototype = Object.create(AbstractInfoWindow.prototype);
AliasInfoWindow.prototype.constructor = AliasInfoWindow;
/**
* Updates content of info window. The content will be automatically obtained
* from {@link CustomMap} instance. The only optional parameter is {@link Alias}
* data.
*
* @param newAlias
* optional {@link Alias} data for which this {@link AliasInfoWindow}
* was created
*/
AliasInfoWindow.prototype.update = function(newAlias) {
if (this.alias == null && newAlias != null) {
this.alias = newAlias;
}
this._updateContent();
};
/**
* Creates and returns chart representing data related to alias on different
* layouts.
*
* @returns {String} html string representing chart with data related to alias
* on different layouts
*/
AliasInfoWindow.prototype.createChartDiv = function() {
var result = document.createElement("div");
for (var i = 0; i < this.layoutAliases.length; i++) {
var rowDiv = document.createElement("div");
if (i % 2 == 0) {
rowDiv.className = "mapChartRowEvenDiv";
} else {
rowDiv.className = "mapChartRowOddDiv";
}
var data = this.layoutAliases[i];
var nameDiv = document.createElement("div");
nameDiv.className = "mapChartNameDiv";
nameDiv.innerHTML = this.layoutNames[i];
rowDiv.appendChild(nameDiv);
if (data != null) {
var value = parseFloat(data.value);
var color = intToColorString(data.color.value);
var leftMarginDiv = document.createElement("div");
leftMarginDiv.innerHTML = "&nbsp;";
leftMarginDiv.style.float = "left";
var centerBarDiv = document.createElement("div");
centerBarDiv.style.width = "1px";
centerBarDiv.style.float = "left";
centerBarDiv.style.background = "#000000";
centerBarDiv.innerHTML = "&nbsp;";
var rightBarDiv = document.createElement("div");
rightBarDiv.innerHTML = "&nbsp;";
rightBarDiv.style.float = "left";
rightBarDiv.style.background = color;
rightBarDiv.style.width = Math.abs(value * 100) + "px";
if (!isNaN(value)) {
rightBarDiv.innerHTML = value.toFixed(2);
if (value > 0) {
var offset = 100;
leftMarginDiv.style.width = offset + "px";
rightBarDiv.style.textAlign = "right";
rowDiv.appendChild(leftMarginDiv);
rowDiv.appendChild(centerBarDiv);
rowDiv.appendChild(rightBarDiv);
} else {
var offset = 100 + (value * 100);
leftMarginDiv.style.width = offset + "px";
rowDiv.appendChild(leftMarginDiv);
rowDiv.appendChild(rightBarDiv);
rowDiv.appendChild(centerBarDiv);
}
} else {
var offset = 100;
leftMarginDiv.style.width = offset + "px";
leftMarginDiv.style.background = color;
rightBarDiv.style.width = offset + "px";
rightBarDiv.style.background = color;
rowDiv.appendChild(leftMarginDiv);
rowDiv.appendChild(centerBarDiv);
rowDiv.appendChild(rightBarDiv);
}
} else {
var emptyDiv = document.createElement("div");
emptyDiv.innerHTML = "&nbsp;";
emptyDiv.style.float = "left";
emptyDiv.style.width = "201px";
rowDiv.appendChild(emptyDiv);
}
result.appendChild(rowDiv);
}
return result;
};
/**
* Methods that creates and return DOM object with the content of the window.
*
* @returns DOM object representing html code for content of the info window
*/
AliasInfoWindow.prototype.createContentDiv = function() {
if (this.alias != null && this.alias.completness == 'FULL') {
var result = document.createElement("div");
var title = document.createElement("h3");
title.innerHTML = this.alias.type + ": " + this.alias.name;
result.appendChild(title);
this.layoutAliases = this.customMap
.getAliasVisibleLayoutsData(this.alias.id);
this.layoutNames = this.customMap.getVisibleLayoutNames();
var selectedLayouts = this.customMap.getTopMap().getSelectedLayouts();
for (var i = 0; i < this.layoutAliases.length; i++) {
if (this.layoutAliases[i] != null) {
if (this.layoutAliases[i].getType() == LayoutAlias.LIGTH) {
if (!ServerConnector.isWaitingForFullAliasLayoutData(
parseInt(selectedLayouts[i]), parseInt(this.alias.getId()))) {
ServerConnector.retreiveFullAliasesForLayout(selectedLayouts[i],
this.alias.getId(), this.alias.getModelId());
}
}
}
}
var chartDiv = this.createChartDiv();
if (chartDiv !== null) {
result.appendChild(chartDiv);
}
var genomicDiv = this.createGenomicDiv();
if (genomicDiv !== null) {
result.appendChild(genomicDiv);
}
return result;
} else {
return null;
}
};
/**
* Returns array with data taken from all known {@link OverlayCollection}.
*
* @returns array with data from {@link OverlayCollection}
*/
AliasInfoWindow.prototype.getOverlaysData = function(general) {
if (this.alias != null) {
return this.getCustomMap().getTopMap().getOverlayDataForAlias(this.alias,
general);
} else {
return null;
}
};
/**
* Method returning identifier of the object for which this window was created.
*/
AliasInfoWindow.prototype.getElementId = function() {
if (this.alias != null) {
return this.alias.getId();
} else {
return null;
}
}
/**
* Method returning type of the object for which this window was created.
*/
AliasInfoWindow.prototype.getElementType = function() {
return "ALIAS";
};
AliasInfoWindow.prototype.createGenomicDiv = function() {
var result = document.createElement("div");
result.style.width = '640px';
var titleElement = document.createElement("h3");
titleElement.innerHTML = "Gene variants";
result.appendChild(titleElement);
var contentElement = document.createElement("div");
result.appendChild(contentElement);
var geneticInformation = false;
var genomes = [];
var pileupSource = [ {
viz : pileup.viz.scale(),
name : 'Scale'
}, {
viz : pileup.viz.location(),
name : 'Location'
} ];
var pileupRange = {
contig : 'chr1',
start : 3000000000,
stop : 0
};
var globalGeneVariants = [];
var missingGeneVariantsData = false;
for (var i = 0; i < this.layoutAliases.length; i++) {
var data = this.layoutAliases[i];
globalGeneVariants.push([]);
if (data != null && !missingGeneVariantsData) {
if (data.getType() == LayoutAlias.LIGHT || data.getType() == null) {
missingGeneVariantsData = true;
} else if (data.getType() == LayoutAlias.GENETIC_VARIANT) {
var geneVariants = data.getGeneVariants();
for (var j = 0; j < geneVariants.length; j++) {
if (!missingGeneVariantsData) {
var variant = geneVariants[j];
globalGeneVariants[i].push(variant);
var genome = this.getCustomMap().getReferenceGenome(
variant.getReferenceGenomeType(),
variant.getReferenceGenomeVersion());
if (variant.getContig() != null) {
pileupRange.contig = variant.getContig();
}
pileupRange.start = Math.min(pileupRange.start, variant
.getPosition());
var length = Math.max(variant.getModifiedDna().length, variant
.getOriginalDna().length);
pileupRange.stop = Math.max(pileupRange.stop, variant.getPosition()
+ length);
if (genome != null && genome.getUrl() != null) {
if (genomes[genome.getUrl()] == null) {
geneticInformation = true;
genomes[genome.getUrl()] = true;
pileupSource.splice(0, 0, {
viz : pileup.viz.genome(),
isReference : pileupSource.length == 2,
data : pileup.formats.twoBit({
url : genome.getUrl()
}),
name : 'Reference ' + variant.getReferenceGenomeVersion()
});
for (var k = 0; k < genome.getGeneMappings().length; k++) {
var mapping = genome.getGeneMappings()[k];
pileupSource.push({
viz : pileup.viz.genes(),
data : pileup.formats.bigBed({
url : mapping.getUrl()
}),
name : 'Genes ' + mapping.getName()
});
}
}
} else {
logger.debug("Genome for " + variant.getReferenceGenomeType()
+ "," + variant.getReferenceGenomeVersion() + " not loaded");
missingGeneVariantsData = true;
}
}
}
}
}
}
if (missingGeneVariantsData) {
geneticInformation = false;
}
if (geneticInformation) {
for (var i = 0; i < this.layoutAliases.length; i++) {
if (globalGeneVariants[i].length > 0) {
var vcfContent = this.createVcfString(globalGeneVariants[i]);
pileupSource.push({
viz : pileup.viz.variants(),
data : pileup.formats.vcf({
content : vcfContent
}),
name : this.layoutNames[i] + ' - Variants'
});
}
}
pileupRange.stop = Math.max(pileupRange.stop, pileupRange.start + 50);
pileupRange.start--;
pileupRange.stop++;
if (this.pileup != null) {
logger.debug("Destroy pileup");
this.pileup.destroy();
logger.debug("Pileup destroyed");
}
this.pileup = pileup.create(contentElement, {
range : pileupRange,
tracks : pileupSource
});
return result;
} else {
return null;
}
};
AliasInfoWindow.prototype.createVcfString = function(geneVariants) {
var result = "";
result += "##fileformat=VCFv4.0\n";
result += "#CHROM\tPOS\tID\tREF\tALT\tQUAL\tFILTER\tINFO\n";
for (var i = 0; i < geneVariants.length; i++) {
var variant = geneVariants[i];
result += variant.getContig() + "\t" + //
variant.getPosition() + "\t" + //
".\t" + //
variant.getOriginalDna() + "\t" + //
variant.getModifiedDna() + "\t" + //
"100.0\t" + //
"PASS\t" + //
"\n";
}
return result;
};
/**
* Class representing info window that should be opened when clicking on alias.
*/
function AliasInfoWindow(alias, map) {
// call super constructor
AbstractInfoWindow.call(this, alias, map);
if (alias instanceof AliasMarker) {
this.alias = alias.getAliasData();
} else {
this.alias = alias;
}
var self = this;
if (this.alias != null) {
var point = new google.maps.Point(this.alias.x + this.alias.width / 2,
this.alias.y + this.alias.height / 2);
var latLng = this.customMap.fromPointToLatLng(point);
this.googleInfowindow = new google.maps.InfoWindow({
content : this.content,
position : latLng
});
this.googleInfowindow.open(this.customMap.map, this.getGoogleMarker());
} else {
logger.warn("Opening window without alias specified");
}
this.update(alias);
};
AliasInfoWindow.prototype = Object.create(AbstractInfoWindow.prototype);
AliasInfoWindow.prototype.constructor = AliasInfoWindow;
/**
* Updates content of info window. The content will be automatically obtained
* from {@link CustomMap} instance. The only optional parameter is {@link Alias}
* data.
*
* @param newAlias
* optional {@link Alias} data for which this {@link AliasInfoWindow}
* was created
*/
AliasInfoWindow.prototype.update = function(newAlias) {
if (this.alias == null && newAlias != null) {
this.alias = newAlias;
}
this._updateContent();
};
/**
* Creates and returns chart representing data related to alias on different
* layouts.
*
* @returns {String} html string representing chart with data related to alias
* on different layouts
*/
AliasInfoWindow.prototype.createChartDiv = function() {
var result = document.createElement("div");
for (var i = 0; i < this.layoutAliases.length; i++) {
var rowDiv = document.createElement("div");
if (i % 2 == 0) {
rowDiv.className = "mapChartRowEvenDiv";
} else {
rowDiv.className = "mapChartRowOddDiv";
}
var data = this.layoutAliases[i];
var nameDiv = document.createElement("div");
nameDiv.className = "mapChartNameDiv";
nameDiv.innerHTML = this.layoutNames[i];
rowDiv.appendChild(nameDiv);
if (data != null) {
var value = parseFloat(data.value);
var color = intToColorString(data.color.value);
var leftMarginDiv = document.createElement("div");
leftMarginDiv.innerHTML = "&nbsp;";
leftMarginDiv.style.float = "left";
var centerBarDiv = document.createElement("div");
centerBarDiv.style.width = "1px";
centerBarDiv.style.float = "left";
centerBarDiv.style.background = "#000000";
centerBarDiv.innerHTML = "&nbsp;";
var rightBarDiv = document.createElement("div");
rightBarDiv.innerHTML = "&nbsp;";
rightBarDiv.style.float = "left";
rightBarDiv.style.background = color;
rightBarDiv.style.width = Math.abs(value * 100) + "px";
if (!isNaN(value)) {
rightBarDiv.innerHTML = value.toFixed(2);
if (value > 0) {
var offset = 100;
leftMarginDiv.style.width = offset + "px";
rightBarDiv.style.textAlign = "right";
rowDiv.appendChild(leftMarginDiv);
rowDiv.appendChild(centerBarDiv);
rowDiv.appendChild(rightBarDiv);
} else {
var offset = 100 + (value * 100);
leftMarginDiv.style.width = offset + "px";
rowDiv.appendChild(leftMarginDiv);
rowDiv.appendChild(rightBarDiv);
rowDiv.appendChild(centerBarDiv);
}
} else {
var offset = 100;
leftMarginDiv.style.width = offset + "px";
leftMarginDiv.style.background = color;
rightBarDiv.style.width = offset + "px";
rightBarDiv.style.background = color;
rowDiv.appendChild(leftMarginDiv);
rowDiv.appendChild(centerBarDiv);
rowDiv.appendChild(rightBarDiv);
}
} else {
var emptyDiv = document.createElement("div");
emptyDiv.innerHTML = "&nbsp;";
emptyDiv.style.float = "left";
emptyDiv.style.width = "201px";
rowDiv.appendChild(emptyDiv);
}
result.appendChild(rowDiv);
}
return result;
};
/**
* Methods that creates and return DOM object with the content of the window.
*
* @returns DOM object representing html code for content of the info window
*/
AliasInfoWindow.prototype.createContentDiv = function() {
if (this.alias != null && this.alias.completness == 'FULL') {
var result = document.createElement("div");
var title = document.createElement("h3");
title.innerHTML = this.alias.type + ": " + this.alias.name;
result.appendChild(title);
this.layoutAliases = this.customMap
.getAliasVisibleLayoutsData(this.alias.id);
this.layoutNames = this.customMap.getVisibleLayoutNames();
var selectedLayouts = this.customMap.getTopMap().getSelectedLayouts();
for (var i = 0; i < this.layoutAliases.length; i++) {
if (this.layoutAliases[i] != null) {
if (this.layoutAliases[i].getType() == LayoutAlias.LIGTH) {
if (!ServerConnector.isWaitingForFullAliasLayoutData(
parseInt(selectedLayouts[i]), parseInt(this.alias.getId()))) {
ServerConnector.retreiveFullAliasesForLayout(selectedLayouts[i],
this.alias.getId(), this.alias.getModelId());
}
}
}
}
var chartDiv = this.createChartDiv();
if (chartDiv !== null) {
result.appendChild(chartDiv);
}
var genomicDiv = this.createGenomicDiv();
if (genomicDiv !== null) {
result.appendChild(genomicDiv);
}
return result;
} else {
return null;
}
};
/**
* Returns array with data taken from all known {@link OverlayCollection}.
*
* @returns array with data from {@link OverlayCollection}
*/
AliasInfoWindow.prototype.getOverlaysData = function(general) {
if (this.alias != null) {
return this.getCustomMap().getTopMap().getOverlayDataForAlias(this.alias,
general);
} else {
return null;
}
};
/**
* Method returning identifier of the object for which this window was created.
*/
AliasInfoWindow.prototype.getElementId = function() {
if (this.alias != null) {
return this.alias.getId();
} else {
return null;
}
}
/**
* Method returning type of the object for which this window was created.
*/
AliasInfoWindow.prototype.getElementType = function() {
return "ALIAS";
};
AliasInfoWindow.prototype.createGenomicDiv = function() {
var result = document.createElement("div");
result.style.width = '640px';
var titleElement = document.createElement("h3");
titleElement.innerHTML = "Gene variants";
result.appendChild(titleElement);
var contentElement = document.createElement("div");
result.appendChild(contentElement);
var geneticInformation = false;
var genomes = [];
var pileupSource = [ {
viz : pileup.viz.scale(),
name : 'Scale'
}, {
viz : pileup.viz.location(),
name : 'Location'
} ];
var pileupRange = {
contig : 'chr1',
start : 3000000000,
stop : 0
};
var globalGeneVariants = [];
var missingGeneVariantsData = false;
for (var i = 0; i < this.layoutAliases.length; i++) {
var data = this.layoutAliases[i];
globalGeneVariants.push([]);
if (data != null && !missingGeneVariantsData) {
if (data.getType() == LayoutAlias.LIGHT || data.getType() == null) {
missingGeneVariantsData = true;
} else if (data.getType() == LayoutAlias.GENETIC_VARIANT) {
var geneVariants = data.getGeneVariants();
for (var j = 0; j < geneVariants.length; j++) {
if (!missingGeneVariantsData) {
var variant = geneVariants[j];
globalGeneVariants[i].push(variant);
var genome = this.getCustomMap().getReferenceGenome(
variant.getReferenceGenomeType(),
variant.getReferenceGenomeVersion());
if (variant.getContig() != null) {
pileupRange.contig = variant.getContig();
}
pileupRange.start = Math.min(pileupRange.start, variant
.getPosition());
var length = Math.max(variant.getModifiedDna().length, variant
.getOriginalDna().length);
pileupRange.stop = Math.max(pileupRange.stop, variant.getPosition()
+ length);
if (genome != null && genome.getUrl() != null) {
if (genomes[genome.getUrl()] == null) {
geneticInformation = true;
genomes[genome.getUrl()] = true;
pileupSource.splice(0, 0, {
viz : pileup.viz.genome(),
isReference : pileupSource.length == 2,
data : pileup.formats.twoBit({
url : genome.getUrl()
}),
name : 'Reference ' + variant.getReferenceGenomeVersion()
});
for (var k = 0; k < genome.getGeneMappings().length; k++) {
var mapping = genome.getGeneMappings()[k];
pileupSource.push({
viz : pileup.viz.genes(),
data : pileup.formats.bigBed({
url : mapping.getUrl()
}),
name : 'Genes ' + mapping.getName()
});
}
}
} else {
logger.debug("Genome for " + variant.getReferenceGenomeType()
+ "," + variant.getReferenceGenomeVersion() + " not loaded");
missingGeneVariantsData = true;
}
}
}
}
}
}
if (missingGeneVariantsData) {
geneticInformation = false;
}
if (geneticInformation) {
for (var i = 0; i < this.layoutAliases.length; i++) {
if (globalGeneVariants[i].length > 0) {
var vcfContent = this.createVcfString(globalGeneVariants[i]);
pileupSource.push({
viz : pileup.viz.variants(),
data : pileup.formats.vcf({
content : vcfContent
}),
name : this.layoutNames[i] + ' - Variants',
options : {
variantHeightByFrequency : true
},
});
}
}
pileupRange.stop = Math.max(pileupRange.stop, pileupRange.start + 50);
pileupRange.start--;
pileupRange.stop++;
if (this.pileup != null) {
logger.debug("Destroy pileup");
this.pileup.destroy();
logger.debug("Pileup destroyed");
}
this.pileup = pileup.create(contentElement, {
range : pileupRange,
tracks : pileupSource
});
return result;
} else {
return null;
}
};
AliasInfoWindow.prototype.createVcfString = function(geneVariants) {
var result = "";
result += "##fileformat=VCFv4.0\n";
result += "#CHROM\tPOS\tID\tREF\tALT\tQUAL\tFILTER\tINFO\n";
for (var i = 0; i < geneVariants.length; i++) {
var variant = geneVariants[i];
var additionalInfo = "";
if (variant.getAllelFrequency() != null) {
additionalInfo = "AF=" + variant.getAllelFrequency();
}
var variantId = ".";
if (variant.getVariantIdentifier() != null) {
variantId = variant.getVariantIdentifier();
}
result += variant.getContig() + "\t" + //
variant.getPosition() + "\t" + //
variantId + "\t" + //
variant.getOriginalDna() + "\t" + //
variant.getModifiedDna() + "\t" + //
"100.0\t" + //
"PASS\t" + //
additionalInfo + "\n";
}
return result;
};
......@@ -5,6 +5,8 @@ function GeneVariant(javaObject) {
this.setReferenceGenomeType(javaObject.referenceGenomeType);
this.setReferenceGenomeVersion(javaObject.referenceGenomeVersion);
this.setContig(javaObject.contig);
this.setAllelFrequency(javaObject.allelFrequency);
this.setVariantIdentifier(javaObject.variantIdentifier);
};
GeneVariant.prototype.setPosition = function(position) {
......@@ -39,6 +41,22 @@ GeneVariant.prototype.getContig = function() {
return this._contig;
};
GeneVariant.prototype.setAllelFrequency = function(allelFrequency) {
this._allelFrequency = allelFrequency;
};
GeneVariant.prototype.getAllelFrequency = function() {
return this._allelFrequency;
};
GeneVariant.prototype.setVariantIdentifier = function(variantIdentifier) {
this._variantIdentifier = variantIdentifier;
};
GeneVariant.prototype.getVariantIdentifier = function() {
return this._variantIdentifier;
};
GeneVariant.prototype.setReferenceGenomeType = function(referenceGenomeType) {
this._referenceGenomeType = referenceGenomeType;
};
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment