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

Merge branch '467-creating-user-s-overlay-type' into 'devel_12.0.x'

Resolve "creating user's overlay TYPE = PROTEIN is not working"

See merge request !365
parents 1d2f11a5 3f95ee99
No related branches found
No related tags found
1 merge request!365Resolve "creating user's overlay TYPE = PROTEIN is not working"
Pipeline #
......@@ -221,7 +221,14 @@ public class ColorModelCommand extends ModelCommand {
}
}
for (MiriamData md : schema.getMiriamData()) {
if (!element.getMiriamData().contains(md)) {
boolean found = false;
for (MiriamData elementMiriamData : element.getMiriamData()) {
if (elementMiriamData.getDataType().equals(md.getDataType())
&& elementMiriamData.getResource().equals(md.getResource())) {
found = true;
}
}
if (!found) {
return false;
}
}
......
......@@ -360,6 +360,61 @@ public class ColorModelCommandTest extends CommandTestFunctions {
}
@Test
public void testSpeciesMatchWithMiriamData() throws Exception {
try {
GenericColorSchema colorSchema = new GenericColorSchema();
colorSchema.setName("s1");
colorSchema.addMiriamData(new MiriamData(MiriamType.HGNC_SYMBOL, "SNCA"));
GenericColorSchema colorSchema2 = new GenericColorSchema();
colorSchema2.setName("s1");
colorSchema2.addMiriamData(new MiriamData(MiriamType.HGNC_SYMBOL, "PARK7"));
GenericProtein species = new GenericProtein("id");
species.setName("s1");
species.addMiriamData(new MiriamData(MiriamType.HGNC_SYMBOL, "SNCA"));
List<ColorSchema> schemas = new ArrayList<>();
schemas.add(colorSchema);
ColorModelCommand factory = new ColorModelCommand(new ModelFullIndexed(null), schemas, colorExtractor);
assertTrue(factory.match(species, colorSchema));
assertFalse(factory.match(species, colorSchema2));
} catch (Exception e) {
e.printStackTrace();
throw e;
}
}
@Test
public void testSpeciesMatchWithMiriamDataDifferentAnnotator() throws Exception {
try {
GenericColorSchema colorSchema = new GenericColorSchema();
colorSchema.setName("s1");
colorSchema.addMiriamData(new MiriamData(MiriamType.HGNC_SYMBOL, "SNCA"));
GenericProtein species = new GenericProtein("id");
species.setName("s1");
species.addMiriamData(new MiriamData(MiriamType.HGNC_SYMBOL, "SNCA", Object.class));
List<ColorSchema> schemas = new ArrayList<>();
schemas.add(colorSchema);
ColorModelCommand factory = new ColorModelCommand(new ModelFullIndexed(null), schemas, colorExtractor);
assertTrue(factory.match(species, colorSchema));
} catch (Exception e) {
e.printStackTrace();
throw e;
}
}
@Test
public void testReactionMatchWithProteinMiriamData() 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