Commit 553efe16 authored by Piotr Gawron's avatar Piotr Gawron
Browse files

genome information is stored in data overlay

parent 6776cd9e
...@@ -33,6 +33,10 @@ function DataOverlay(overlayId, name) { ...@@ -33,6 +33,10 @@ function DataOverlay(overlayId, name) {
this.setGoogleLicenseConsent(object.googleLicenseConsent); this.setGoogleLicenseConsent(object.googleLicenseConsent);
this.setInputDataAvailable(object.inputDataAvailable); this.setInputDataAvailable(object.inputDataAvailable);
this.setType(object.type); this.setType(object.type);
if (this.getType()===LayoutAlias.GENETIC_VARIANT) {
this.setGenomeVersion(object.genomeVersion);
this.setGenomeType(object.genomeType);
}
if (!this.getInputDataAvailable()) { if (!this.getInputDataAvailable()) {
this.setInitialized(true); this.setInitialized(true);
} }
...@@ -390,6 +394,38 @@ DataOverlay.prototype.setType = function (type) { ...@@ -390,6 +394,38 @@ DataOverlay.prototype.setType = function (type) {
this._type = type; this._type = type;
}; };
/**
*
* @returns {string}
*/
DataOverlay.prototype.getGenomeType = function () {
return this._genomeType;
};
/**
*
* @param {string} type
*/
DataOverlay.prototype.setGenomeType = function (type) {
this._genomeType = type;
};
/**
*
* @returns {string}
*/
DataOverlay.prototype.getGenomeVersion = function () {
return this._genomeVersion;
};
/**
*
* @param {string} version
*/
DataOverlay.prototype.setGenomeVersion = function (version) {
this._genomeVersion = version;
};
/** /**
* *
* @param {boolean} value * @param {boolean} value
......
...@@ -403,35 +403,30 @@ AliasInfoWindow.prototype.createGenomicDiv = function (params) { ...@@ -403,35 +403,30 @@ AliasInfoWindow.prototype.createGenomicDiv = function (params) {
overlays.forEach(function (overlay) { overlays.forEach(function (overlay) {
promises.push(overlay.getFullAliasesById(self.getAlias().getId())); promises.push(overlay.getFullAliasesById(self.getAlias().getId()));
if (overlay.getType() === LayoutAlias.GENETIC_VARIANT) {
geneticInformation = true;
promises.push(self.getCustomMap().getTopMap().getReferenceGenome(overlay.getGenomeType(),
overlay.getGenomeVersion()).then(function (genome) {
if (genome.getUrl() !== null && genome.getUrl() !== undefined) {
if (genomes[genome.getUrl()] === undefined) {
genomes[genome.getUrl()] = genome;
genomeUrls.push(genome.getUrl());
}
} else {
logger.warn("Genome for " + overlay.getGenomeType() + ","
+ overlay.getGenomeVersion() + " not loaded");
}
}, function () {
logger.warn("Genome for " + overlay.getGenomeType() + ","
+ overlay.getGenomeVersion() + " not loaded");
}));
}
}); });
return Promise.all(promises).then(function (result) { return Promise.all(promises).then(function (result) {
promises = []; promises = [];
result.forEach(function (overlayEntries) { result.forEach(function (overlayEntries) {
overlaysData = overlaysData.concat(overlayEntries); overlaysData = overlaysData.concat(overlayEntries);
for (var i = 0; i < overlayEntries.length; i++) {
var data = overlayEntries[i];
if (data !== null && data !== undefined && data.getType() === LayoutAlias.GENETIC_VARIANT) {
geneticInformation = true;
promises.push(Promise.each(data.getGeneVariants(), function (variant) {
return self.getCustomMap().getTopMap().getReferenceGenome(variant.getReferenceGenomeType(),
variant.getReferenceGenomeVersion()).then(function (genome) {
if (genome.getUrl() !== null && genome.getUrl() !== undefined) {
if (genomes[genome.getUrl()] === undefined) {
genomes[genome.getUrl()] = genome;
genomeUrls.push(genome.getUrl());
}
} else {
logger.warn("Genome for " + variant.getReferenceGenomeType() + ","
+ variant.getReferenceGenomeVersion() + " not loaded");
}
}, function () {
logger.warn("Genome for " + variant.getReferenceGenomeType() + ","
+ variant.getReferenceGenomeVersion() + " not loaded");
});
}));
}
}
}); });
return Promise.all(promises); return Promise.all(promises);
}).then(function () { }).then(function () {
......
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