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

set transcription factor color to black when coloring model

parent 154d945d
Pipeline #52731 passed with stage
in 14 minutes and 47 seconds
......@@ -6,6 +6,8 @@ minerva (16.1.0~beta.1) stable; urgency=medium
* Bug fix: users that logged out or when session expired are marked as not
logged in (#1639)
* Bug fix: reaction search result caused an exception (#1640)
* Bug fix: transcription factor color is set to black in monochromatic
background (#1643)
-- Piotr Gawron <piotr.gawron@uni.lu> Fri, 18 Feb 2022 11:00:00 +0200
......
......@@ -17,6 +17,7 @@ import lcsb.mapviewer.common.exception.InvalidStateException;
import lcsb.mapviewer.common.exception.NotImplementedException;
import lcsb.mapviewer.model.graphics.ArrowTypeData;
import lcsb.mapviewer.model.map.BioEntity;
import lcsb.mapviewer.model.map.Drawable;
import lcsb.mapviewer.model.map.MiriamData;
import lcsb.mapviewer.model.map.compartment.Compartment;
import lcsb.mapviewer.model.map.model.Model;
......@@ -29,6 +30,7 @@ import lcsb.mapviewer.model.map.reaction.Reaction;
import lcsb.mapviewer.model.map.species.Element;
import lcsb.mapviewer.model.map.species.Species;
import lcsb.mapviewer.model.overlay.DataOverlayEntry;
import lcsb.mapviewer.model.overlay.InvalidDataOverlayException;
import lcsb.mapviewer.modelutils.map.ElementUtils;
/**
......@@ -372,14 +374,14 @@ public class ColorModelCommand extends ModelCommand {
* is the model a top (parent) model
*/
private void colorModel(final Model result, final boolean top) {
for (Drawable drawable : result.getDrawables()) {
drawable.setBorderColor(Color.BLACK);
}
for (final Element element : result.getElements()) {
element.setBorderColor(Color.BLACK);
element.setFillColor(Color.WHITE);
element.setGlyph(null);
}
for (final Reaction reaction : result.getReactions()) {
reaction.getLine().setColor(Color.BLACK);
for (final AbstractNode node : reaction.getNodes()) {
node.getLine().setColor(Color.BLACK);
}
......
......@@ -25,8 +25,10 @@ import lcsb.mapviewer.model.map.model.ModelSubmodelConnection;
import lcsb.mapviewer.model.map.model.SubmodelType;
import lcsb.mapviewer.model.map.reaction.Reaction;
import lcsb.mapviewer.model.map.species.Element;
import lcsb.mapviewer.model.map.species.Gene;
import lcsb.mapviewer.model.map.species.GenericProtein;
import lcsb.mapviewer.model.map.species.Protein;
import lcsb.mapviewer.model.map.species.field.TranscriptionSite;
import lcsb.mapviewer.model.overlay.DataOverlayEntry;
import lcsb.mapviewer.model.overlay.GenericDataOverlayEntry;
......@@ -42,12 +44,6 @@ public class ColorModelCommandTest extends CommandTestFunctions {
public void tearDown() throws Exception {
}
/**
* Test if all elements were copied - if not hibernate will complain
*
* @throws Exception
*
*/
@Test
public void testColorFullModel() throws Exception {
ModelComparator comparator = new ModelComparator();
......@@ -508,4 +504,20 @@ public class ColorModelCommandTest extends CommandTestFunctions {
assertEquals(Color.YELLOW, re4.getLine().getColor());
}
@Test
public void testColorTranscriptionFactor() {
Model model = new ModelFullIndexed(null);
Gene gene = createGene();
TranscriptionSite site = new TranscriptionSite();
site.setBorderColor(Color.YELLOW);
gene.addTranscriptionSite(site);
model.addElement(gene);
ColorModelCommand factory = new ColorModelCommand(model, new ArrayList<>(), colorExtractor);
factory.execute();
assertEquals(Color.BLACK, site.getBorderColor());
}
}
......@@ -29,6 +29,7 @@ import lcsb.mapviewer.model.map.reaction.Reaction;
import lcsb.mapviewer.model.map.reaction.type.TransportReaction;
import lcsb.mapviewer.model.map.species.Complex;
import lcsb.mapviewer.model.map.species.Element;
import lcsb.mapviewer.model.map.species.Gene;
import lcsb.mapviewer.model.map.species.GenericProtein;
import lcsb.mapviewer.model.map.species.Protein;
......@@ -121,6 +122,11 @@ public abstract class CommandTestFunctions {
return result;
}
protected Gene createGene() {
Gene result = new Gene("" + counter++);
return result;
}
protected Complex createComplex() {
Complex result = new Complex("" + counter++);
result.setWidth((Double) null);
......
......@@ -525,4 +525,9 @@ public class PolylineData implements Serializable, Drawable {
public Color getBorderColor() {
return getColor();
}
@Override
public void setBorderColor(final Color color) {
setColor(color);
}
}
......@@ -36,6 +36,8 @@ public interface Drawable {
String getElementId();
double getSize();
Color getBorderColor();
void setBorderColor(Color color);
}
......@@ -294,4 +294,9 @@ public class LayerOval implements Serializable, Drawable {
return getColor();
}
@Override
public void setBorderColor(final Color color) {
setColor(color);
}
}
......@@ -601,6 +601,7 @@ public class Reaction implements BioEntity {
*
* @return copy of the reaction
*/
@Override
public Reaction copy() {
if (this.getClass() == Reaction.class) {
return new Reaction(this);
......@@ -686,6 +687,7 @@ public class Reaction implements BioEntity {
* @return the synonyms
* @see #synonyms
*/
@Override
public List<String> getSynonyms() {
return synonyms;
}
......@@ -695,6 +697,7 @@ public class Reaction implements BioEntity {
* the synonyms to set
* @see #synonyms
*/
@Override
public void setSynonyms(final List<String> synonyms) {
this.synonyms = synonyms;
}
......@@ -714,6 +717,7 @@ public class Reaction implements BioEntity {
* the name to set
* @see #name
*/
@Override
public void setName(final String name) {
this.name = name;
}
......@@ -722,6 +726,7 @@ public class Reaction implements BioEntity {
* @return the id
* @see #id
*/
@Override
public int getId() {
return id;
}
......@@ -731,6 +736,7 @@ public class Reaction implements BioEntity {
*
* @return short string describing type of the reaction
*/
@Override
public String getStringType() {
return "Generic Reaction";
}
......@@ -939,4 +945,11 @@ public class Reaction implements BioEntity {
return null;
}
@Override
public void setBorderColor(final Color color) {
if (getLine() != null) {
getLine().setBorderColor(color);
}
}
}
......@@ -126,7 +126,7 @@ public class StructuralState implements Serializable, Drawable {
public void setWidth(final Double width) {
this.width = width;
}
public void setWidth(final Integer width) {
this.width = width.doubleValue();
}
......@@ -184,4 +184,8 @@ public class StructuralState implements Serializable, Drawable {
return Color.BLACK;
}
@Override
public void setBorderColor(final Color color) {
}
}
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