Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Devrim Gunyel
core
Commits
374f6a98
Commit
374f6a98
authored
Mar 11, 2019
by
Piotr Gawron
Browse files
default column names are lower cased enum names
parent
32ed0b28
Changes
4
Hide whitespace changes
Inline
Side-by-side
service/src/main/java/lcsb/mapviewer/services/impl/LayoutService.java
View file @
374f6a98
...
...
@@ -584,7 +584,7 @@ public class LayoutService implements ILayoutService {
for
(
ColorSchemaColumn
column
:
ColorSchemaColumn
.
values
())
{
if
(
columns
.
contains
(
column
))
{
sb
.
append
(
column
.
get
Titl
e
()
+
"\t"
);
sb
.
append
(
column
.
get
ColumnNam
e
()
+
"\t"
);
}
}
sb
.
append
(
"matches<br/>\n"
);
...
...
service/src/main/java/lcsb/mapviewer/services/utils/ColorSchemaReader.java
View file @
374f6a98
...
...
@@ -181,21 +181,21 @@ public class ColorSchemaReader {
throw
new
InvalidColorSchemaException
(
"One of these columns is obligatory: name, identifier"
);
}
if
(
contigColumn
==
null
)
{
throw
new
InvalidColorSchemaException
(
ColorSchemaColumn
.
CONTIG
.
get
Titl
e
()
+
" column is obligatory"
);
throw
new
InvalidColorSchemaException
(
ColorSchemaColumn
.
CONTIG
.
get
ColumnNam
e
()
+
" column is obligatory"
);
}
if
(
positionColumn
==
null
)
{
throw
new
InvalidColorSchemaException
(
ColorSchemaColumn
.
POSITION
.
get
Titl
e
()
+
" column is obligatory"
);
throw
new
InvalidColorSchemaException
(
ColorSchemaColumn
.
POSITION
.
get
ColumnNam
e
()
+
" column is obligatory"
);
}
if
(
originalDnaColumn
==
null
)
{
throw
new
InvalidColorSchemaException
(
ColorSchemaColumn
.
ORIGINAL_DNA
.
get
Titl
e
()
+
" column is obligatory"
);
throw
new
InvalidColorSchemaException
(
ColorSchemaColumn
.
ORIGINAL_DNA
.
get
ColumnNam
e
()
+
" column is obligatory"
);
}
if
(
referenceGenomeTypeColumn
==
null
&&
genomeType
==
null
)
{
throw
new
InvalidColorSchemaException
(
ColorSchemaColumn
.
REFERENCE_GENOME_TYPE
.
get
Titl
e
()
+
" column is obligatory"
);
ColorSchemaColumn
.
REFERENCE_GENOME_TYPE
.
get
ColumnNam
e
()
+
" column is obligatory"
);
}
if
(
referenceGenomeVersionColumn
==
null
&&
referenceGenomeVersionStr
==
null
)
{
throw
new
InvalidColorSchemaException
(
ColorSchemaColumn
.
REFERENCE_GENOME_VERSION
.
get
Titl
e
()
+
" column is obligatory"
);
ColorSchemaColumn
.
REFERENCE_GENOME_VERSION
.
get
ColumnNam
e
()
+
" column is obligatory"
);
}
lineIndex
++;
line
=
br
.
readLine
();
...
...
@@ -501,8 +501,8 @@ public class ColorSchemaReader {
if
(
nameColumn
==
null
&&
identifierColumn
==
null
&&
customIdentifiers
.
size
()
==
0
&&
elementIdentifierColumn
==
null
)
{
throw
new
InvalidColorSchemaException
(
"One of these columns is obligatory: "
+
ColorSchemaColumn
.
NAME
.
get
Titl
e
()
+
","
+
ColorSchemaColumn
.
IDENTIFIER
.
get
Titl
e
()
+
","
+
ColorSchemaColumn
.
ELEMENT_IDENTIFIER
.
get
Titl
e
());
throw
new
InvalidColorSchemaException
(
"One of these columns is obligatory: "
+
ColorSchemaColumn
.
NAME
.
get
ColumnNam
e
()
+
","
+
ColorSchemaColumn
.
IDENTIFIER
.
get
ColumnNam
e
()
+
","
+
ColorSchemaColumn
.
ELEMENT_IDENTIFIER
.
get
ColumnNam
e
());
}
if
(
valueColumn
==
null
&&
colorColumn
==
null
)
{
...
...
@@ -688,7 +688,9 @@ public class ColorSchemaReader {
for
(
int
i
=
0
;
i
<
columns
.
length
;
i
++)
{
boolean
found
=
false
;
for
(
ColorSchemaColumn
schemaColumn
:
ColorSchemaColumn
.
values
())
{
if
(
columns
[
i
].
trim
().
equalsIgnoreCase
(
schemaColumn
.
getTitle
())
&&
schemaColumn
.
getTypes
().
contains
(
type
))
{
if
((
columns
[
i
].
trim
().
equalsIgnoreCase
(
schemaColumn
.
getColumnName
())
||
columns
[
i
].
trim
().
equalsIgnoreCase
(
schemaColumn
.
getDepractedColumnName
()))
&&
schemaColumn
.
getTypes
().
contains
(
type
))
{
schemaColumns
.
put
(
schemaColumn
,
i
);
found
=
true
;
}
...
...
@@ -700,7 +702,7 @@ public class ColorSchemaReader {
String
columnNames
=
""
;
for
(
ColorSchemaColumn
schemaColumn
:
ColorSchemaColumn
.
values
())
{
if
(
schemaColumn
.
getTypes
().
contains
(
type
))
{
columnNames
+=
schemaColumn
.
get
Titl
e
()
+
", "
;
columnNames
+=
schemaColumn
.
get
ColumnNam
e
()
+
", "
;
}
}
for
(
String
string
:
acceptableIdentifiers
.
keySet
())
{
...
...
service/src/main/java/lcsb/mapviewer/services/utils/ColorSchemaXlsxReader.java
View file @
374f6a98
...
...
@@ -130,7 +130,7 @@ public class ColorSchemaXlsxReader {
String
value
=
cell
.
getStringCellValue
();
boolean
found
=
false
;
for
(
ColorSchemaColumn
schemaColumn
:
ColorSchemaColumn
.
values
())
{
if
(
value
.
trim
().
equalsIgnoreCase
(
schemaColumn
.
get
Titl
e
()))
{
if
(
value
.
trim
().
equalsIgnoreCase
(
schemaColumn
.
get
DepractedColumnName
())
||
value
.
trim
().
equalsIgnoreCase
(
schemaColumn
.
getColumnNam
e
()))
{
foundSchemaColumns
.
put
(
schemaColumn
,
columnIndex
-
1
);
found
=
true
;
break
;
...
...
@@ -143,7 +143,7 @@ public class ColorSchemaXlsxReader {
}
else
{
String
columnNames
=
""
;
for
(
ColorSchemaColumn
schemaColumn
:
ColorSchemaColumn
.
values
())
{
columnNames
+=
schemaColumn
.
get
Titl
e
()
+
", "
;
columnNames
+=
schemaColumn
.
get
ColumnNam
e
()
+
", "
;
}
for
(
String
string
:
acceptableIdentifiers
.
keySet
())
{
columnNames
+=
", "
+
string
;
...
...
@@ -174,8 +174,8 @@ public class ColorSchemaXlsxReader {
if
(
nameColumn
==
null
&&
identifierColumn
==
null
&&
foundCustomIdentifiers
.
size
()
==
0
&&
elementIdentifierColumn
==
null
)
{
throw
new
InvalidColorSchemaException
(
"One of these columns is obligatory: "
+
ColorSchemaColumn
.
NAME
.
get
Titl
e
()
+
","
+
ColorSchemaColumn
.
IDENTIFIER
.
get
Titl
e
()
+
","
+
ColorSchemaColumn
.
ELEMENT_IDENTIFIER
.
get
Titl
e
());
"One of these columns is obligatory: "
+
ColorSchemaColumn
.
NAME
.
get
ColumnNam
e
()
+
","
+
ColorSchemaColumn
.
IDENTIFIER
.
get
ColumnNam
e
()
+
","
+
ColorSchemaColumn
.
ELEMENT_IDENTIFIER
.
get
ColumnNam
e
());
}
if
(
valueColumn
==
null
&&
colorColumn
==
null
)
{
...
...
service/src/main/java/lcsb/mapviewer/services/utils/data/ColorSchemaColumn.java
View file @
374f6a98
...
...
@@ -19,41 +19,41 @@ public enum ColorSchemaColumn {
/**
* Name of the element.
*/
NAME
(
"name"
,
new
ColorSchemaType
[]
{
ColorSchemaType
.
GENERIC
,
ColorSchemaType
.
GENETIC_VARIANT
}),
NAME
(
new
ColorSchemaType
[]
{
ColorSchemaType
.
GENERIC
,
ColorSchemaType
.
GENETIC_VARIANT
}),
GENE_NAME
(
"gene_name"
,
new
ColorSchemaType
[]
{
ColorSchemaType
.
GENERIC
,
ColorSchemaType
.
GENETIC_VARIANT
}),
GENE_NAME
(
new
ColorSchemaType
[]
{
ColorSchemaType
.
GENERIC
,
ColorSchemaType
.
GENETIC_VARIANT
}),
/**
* Name of the element.
*/
MODEL_NAME
(
"model_name"
,
new
ColorSchemaType
[]
{
ColorSchemaType
.
GENERIC
,
ColorSchemaType
.
GENETIC_VARIANT
}),
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
}),
VALUE
(
new
ColorSchemaType
[]
{
ColorSchemaType
.
GENERIC
}),
/**
* In which compartment the element should be located.
*/
COMPARTMENT
(
"compartment"
,
new
ColorSchemaType
[]
{
ColorSchemaType
.
GENERIC
,
ColorSchemaType
.
GENETIC_VARIANT
}),
COMPARTMENT
(
new
ColorSchemaType
[]
{
ColorSchemaType
.
GENERIC
,
ColorSchemaType
.
GENETIC_VARIANT
}),
/**
* Class type of the element.
*/
TYPE
(
"type"
,
new
ColorSchemaType
[]
{
ColorSchemaType
.
GENERIC
,
ColorSchemaType
.
GENETIC_VARIANT
}),
TYPE
(
new
ColorSchemaType
[]
{
ColorSchemaType
.
GENERIC
,
ColorSchemaType
.
GENETIC_VARIANT
}),
/**
* New element/reaction color.
*/
COLOR
(
"color"
,
new
ColorSchemaType
[]
{
ColorSchemaType
.
GENERIC
,
ColorSchemaType
.
GENETIC_VARIANT
}),
COLOR
(
new
ColorSchemaType
[]
{
ColorSchemaType
.
GENERIC
,
ColorSchemaType
.
GENETIC_VARIANT
}),
/**
* Identifier of the element.
*/
IDENTIFIER
(
"identifier"
,
new
ColorSchemaType
[]
{
ColorSchemaType
.
GENERIC
,
ColorSchemaType
.
GENETIC_VARIANT
}),
IDENTIFIER
(
new
ColorSchemaType
[]
{
ColorSchemaType
.
GENERIC
,
ColorSchemaType
.
GENETIC_VARIANT
}),
/**
* Element identifier.
...
...
@@ -74,69 +74,85 @@ public enum ColorSchemaColumn {
/**
* Position where gene variants starts.
*/
POSITION
(
"position"
,
new
ColorSchemaType
[]
{
ColorSchemaType
.
GENETIC_VARIANT
}),
POSITION
(
new
ColorSchemaType
[]
{
ColorSchemaType
.
GENETIC_VARIANT
}),
/**
* Original DNA of the variant.
*/
ORIGINAL_DNA
(
"original_dna"
,
new
ColorSchemaType
[]
{
ColorSchemaType
.
GENETIC_VARIANT
}),
ORIGINAL_DNA
(
new
ColorSchemaType
[]
{
ColorSchemaType
.
GENETIC_VARIANT
}),
/**
* Alternative DNA of the variant.
*/
ALTERNATIVE_DNA
(
"alternative_dna"
,
new
ColorSchemaType
[]
{
ColorSchemaType
.
GENETIC_VARIANT
}),
ALTERNATIVE_DNA
(
new
ColorSchemaType
[]
{
ColorSchemaType
.
GENETIC_VARIANT
}),
/**
* Short description of the entry.
*/
DESCRIPTION
(
"description"
,
new
ColorSchemaType
[]
{
ColorSchemaType
.
GENETIC_VARIANT
,
ColorSchemaType
.
GENERIC
}),
DESCRIPTION
(
new
ColorSchemaType
[]
{
ColorSchemaType
.
GENETIC_VARIANT
,
ColorSchemaType
.
GENERIC
}),
/**
* Variant references.
*/
REFERENCES
(
"references"
,
new
ColorSchemaType
[]
{
ColorSchemaType
.
GENETIC_VARIANT
}),
REFERENCES
(
new
ColorSchemaType
[]
{
ColorSchemaType
.
GENETIC_VARIANT
}),
/**
* What's the {@link ReferenceGenomeType}.
*/
REFERENCE_GENOME_TYPE
(
"reference_genome_type"
,
new
ColorSchemaType
[]
{
ColorSchemaType
.
GENETIC_VARIANT
}),
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
}),
REFERENCE_GENOME_VERSION
(
new
ColorSchemaType
[]
{
ColorSchemaType
.
GENETIC_VARIANT
}),
/**
* Contig where variant was observed.
*/
CONTIG
(
"contig"
,
new
ColorSchemaType
[]
{
ColorSchemaType
.
GENETIC_VARIANT
}),
CONTIG
(
new
ColorSchemaType
[]
{
ColorSchemaType
.
GENETIC_VARIANT
}),
CHROMOSOME
(
"chromosome"
,
new
ColorSchemaType
[]
{
ColorSchemaType
.
GENETIC_VARIANT
}),
CHROMOSOME
(
new
ColorSchemaType
[]
{
ColorSchemaType
.
GENETIC_VARIANT
}),
ALLEL_FREQUENCY
(
"allele_frequency"
,
new
ColorSchemaType
[]
{
ColorSchemaType
.
GENETIC_VARIANT
}),
VARIANT_IDENTIFIER
(
"variant_identifier"
,
new
ColorSchemaType
[]
{
ColorSchemaType
.
GENETIC_VARIANT
}),
VARIANT_IDENTIFIER
(
new
ColorSchemaType
[]
{
ColorSchemaType
.
GENETIC_VARIANT
}),
/**
* Should the direction of reaction be reversed.
*/
REVERSE_REACTION
(
"reverseReaction"
,
new
ColorSchemaType
[]
{
ColorSchemaType
.
GENERIC
}),
/**
* Optional amino acid change in the variant.
* Optional amino acid change in the variant.
*/
AMINO_ACID_CHANGE
(
"amino_acid_change"
,
new
ColorSchemaType
[]
{
ColorSchemaType
.
GENETIC_VARIANT
});
AMINO_ACID_CHANGE
(
new
ColorSchemaType
[]
{
ColorSchemaType
.
GENETIC_VARIANT
});
/**
* Constructor that creates enum entry with deprecated column name.
*
* @param deprecatedColumnName
* {@link #deprecatedColumnName}
* @param types
* list of {@link ColorSchemaType types} where this column is allowed
* @deprecated As of release 12.3, replaced by {@link #ColorSchemaColumn(ColorSchemaType[])}
*/
@Deprecated
ColorSchemaColumn
(
String
deprecatedColumnName
,
ColorSchemaType
[]
types
)
{
this
.
deprecatedColumnName
=
deprecatedColumnName
;
for
(
ColorSchemaType
colorSchemaType
:
types
)
{
this
.
types
.
add
(
colorSchemaType
);
}
}
/**
* Default constructor that creates enum entry.
*
* @param
titl
e
* {@link #
titl
e}
* @param
deprecatedColumnNam
e
* {@link #
deprecatedColumnNam
e}
* @param types
* list of {@link ColorSchemaType types} where this column is allowed
*/
ColorSchemaColumn
(
String
title
,
ColorSchemaType
[]
types
)
{
this
.
title
=
title
;
ColorSchemaColumn
(
ColorSchemaType
[]
types
)
{
for
(
ColorSchemaType
colorSchemaType
:
types
)
{
this
.
types
.
add
(
colorSchemaType
);
}
...
...
@@ -145,7 +161,7 @@ public enum ColorSchemaColumn {
/**
* Human readable title used in input file.
*/
private
String
titl
e
;
private
String
deprecatedColumnNam
e
;
/**
* Set of types where column is allowed.
...
...
@@ -154,10 +170,16 @@ public enum ColorSchemaColumn {
/**
*
* @return {@link #title}
* @return {@link #deprecatedColumnName}
* @deprecated As of release 12.3, replaced by {@link #getColumnName()}
*/
public
String
getTitle
()
{
return
title
;
@Deprecated
public
String
getDepractedColumnName
()
{
return
deprecatedColumnName
;
}
public
String
getColumnName
()
{
return
this
.
name
().
toLowerCase
();
}
/**
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment