Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Devrim Gunyel
core
Commits
5d252147
Commit
5d252147
authored
Jun 06, 2019
by
Piotr Gawron
Browse files
genetic variant overlay without name caused problems
parent
a43d12fa
Changes
4
Hide whitespace changes
Inline
Side-by-side
CHANGELOG
View file @
5d252147
minerva
(
12.3.1
~
beta
.1
)
unstable
;
urgency
=
low
*
Bug
fix
:
invalid
color
in
data
overlay
provides
proper
feedback
to
the
user
(#
822
)
*
Bug
fix
:
genetic
variant
overlay
without
name
caused
problems
(#
832
)
*
Bug
fix
:
tair
locus
identifiers
were
used
improperly
-
instead
of
id
the
name
was
used
*
Bug
fix
:
plugin
tab
header
wasn
't properly resized after adding plugins
...
...
service/src/main/java/lcsb/mapviewer/services/utils/ColorSchemaReader.java
View file @
5d252147
...
...
@@ -292,7 +292,7 @@ public class ColorSchemaReader {
gv
.
setContig
(
values
[
contigColumn
]);
schema
.
addGeneVariation
(
gv
);
if
(
schema
.
getName
().
contains
(
";"
))
{
if
(
schema
.
getName
()!=
null
&&
schema
.
getName
().
contains
(
";"
))
{
String
[]
names
=
schema
.
getName
().
split
(
";"
);
for
(
String
string
:
names
)
{
if
(!
string
.
trim
().
isEmpty
())
{
...
...
service/src/test/java/lcsb/mapviewer/services/utils/ColorSchemaReaderTest.java
View file @
5d252147
...
...
@@ -11,6 +11,8 @@ import java.awt.Color;
import
java.io.ByteArrayInputStream
;
import
java.io.File
;
import
java.io.FileInputStream
;
import
java.io.FileNotFoundException
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.nio.charset.StandardCharsets
;
import
java.util.Collection
;
...
...
@@ -75,21 +77,27 @@ public class ColorSchemaReaderTest extends ServiceTestFunctions {
public
void
testReadGeneVariantsSchema
()
throws
Exception
{
try
{
File
f
=
new
File
(
"testFiles/coloring/gene_variants.txt"
);
InputStream
in
=
new
FileInputStream
(
f
);
byte
[]
data
=
fileToByteArray
(
f
);
byte
[]
buff
=
new
byte
[
8000
];
int
bytesRead
=
0
;
ByteArrayInputStream
bin
=
new
ByteArrayInputStream
(
data
);
ByteArrayOutputStream
bao
=
new
ByteArrayOutputStream
();
ColorSchemaReader
reader
=
new
ColorSchemaReader
();
while
((
bytesRead
=
in
.
read
(
buff
))
!=
-
1
)
{
bao
.
write
(
buff
,
0
,
bytesRead
);
}
in
.
close
();
bao
.
close
();
Collection
<
ColorSchema
>
schemas
=
reader
.
readColorSchema
(
bin
,
TextFileUtils
.
getHeaderParametersFromFile
(
new
ByteArrayInputStream
(
data
)));
assertNotNull
(
schemas
);
assertEquals
(
3
,
schemas
.
size
());
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
throw
e
;
}
}
byte
[]
data
=
bao
.
toByteArray
();
@Test
public
void
testReadGeneVariantByIdSchema
()
throws
Exception
{
try
{
File
f
=
new
File
(
"testFiles/coloring/gene_variants_id.txt"
);
byte
[]
data
=
fileToByteArray
(
f
);
ByteArrayInputStream
bin
=
new
ByteArrayInputStream
(
data
);
...
...
@@ -98,32 +106,37 @@ public class ColorSchemaReaderTest extends ServiceTestFunctions {
Collection
<
ColorSchema
>
schemas
=
reader
.
readColorSchema
(
bin
,
TextFileUtils
.
getHeaderParametersFromFile
(
new
ByteArrayInputStream
(
data
)));
assertNotNull
(
schemas
);
assertEquals
(
3
,
schemas
.
size
());
assertEquals
(
1
,
schemas
.
size
());
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
throw
e
;
}
}
@Test
public
void
testReadGeneVariantsWithAminoAcidChange
()
throws
Exception
{
try
{
File
f
=
new
File
(
"testFiles/coloring/gene_variants_aa_change.txt"
);
InputStream
in
=
new
FileInputStream
(
f
);
private
byte
[]
fileToByteArray
(
File
f
)
throws
FileNotFoundException
,
IOException
{
InputStream
in
=
new
FileInputStream
(
f
);
byte
[]
buff
=
new
byte
[
8000
];
byte
[]
buff
=
new
byte
[
8000
];
int
bytesRead
=
0
;
int
bytesRead
=
0
;
ByteArrayOutputStream
bao
=
new
ByteArrayOutputStream
();
ByteArrayOutputStream
bao
=
new
ByteArrayOutputStream
();
while
((
bytesRead
=
in
.
read
(
buff
))
!=
-
1
)
{
bao
.
write
(
buff
,
0
,
bytesRead
);
}
in
.
close
();
bao
.
close
();
while
((
bytesRead
=
in
.
read
(
buff
))
!=
-
1
)
{
bao
.
write
(
buff
,
0
,
bytesRead
);
}
in
.
close
();
bao
.
close
();
byte
[]
data
=
bao
.
toByteArray
();
byte
[]
data
=
bao
.
toByteArray
();
return
data
;
}
@Test
public
void
testReadGeneVariantsWithAminoAcidChange
()
throws
Exception
{
try
{
File
f
=
new
File
(
"testFiles/coloring/gene_variants_aa_change.txt"
);
byte
[]
data
=
fileToByteArray
(
f
);
ByteArrayInputStream
bin
=
new
ByteArrayInputStream
(
data
);
...
...
@@ -151,21 +164,7 @@ public class ColorSchemaReaderTest extends ServiceTestFunctions {
public
void
testReadGeneVariantsWithNewNamingSchema
()
throws
Exception
{
try
{
File
f
=
new
File
(
"testFiles/coloring/gene_variants_new_naming.txt"
);
InputStream
in
=
new
FileInputStream
(
f
);
byte
[]
buff
=
new
byte
[
8000
];
int
bytesRead
=
0
;
ByteArrayOutputStream
bao
=
new
ByteArrayOutputStream
();
while
((
bytesRead
=
in
.
read
(
buff
))
!=
-
1
)
{
bao
.
write
(
buff
,
0
,
bytesRead
);
}
in
.
close
();
bao
.
close
();
byte
[]
data
=
bao
.
toByteArray
();
byte
[]
data
=
fileToByteArray
(
f
);
ByteArrayInputStream
bin
=
new
ByteArrayInputStream
(
data
);
...
...
@@ -185,21 +184,7 @@ public class ColorSchemaReaderTest extends ServiceTestFunctions {
public
void
testReadGeneVariantsSchemaWithAF
()
throws
Exception
{
try
{
File
f
=
new
File
(
"testFiles/coloring/gene_variants_all_freq.txt"
);
InputStream
in
=
new
FileInputStream
(
f
);
byte
[]
buff
=
new
byte
[
8000
];
int
bytesRead
=
0
;
ByteArrayOutputStream
bao
=
new
ByteArrayOutputStream
();
while
((
bytesRead
=
in
.
read
(
buff
))
!=
-
1
)
{
bao
.
write
(
buff
,
0
,
bytesRead
);
}
in
.
close
();
bao
.
close
();
byte
[]
data
=
bao
.
toByteArray
();
byte
[]
data
=
fileToByteArray
(
f
);
ByteArrayInputStream
bin
=
new
ByteArrayInputStream
(
data
);
...
...
service/testFiles/coloring/gene_variants_id.txt
0 → 100644
View file @
5d252147
#TYPE=GENETIC_VARIANT
#GENOME_TYPE=UCSC
#GENOME_VERSION=hg38
position original_dna alternative_dna Entrez gene description color contig
10146 AC A 123456 upstream #ff0000 chr1
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