Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
minerva
core
Commits
8abf04b8
Commit
8abf04b8
authored
Dec 19, 2019
by
Piotr Gawron
Browse files
colouring by column identifier_xxx did not work for genetic variants
parent
0b3b120a
Pipeline
#17981
passed with stage
in 12 minutes and 12 seconds
Changes
4
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
CHANGELOG
View file @
8abf04b8
...
...
@@ -9,6 +9,8 @@ minerva (14.0.6) stable; urgency=medium
project removal doesn'
t
hang
(#
1058
)
*
Bug
fix
:
coloring
of
the
reaction
wasn
't applied to center of reaction
(regression 14.0.0, #1057)
* Bug fix: genetic variant overlay improperly processed elements identified
by miriam identifiers, like uniprot (#1059)
-- Piotr Gawron <piotr.gawron@uni.lu> Wed, 18 Dec 2019 12:00:00 +0200
...
...
service/src/main/java/lcsb/mapviewer/services/utils/ColorSchemaReader.java
View file @
8abf04b8
...
...
@@ -81,9 +81,7 @@ public class ColorSchemaReader {
if
(
Integer
.
valueOf
(
params
.
get
(
TextFileUtils
.
COLUMN_COUNT_PARAM
))
==
1
)
{
return
readSimpleNameColorSchema
(
colorInputStream
);
}
else
if
(
params
.
get
(
ZipEntryFileFactory
.
LAYOUT_HEADER_PARAM_TYPE
)
==
null
)
{
{
return
readGenericColorSchema
(
colorInputStream
);
}
return
readGenericColorSchema
(
colorInputStream
);
}
else
{
ColorSchemaType
type
=
null
;
try
{
...
...
@@ -393,10 +391,10 @@ public class ColorSchemaReader {
private
Collection
<
ColorSchema
>
mergeSchemas
(
Collection
<
ColorSchema
>
schemas
)
{
Map
<
String
,
ColorSchema
>
schemasByName
=
new
HashMap
<>();
for
(
ColorSchema
colorSchema
:
schemas
)
{
ColorSchema
mergedSchema
=
schemasByName
.
get
(
c
olorSchema
.
getName
(
));
ColorSchema
mergedSchema
=
schemasByName
.
get
(
getC
olorSchema
IdentifiablePart
(
colorSchema
));
if
(
mergedSchema
==
null
)
{
mergedSchema
=
colorSchema
.
copy
();
schemasByName
.
put
(
c
olorSchema
.
getName
(
),
mergedSchema
);
schemasByName
.
put
(
getC
olorSchema
IdentifiablePart
(
colorSchema
),
mergedSchema
);
}
else
{
if
(
mergedSchema
instanceof
GeneVariationColorSchema
)
{
if
(
colorSchema
instanceof
GeneVariationColorSchema
)
{
...
...
@@ -420,6 +418,16 @@ public class ColorSchemaReader {
return
schemasByName
.
values
();
}
private
String
getColorSchemaIdentifiablePart
(
ColorSchema
colorSchema
)
{
List
<
String
>
identifiers
=
new
ArrayList
<>();
for
(
MiriamData
md
:
colorSchema
.
getMiriamData
())
{
identifiers
.
add
(
md
.
toString
());
}
Collections
.
sort
(
identifiers
);
return
StringUtils
.
join
(
identifiers
,
"\n"
)
+
"\n"
+
colorSchema
.
getName
();
}
/**
* Gets color that should be assigned to {@link GeneVariationColorSchema}.
*
...
...
@@ -771,7 +779,7 @@ public class ColorSchemaReader {
if
(
schema
.
getLineWidth
()
!=
null
)
{
result
.
add
(
ColorSchemaColumn
.
LINE_WIDTH
);
}
if
(
schema
.
getName
(
)
!=
null
)
{
if
(
getColorSchemaIdentifiablePart
(
schema
)
!=
null
)
{
result
.
add
(
ColorSchemaColumn
.
NAME
);
}
if
(
schema
.
getModelName
()
!=
null
)
{
...
...
service/src/test/java/lcsb/mapviewer/services/utils/ColorSchemaReaderTest.java
View file @
8abf04b8
...
...
@@ -376,4 +376,18 @@ public class ColorSchemaReaderTest extends ServiceTestFunctions {
reader
.
readColorSchema
(
fis
,
TextFileUtils
.
getHeaderParametersFromFile
(
fis2
));
}
@Test
public
void
testGeneticVariantByUniprotIdentifier
()
throws
Exception
{
File
f
=
new
File
(
"testFiles/coloring/uniprot-identifiers.txt"
);
byte
[]
data
=
fileToByteArray
(
f
);
ByteArrayInputStream
bin
=
new
ByteArrayInputStream
(
data
);
Collection
<
ColorSchema
>
schemas
=
reader
.
readColorSchema
(
bin
,
TextFileUtils
.
getHeaderParametersFromFile
(
new
ByteArrayInputStream
(
data
)));
assertNotNull
(
schemas
);
assertEquals
(
2
,
schemas
.
size
());
}
}
service/testFiles/coloring/uniprot-identifiers.txt
0 → 100644
View file @
8abf04b8
#TYPE=GENETIC_VARIANT
#GENOME_VERSION=hg19
#GENOME_TYPE=UCSC
position original_DNA alternative_DNA contig allele_frequency color identifier_uniprot
90648003 T G 4 0.3750000 #e58e00 P14416
90656320 T C 4 0.7034621 #e58e00 P14416
90755218 G A 4 0.1379310 #e58ec5 P02511
161709831 G T 6 0.6025862 #e58ec5 P02511
162525131 G T 6 0.7025762 #e58ec5 P02511
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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