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

fix on matching reactions

parent f2b35173
No related branches found
No related tags found
1 merge request!195Resolve "data overlay with miriam ids"
......@@ -137,16 +137,16 @@ public class ColorModelCommand extends ModelCommand {
if (schema.getGeneralIdentifier() != null && !schema.getGeneralIdentifier().equals("")) {
MiriamData md = MiriamType.getMiriamDataFromIdentifier(schema.getGeneralIdentifier());
if (reaction.getMiriamData().contains(md)) {
return true;
if (!reaction.getMiriamData().contains(md)) {
return false;
}
}
for (Pair<MiriamType, String> pair : schema.getIdentifierColumns()) {
if (pair.getRight() != null && !pair.getRight().equals("")) {
MiriamData md = new MiriamData(MiriamRelationType.BQ_BIOL_IS_DESCRIBED_BY, pair.getLeft(), pair.getRight());
if (reaction.getMiriamData().contains(md)) {
return true;
if (!reaction.getMiriamData().contains(md)) {
return false;
}
}
}
......
......@@ -17,6 +17,7 @@ import org.junit.Test;
import lcsb.mapviewer.common.Pair;
import lcsb.mapviewer.model.map.BioEntity;
import lcsb.mapviewer.model.map.MiriamData;
import lcsb.mapviewer.model.map.MiriamType;
import lcsb.mapviewer.model.map.layout.ColorSchema;
import lcsb.mapviewer.model.map.layout.GenericColorSchema;
......@@ -363,6 +364,51 @@ public class ColorModelCommandTest extends CommandTestFunctions {
}
@Test
public void testReactionMatchWithProteinMiriamData() throws Exception {
try {
GenericColorSchema colorSchema = new GenericColorSchema();
colorSchema.setGeneralIdentifier(MiriamType.HGNC_SYMBOL.getCommonName()+":SNCA");
Reaction reaction = new Reaction();
List<ColorSchema> schemas = new ArrayList<>();
schemas.add(colorSchema);
ColorModelCommand factory = new ColorModelCommand(new ModelFullIndexed(null), schemas, colorExtractor);
assertFalse(factory.match(reaction, colorSchema));
} catch (Exception e) {
e.printStackTrace();
throw e;
}
}
@Test
public void testReactionMatchWithMiriamData() throws Exception {
try {
GenericColorSchema colorSchema = new GenericColorSchema();
colorSchema.setGeneralIdentifier(MiriamType.PUBMED.getCommonName()+":1234");
Reaction reaction = new Reaction();
reaction.addMiriamData(new MiriamData(MiriamType.PUBMED, "1234"));
List<ColorSchema> schemas = new ArrayList<>();
schemas.add(colorSchema);
ColorModelCommand factory = new ColorModelCommand(new ModelFullIndexed(null), schemas, colorExtractor);
assertTrue(factory.match(reaction, colorSchema));
} catch (Exception e) {
e.printStackTrace();
throw e;
}
}
@Test
public void testReactionColoringWithModelNotMatching() throws Exception {
try {
......
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