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

model_name renamed to map_name

parent b7067b12
minerva (12.3.1~beta.1) unstable; urgency=low
* Small improvement: model_name renamed to map_name in data overlay columns
(#827)
* Bug fix: invalid color in data overlay provides proper feedback to the user
(#822)
* Bug fix: genetic variant overlay without name caused problems (#832)
......
......@@ -672,7 +672,7 @@ public class LayoutService implements ILayoutService {
sb.append("\t");
} else if (column.equals(ColorSchemaColumn.NAME)) {
sb.append(schema.getName() + "\t");
} else if (column.equals(ColorSchemaColumn.MODEL_NAME)) {
} else if (column.equals(ColorSchemaColumn.MAP_NAME)) {
sb.append(schema.getModelName() + "\t");
} else if (column.equals(ColorSchemaColumn.VALUE)) {
sb.append(schema.getValue() + "\t");
......@@ -727,7 +727,7 @@ public class LayoutService implements ILayoutService {
sb.append("\t");
} else if (column.equals(ColorSchemaColumn.NAME)) {
sb.append(schema.getName() + "\t");
} else if (column.equals(ColorSchemaColumn.MODEL_NAME)) {
} else if (column.equals(ColorSchemaColumn.MAP_NAME)) {
sb.append(schema.getModelName() + "\t");
} else if (column.equals(ColorSchemaColumn.VALUE)) {
sb.append(schema.getValue() + "\t");
......
......@@ -166,7 +166,7 @@ public class ColorSchemaReader {
throw new InvalidColorSchemaException(ColorSchemaColumn.GENE_NAME + " and " + ColorSchemaColumn.NAME
+ " column cannot appear in the same dataset");
}
Integer modelNameColumn = schemaColumns.get(ColorSchemaColumn.MODEL_NAME);
Integer modelNameColumn = schemaColumns.get(ColorSchemaColumn.MAP_NAME);
Integer identifierColumn = schemaColumns.get(ColorSchemaColumn.IDENTIFIER);
Integer variantIdentifierColumn = schemaColumns.get(ColorSchemaColumn.VARIANT_IDENTIFIER);
Integer allelFrequencyColumn = schemaColumns.get(ColorSchemaColumn.ALLEL_FREQUENCY);
......@@ -493,7 +493,7 @@ public class ColorSchemaReader {
Integer valueColumn = schemaColumns.get(ColorSchemaColumn.VALUE);
Integer colorColumn = schemaColumns.get(ColorSchemaColumn.COLOR);
Integer nameColumn = schemaColumns.get(ColorSchemaColumn.NAME);
Integer modelNameColumn = schemaColumns.get(ColorSchemaColumn.MODEL_NAME);
Integer modelNameColumn = schemaColumns.get(ColorSchemaColumn.MAP_NAME);
Integer identifierColumn = schemaColumns.get(ColorSchemaColumn.IDENTIFIER);
Integer elementIdentifierColumn = schemaColumns.get(ColorSchemaColumn.ELEMENT_IDENTIFIER);
if (elementIdentifierColumn == null) {
......@@ -789,7 +789,7 @@ public class ColorSchemaReader {
result.add(ColorSchemaColumn.NAME);
}
if (schema.getModelName() != null) {
result.add(ColorSchemaColumn.MODEL_NAME);
result.add(ColorSchemaColumn.MAP_NAME);
}
if (schema.getElementId() != null) {
result.add(ColorSchemaColumn.ELEMENT_IDENTIFIER);
......
......@@ -156,7 +156,7 @@ public class ColorSchemaXlsxReader {
valueColumn = foundSchemaColumns.get(ColorSchemaColumn.VALUE);
colorColumn = foundSchemaColumns.get(ColorSchemaColumn.COLOR);
nameColumn = foundSchemaColumns.get(ColorSchemaColumn.NAME);
modelNameColumn = foundSchemaColumns.get(ColorSchemaColumn.MODEL_NAME);
modelNameColumn = foundSchemaColumns.get(ColorSchemaColumn.MAP_NAME);
identifierColumn = foundSchemaColumns.get(ColorSchemaColumn.IDENTIFIER);
elementIdentifierColumn = foundSchemaColumns.get(ColorSchemaColumn.ELEMENT_IDENTIFIER);
if (elementIdentifierColumn == null) {
......@@ -326,7 +326,7 @@ public class ColorSchemaXlsxReader {
result.add(ColorSchemaColumn.NAME);
}
if (schema.getModelName() != null) {
result.add(ColorSchemaColumn.MODEL_NAME);
result.add(ColorSchemaColumn.MAP_NAME);
}
if (schema.getElementId() != null) {
result.add(ColorSchemaColumn.ELEMENT_IDENTIFIER);
......
......@@ -24,9 +24,9 @@ public enum ColorSchemaColumn {
GENE_NAME(new ColorSchemaType[] { ColorSchemaType.GENETIC_VARIANT }),
/**
* Name of the element.
* Name of the map.
*/
MODEL_NAME(new ColorSchemaType[] { ColorSchemaType.GENERIC, ColorSchemaType.GENETIC_VARIANT }),
MAP_NAME("model_name",new ColorSchemaType[] { ColorSchemaType.GENERIC, ColorSchemaType.GENETIC_VARIANT }),
/**
* Value that will be transformed into new color.
......
......@@ -444,4 +444,41 @@ public class ColorSchemaReaderTest extends ServiceTestFunctions {
assertEquals(0, classes.size());
}
@Test
public void testColoringWithModelName() throws Exception {
try {
String input = "name\tcolor\tmodel_name\n" +
"s1\t#ff0000\txxx\n" ;
Map<String, String> params = new HashMap<>();
params.put(TextFileUtils.COLUMN_COUNT_PARAM, "3");
Collection<ColorSchema> schemas = reader
.readColorSchema(new ByteArrayInputStream(input.getBytes(StandardCharsets.UTF_8)), params);
assertEquals(1, schemas.size());
assertNotNull(schemas.iterator().next().getModelName());
} catch (Exception e) {
e.printStackTrace();
throw e;
}
}
@Test
public void testColoringWithMapName() throws Exception {
try {
String input = "name\tcolor\tmap_name\n" +
"s1\t#ff0000\txxx\n" ;
Map<String, String> params = new HashMap<>();
params.put(TextFileUtils.COLUMN_COUNT_PARAM, "3");
Collection<ColorSchema> schemas = reader
.readColorSchema(new ByteArrayInputStream(input.getBytes(StandardCharsets.UTF_8)), params);
assertEquals(1, schemas.size());
assertNotNull(schemas.iterator().next().getModelName());
} catch (Exception e) {
e.printStackTrace();
throw e;
}
}
}
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