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