Commit 4b63adc8 authored by Piotr Gawron's avatar Piotr Gawron
Browse files

allow user to upload overlay and filter by model_name

parent 28e88325
Pipeline #3081 passed with stage
in 48 seconds
...@@ -792,6 +792,8 @@ public class LayoutService implements ILayoutService { ...@@ -792,6 +792,8 @@ public class LayoutService implements ILayoutService {
sb.append("\t"); sb.append("\t");
} else if (column.equals(ColorSchemaColumn.NAME)) { } else if (column.equals(ColorSchemaColumn.NAME)) {
sb.append(schema.getName() + "\t"); sb.append(schema.getName() + "\t");
} else if (column.equals(ColorSchemaColumn.MODEL_NAME)) {
sb.append(schema.getModelName() + "\t");
} else if (column.equals(ColorSchemaColumn.VALUE)) { } else if (column.equals(ColorSchemaColumn.VALUE)) {
sb.append(schema.getValue() + "\t"); sb.append(schema.getValue() + "\t");
} else if (column.equals(ColorSchemaColumn.COMPARTMENT)) { } else if (column.equals(ColorSchemaColumn.COMPARTMENT)) {
...@@ -847,6 +849,8 @@ public class LayoutService implements ILayoutService { ...@@ -847,6 +849,8 @@ public class LayoutService implements ILayoutService {
sb.append("\t"); sb.append("\t");
} else if (column.equals(ColorSchemaColumn.NAME)) { } else if (column.equals(ColorSchemaColumn.NAME)) {
sb.append(schema.getName() + "\t"); sb.append(schema.getName() + "\t");
} else if (column.equals(ColorSchemaColumn.MODEL_NAME)) {
sb.append(schema.getModelName() + "\t");
} else if (column.equals(ColorSchemaColumn.VALUE)) { } else if (column.equals(ColorSchemaColumn.VALUE)) {
sb.append(schema.getValue() + "\t"); sb.append(schema.getValue() + "\t");
} else if (column.equals(ColorSchemaColumn.COMPARTMENT)) { } else if (column.equals(ColorSchemaColumn.COMPARTMENT)) {
......
...@@ -157,6 +157,7 @@ public class ColorSchemaReader { ...@@ -157,6 +157,7 @@ public class ColorSchemaReader {
Integer colorColumn = schemaColumns.get(ColorSchemaColumn.COLOR); Integer colorColumn = schemaColumns.get(ColorSchemaColumn.COLOR);
Integer contigColumn = schemaColumns.get(ColorSchemaColumn.CONTIG); Integer contigColumn = schemaColumns.get(ColorSchemaColumn.CONTIG);
Integer nameColumn = schemaColumns.get(ColorSchemaColumn.NAME); Integer nameColumn = schemaColumns.get(ColorSchemaColumn.NAME);
Integer modelNameColumn = schemaColumns.get(ColorSchemaColumn.MODEL_NAME);
Integer identifierColumn = schemaColumns.get(ColorSchemaColumn.IDENTIFIER); Integer identifierColumn = schemaColumns.get(ColorSchemaColumn.IDENTIFIER);
Integer variantIdentifierColumn = schemaColumns.get(ColorSchemaColumn.VARIANT_IDENTIFIER); Integer variantIdentifierColumn = schemaColumns.get(ColorSchemaColumn.VARIANT_IDENTIFIER);
Integer allelFrequencyColumn = schemaColumns.get(ColorSchemaColumn.ALLEL_FREQUENCY); Integer allelFrequencyColumn = schemaColumns.get(ColorSchemaColumn.ALLEL_FREQUENCY);
...@@ -202,6 +203,9 @@ public class ColorSchemaReader { ...@@ -202,6 +203,9 @@ public class ColorSchemaReader {
if (nameColumn != null) { if (nameColumn != null) {
processNameColumn(schema, values[nameColumn]); processNameColumn(schema, values[nameColumn]);
} }
if (modelNameColumn != null) {
processModelNameColumn(schema, values[modelNameColumn]);
}
if (compartmentColumn != null) { if (compartmentColumn != null) {
processCompartmentColumn(schema, values[compartmentColumn]); processCompartmentColumn(schema, values[compartmentColumn]);
} }
...@@ -328,6 +332,12 @@ public class ColorSchemaReader { ...@@ -328,6 +332,12 @@ public class ColorSchemaReader {
schema.setName(content); schema.setName(content);
} }
} }
private void processModelNameColumn(ColorSchema schema, String content) {
if (!content.isEmpty()) {
schema.setModelName(content);
}
}
/** /**
* Sets proper compartment names to {@link ColorSchema} from cell content. * Sets proper compartment names to {@link ColorSchema} from cell content.
...@@ -463,6 +473,7 @@ public class ColorSchemaReader { ...@@ -463,6 +473,7 @@ public class ColorSchemaReader {
Integer valueColumn = schemaColumns.get(ColorSchemaColumn.VALUE); Integer valueColumn = schemaColumns.get(ColorSchemaColumn.VALUE);
Integer colorColumn = schemaColumns.get(ColorSchemaColumn.COLOR); Integer colorColumn = schemaColumns.get(ColorSchemaColumn.COLOR);
Integer nameColumn = schemaColumns.get(ColorSchemaColumn.NAME); Integer nameColumn = schemaColumns.get(ColorSchemaColumn.NAME);
Integer modelNameColumn = schemaColumns.get(ColorSchemaColumn.MODEL_NAME);
Integer identifierColumn = schemaColumns.get(ColorSchemaColumn.IDENTIFIER); Integer identifierColumn = schemaColumns.get(ColorSchemaColumn.IDENTIFIER);
Integer reactionIdentifierColumn = schemaColumns.get(ColorSchemaColumn.REACTION_IDENTIFIER); Integer reactionIdentifierColumn = schemaColumns.get(ColorSchemaColumn.REACTION_IDENTIFIER);
Integer compartmentColumn = schemaColumns.get(ColorSchemaColumn.COMPARTMENT); Integer compartmentColumn = schemaColumns.get(ColorSchemaColumn.COMPARTMENT);
...@@ -499,6 +510,9 @@ public class ColorSchemaReader { ...@@ -499,6 +510,9 @@ public class ColorSchemaReader {
if (nameColumn != null) { if (nameColumn != null) {
processNameColumn(schema, values[nameColumn]); processNameColumn(schema, values[nameColumn]);
} }
if (modelNameColumn != null) {
processModelNameColumn(schema, values[modelNameColumn]);
}
if (valueColumn != null) { if (valueColumn != null) {
schema.setValue(parseValueColumn(values[valueColumn], errorPrefix)); schema.setValue(parseValueColumn(values[valueColumn], errorPrefix));
} }
...@@ -729,6 +743,9 @@ public class ColorSchemaReader { ...@@ -729,6 +743,9 @@ public class ColorSchemaReader {
if (schema.getName() != null) { if (schema.getName() != null) {
result.add(ColorSchemaColumn.NAME); result.add(ColorSchemaColumn.NAME);
} }
if (schema.getModelName() != null) {
result.add(ColorSchemaColumn.MODEL_NAME);
}
if (schema.getReactionIdentifier() != null) { if (schema.getReactionIdentifier() != null) {
result.add(ColorSchemaColumn.REACTION_IDENTIFIER); result.add(ColorSchemaColumn.REACTION_IDENTIFIER);
} }
......
...@@ -3,7 +3,6 @@ package lcsb.mapviewer.services.utils.data; ...@@ -3,7 +3,6 @@ package lcsb.mapviewer.services.utils.data;
import java.util.HashSet; import java.util.HashSet;
import java.util.Set; import java.util.Set;
import lcsb.mapviewer.model.map.layout.ReferenceGenome; import lcsb.mapviewer.model.map.layout.ReferenceGenome;
import lcsb.mapviewer.model.map.layout.ReferenceGenomeType; import lcsb.mapviewer.model.map.layout.ReferenceGenomeType;
...@@ -16,136 +15,141 @@ import lcsb.mapviewer.model.map.layout.ReferenceGenomeType; ...@@ -16,136 +15,141 @@ import lcsb.mapviewer.model.map.layout.ReferenceGenomeType;
*/ */
public enum ColorSchemaColumn { public enum ColorSchemaColumn {
/** /**
* Name of the element. * Name of the element.
*/ */
NAME("name", new ColorSchemaType[] { ColorSchemaType.GENERIC, ColorSchemaType.GENETIC_VARIANT }), // NAME("name", new ColorSchemaType[] { ColorSchemaType.GENERIC, ColorSchemaType.GENETIC_VARIANT }), //
/** /**
* Value that will be transformed into new color. * Name of the element.
* */
* @see ColorSchemaColumn#COLOR MODEL_NAME("model_name", new ColorSchemaType[] { ColorSchemaType.GENERIC, ColorSchemaType.GENETIC_VARIANT }), //
*/
VALUE("value", new ColorSchemaType[] { ColorSchemaType.GENERIC }), // /**
* Value that will be transformed into new color.
/** *
* In which compartment the element should be located. * @see ColorSchemaColumn#COLOR
*/ */
COMPARTMENT("compartment", new ColorSchemaType[] { ColorSchemaType.GENERIC, ColorSchemaType.GENETIC_VARIANT }), // VALUE("value", new ColorSchemaType[] { ColorSchemaType.GENERIC }), //
/** /**
* Class type of the element. * In which compartment the element should be located.
*/ */
TYPE("type", new ColorSchemaType[] { ColorSchemaType.GENERIC, ColorSchemaType.GENETIC_VARIANT }), // COMPARTMENT("compartment", new ColorSchemaType[] { ColorSchemaType.GENERIC, ColorSchemaType.GENETIC_VARIANT }), //
/** /**
* New element/reaction color. * Class type of the element.
*/ */
COLOR("color", new ColorSchemaType[] { ColorSchemaType.GENERIC, ColorSchemaType.GENETIC_VARIANT }), // TYPE("type", new ColorSchemaType[] { ColorSchemaType.GENERIC, ColorSchemaType.GENETIC_VARIANT }), //
/** /**
* Identifier of the element. * New element/reaction color.
*/ */
IDENTIFIER("identifier", new ColorSchemaType[] { ColorSchemaType.GENERIC, ColorSchemaType.GENETIC_VARIANT }), // COLOR("color", new ColorSchemaType[] { ColorSchemaType.GENERIC, ColorSchemaType.GENETIC_VARIANT }), //
/** /**
* Reaction identifier. * Identifier of the element.
*/ */
REACTION_IDENTIFIER("reactionIdentifier", new ColorSchemaType[] { ColorSchemaType.GENERIC }), // IDENTIFIER("identifier", new ColorSchemaType[] { ColorSchemaType.GENERIC, ColorSchemaType.GENETIC_VARIANT }), //
/** /**
* New line width of the reaction. * Reaction identifier.
*/ */
LINE_WIDTH("lineWidth", new ColorSchemaType[] { ColorSchemaType.GENERIC }), // REACTION_IDENTIFIER("reactionIdentifier", new ColorSchemaType[] { ColorSchemaType.GENERIC }), //
/** /**
* Position where gene variants starts. * New line width of the reaction.
*/ */
POSITION("position", new ColorSchemaType[] { ColorSchemaType.GENETIC_VARIANT }), // LINE_WIDTH("lineWidth", new ColorSchemaType[] { ColorSchemaType.GENERIC }), //
/** /**
* Original DNA of the variant. * Position where gene variants starts.
*/ */
ORIGINAL_DNA("original_dna", new ColorSchemaType[] { ColorSchemaType.GENETIC_VARIANT }), // POSITION("position", new ColorSchemaType[] { ColorSchemaType.GENETIC_VARIANT }), //
/** /**
* Alternative DNA of the variant. * Original DNA of the variant.
*/ */
ALTERNATIVE_DNA("alternative_dna", new ColorSchemaType[] { ColorSchemaType.GENETIC_VARIANT }), // ORIGINAL_DNA("original_dna", new ColorSchemaType[] { ColorSchemaType.GENETIC_VARIANT }), //
/** /**
* Short description of the entry. * Alternative DNA of the variant.
*/ */
DESCRIPTION("description", new ColorSchemaType[] { ColorSchemaType.GENETIC_VARIANT, ColorSchemaType.GENERIC }), // ALTERNATIVE_DNA("alternative_dna", new ColorSchemaType[] { ColorSchemaType.GENETIC_VARIANT }), //
/** /**
* Variant references. * Short description of the entry.
*/ */
REFERENCES("references", new ColorSchemaType[] { ColorSchemaType.GENETIC_VARIANT }), // DESCRIPTION("description", new ColorSchemaType[] { ColorSchemaType.GENETIC_VARIANT, ColorSchemaType.GENERIC }), //
/** /**
* What's the {@link ReferenceGenomeType}. * Variant references.
*/ */
REFERENCE_GENOME_TYPE("reference_genome_type", new ColorSchemaType[] { ColorSchemaType.GENETIC_VARIANT }), // REFERENCES("references", new ColorSchemaType[] { ColorSchemaType.GENETIC_VARIANT }), //
/** /**
* {@link ReferenceGenome#version Version} of the reference genome. * What's the {@link ReferenceGenomeType}.
*/ */
REFERENCE_GENOME_VERSION("reference_genome_version", new ColorSchemaType[] { ColorSchemaType.GENETIC_VARIANT }), // REFERENCE_GENOME_TYPE("reference_genome_type", new ColorSchemaType[] { ColorSchemaType.GENETIC_VARIANT }), //
/** /**
* Contig where variant was observed. * {@link ReferenceGenome#version Version} of the reference genome.
*/ */
CONTIG("contig", new ColorSchemaType[] { ColorSchemaType.GENETIC_VARIANT }), // REFERENCE_GENOME_VERSION("reference_genome_version", new ColorSchemaType[] { ColorSchemaType.GENETIC_VARIANT }), //
ALLEL_FREQUENCY("allel_frequency", new ColorSchemaType[] { ColorSchemaType.GENETIC_VARIANT }), // /**
* Contig where variant was observed.
VARIANT_IDENTIFIER("variant_identifier", new ColorSchemaType[] { ColorSchemaType.GENETIC_VARIANT }), // */
CONTIG("contig", new ColorSchemaType[] { ColorSchemaType.GENETIC_VARIANT }), //
/**
* Should the direction of reaction be reversed. ALLEL_FREQUENCY("allel_frequency", new ColorSchemaType[] { ColorSchemaType.GENETIC_VARIANT }), //
*/
REVERSE_REACTION("reverseReaction", new ColorSchemaType[] { ColorSchemaType.GENERIC }); // VARIANT_IDENTIFIER("variant_identifier", new ColorSchemaType[] { ColorSchemaType.GENETIC_VARIANT }), //
/** /**
* Default constructor that creates enum entry. * Should the direction of reaction be reversed.
* */
* @param title REVERSE_REACTION("reverseReaction", new ColorSchemaType[] { ColorSchemaType.GENERIC }); //
* {@link #title}
* @param types /**
* list of {@link ColumnType types} where this column is allowed * Default constructor that creates enum entry.
*/ *
ColorSchemaColumn(String title, ColorSchemaType[] types) { * @param title
this.title = title; * {@link #title}
for (ColorSchemaType colorSchemaType : types) { * @param types
this.types.add(colorSchemaType); * list of {@link ColumnType types} where this column is allowed
} */
} ColorSchemaColumn(String title, ColorSchemaType[] types) {
this.title = title;
/** for (ColorSchemaType colorSchemaType : types) {
* Human readable title used in input file. this.types.add(colorSchemaType);
*/ }
private String title; }
/** /**
* Set of types where column is allowed. * Human readable title used in input file.
*/ */
private Set<ColorSchemaType> types = new HashSet<>(); private String title;
/** /**
* * Set of types where column is allowed.
* @return {@link #title} */
*/ private Set<ColorSchemaType> types = new HashSet<>();
public String getTitle() {
return title; /**
} *
* @return {@link #title}
/** */
* @return the types public String getTitle() {
* @see #types return title;
*/ }
public Set<ColorSchemaType> getTypes() {
return types; /**
} * @return the types
* @see #types
*/
public Set<ColorSchemaType> getTypes() {
return types;
}
} }
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