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

Merge branch '1365-change-active-tab-when-choosing-a-show-all-element-from-pin-popup' into 'master'

fix slider

Closes #1064

See merge request !1301
parents debb6e0b fef3f744
Pipeline #40381 passed with stage
in 31 minutes and 54 seconds
......@@ -15,6 +15,10 @@ minerva (16.0.0~alpha.2) stable; urgency=medium
their lines (#1471)
* Bug fix: when selecting drug in the alias window the input text is updated
(#1365)
* Bug fix: zoom slider was not updated when clicking on +/- in genome browser
(#1064)
* Bug fix: there was no possibility to see gene variants
(regression 16.0.0~alpha.1)
-- Piotr Gawron <piotr.gawron@uni.lu> Fri, 26 Mar 2021 10:00:00 +0200
......
This diff is collapsed.
......@@ -33,6 +33,10 @@ function DataOverlay(overlayId, name) {
this.setGoogleLicenseConsent(object.googleLicenseConsent);
this.setInputDataAvailable(object.inputDataAvailable);
this.setType(object.type);
if (this.getType()===LayoutAlias.GENETIC_VARIANT) {
this.setGenomeVersion(object.genomeVersion);
this.setGenomeType(object.genomeType);
}
if (!this.getInputDataAvailable()) {
this.setInitialized(true);
}
......@@ -390,6 +394,38 @@ DataOverlay.prototype.setType = function (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
......
......@@ -403,35 +403,30 @@ AliasInfoWindow.prototype.createGenomicDiv = function (params) {
overlays.forEach(function (overlay) {
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) {
promises = [];
result.forEach(function (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);
}).then(function () {
......@@ -521,7 +516,8 @@ AliasInfoWindow.prototype.createGenomicDiv = function (params) {
var distDiff = Math.floor((range.stop - range.start + 1) / 4);
range.start += distDiff;
range.stop -= distDiff;
$(".zoom-slider", contentElement).val(parseInt($(".zoom-slider", zoomControls).val()) + 1);
self.pileup.setRange(range);
});
zoomIn.appendTo(zoomControls);
......@@ -539,6 +535,7 @@ AliasInfoWindow.prototype.createGenomicDiv = function (params) {
range.start = 0;
}
$(".zoom-slider", contentElement).val(parseInt($(".zoom-slider", zoomControls).val()) - 1);
self.pileup.setRange(range);
});
zoomOut.appendTo(zoomControls);
......
......@@ -7,6 +7,8 @@ import javax.persistence.*;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lcsb.mapviewer.common.exception.NotImplementedException;
/**
......@@ -72,6 +74,7 @@ public class GeneVariant implements Serializable {
*/
private String variantIdentifier;
@JsonIgnore
@ManyToOne
private GeneVariantDataOverlayEntry dataOverlayEntry;
......
......@@ -7,6 +7,7 @@ import java.util.stream.Collectors;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.hibernate.Hibernate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
......@@ -431,6 +432,7 @@ public class OverlayRestImpl extends BaseRestImpl {
case "genevariations":
if (overlayEntry instanceof GeneVariantDataOverlayEntry) {
value = ((GeneVariantDataOverlayEntry) overlayEntry).getGeneVariants();
Hibernate.initialize(((GeneVariantDataOverlayEntry) overlayEntry).getGeneVariants());
} else {
value = new Object[] {};
}
......
......@@ -42,6 +42,7 @@ import org.springframework.web.context.WebApplicationContext;
import lcsb.mapviewer.api.projects.chemicals.ChemicalRestImpl;
import lcsb.mapviewer.common.*;
import lcsb.mapviewer.converter.zip.ZipEntryFileFactory;
import lcsb.mapviewer.model.*;
import lcsb.mapviewer.model.cache.UploadedFileEntry;
import lcsb.mapviewer.model.graphics.*;
......@@ -560,6 +561,11 @@ abstract public class ControllerIntegrationTest {
}
protected DataOverlay createOverlay(Project project, User admin, String content) throws Exception {
return createOverlay(project, admin, content, DataOverlayType.GENERIC);
}
protected DataOverlay createOverlay(Project project, User admin, String content, DataOverlayType type)
throws Exception {
UploadedFileEntry file = new UploadedFileEntry();
file.setFileContent(content.getBytes());
file.setLength(content.getBytes().length);
......@@ -568,7 +574,7 @@ abstract public class ControllerIntegrationTest {
ColorSchemaReader reader = new ColorSchemaReader();
DataOverlay overlay = new DataOverlay();
overlay.setColorSchemaType(DataOverlayType.GENERIC);
overlay.setColorSchemaType(type);
overlay.setInputData(file);
overlay.setProject(project);
overlay.setName("test title");
......@@ -576,6 +582,7 @@ abstract public class ControllerIntegrationTest {
overlay.setCreator(admin);
Map<String, String> headers = new HashMap<>();
headers.put(TextFileUtils.COLUMN_COUNT_PARAM, "2");
headers.put(ZipEntryFileFactory.LAYOUT_HEADER_PARAM_TYPE, type.toString());
overlay.addEntries(reader.readColorSchema(new ByteArrayInputStream(content.getBytes()), headers));
dataOverlayDao.add(overlay);
return overlay;
......
......@@ -1483,7 +1483,6 @@ public class OverlayControllerIntegrationTest extends ControllerIntegrationTest
}
@Test
public void testRemoveUserOverlayAsAnonymous() throws Exception {
DataOverlay overlay = createOverlayInSeparateThread(TEST_PROJECT, user);
RequestBuilder request = delete("/projects/" + TEST_PROJECT + "/overlays/" + overlay.getId());
......@@ -1492,4 +1491,37 @@ public class OverlayControllerIntegrationTest extends ControllerIntegrationTest
.andExpect(status().isForbidden());
}
@Test
public void testFetchGeneticDataOverlayData() throws Exception {
MockHttpSession session = createSession(BUILT_IN_TEST_ADMIN_LOGIN, BUILT_IN_TEST_ADMIN_PASSWORD);
DataOverlay overlay = callInSeparateThread(() -> {
try {
return createOverlay(project, user, "#TYPE=GENETIC_VARIANT\n" +
"#GENOME_TYPE=UCSC\n" +
"#GENOME_VERSION=xenLae2\n" +
"position\toriginal_dna\talternative_dna\tgene_name\tdescription\tcolor\tcontig\n" +
"10146\tAC\tA\tGSTA4\tupstream\t#ff0000\tchr1", DataOverlayType.GENETIC_VARIANT);
} catch (Exception e) {
e.printStackTrace();
return null;
}
});
assertNotNull(overlay);
for (Element element_iterator : map.getElements()) {
if (element_iterator.getName().equals("GSTA4")) {
element = element_iterator;
}
}
assertEquals(element.getName(), "GSTA4");
RequestBuilder request = get(
"/projects/{projectId}/overlays/{overlayId}/models/{mapId}/bioEntities/elements/{elementId}/",
TEST_PROJECT, overlay.getId(), map.getId(), element.getId())
.session(session);
mockMvc.perform(request)
.andExpect(status().is2xxSuccessful());
}
}
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