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
5285c25e
Commit
5285c25e
authored
Sep 03, 2021
by
Piotr Gawron
Browse files
chemicals by target search returned resoults not bound by disease
parent
8e4031af
Pipeline
#46533
failed with stage
in 21 minutes and 41 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
CHANGELOG
View file @
5285c25e
minerva
(
16.0.0
~
beta
.2
)
stable
;
urgency
=
medium
*
Bug
fix
:
search
chemicals
by
target
returned
chemicals
not
bounded
by
disease
(#
1535
)
*
Bug
fix
:
problem
with
export
map
with
submaps
fixed
(#
1540
)
--
Piotr
Gawron
<
piotr
.
gawron
@
uni
.
lu
>
Fri
,
3
Sep
2021
11
:
00
:
00
+
0200
...
...
annotation/src/main/java/lcsb/mapviewer/annotation/data/Chemical.java
View file @
5285c25e
package
lcsb.mapviewer.annotation.data
;
import
java.io.Serializable
;
import
java.util.*
;
import
java.util.ArrayList
;
import
java.util.Collection
;
import
java.util.Comparator
;
import
java.util.List
;
import
java.util.Set
;
import
javax.xml.bind.annotation.XmlRootElement
;
...
...
@@ -319,4 +323,12 @@ public class Chemical implements Serializable, TargettingStructure {
this
.
getTargets
().
removeAll
(
targetsToRemove
);
}
public
boolean
containsTarget
(
MiriamData
miriamTarget
)
{
boolean
result
=
false
;
for
(
Target
target
:
getTargets
())
{
result
|=
target
.
getGenes
().
contains
(
miriamTarget
);
}
return
result
;
}
}
annotation/src/main/java/lcsb/mapviewer/annotation/services/dapi/ChemicalParser.java
View file @
5285c25e
...
...
@@ -2,7 +2,15 @@ package lcsb.mapviewer.annotation.services.dapi;
import
java.io.IOException
;
import
java.net.URLEncoder
;
import
java.util.*
;
import
java.util.ArrayList
;
import
java.util.Collection
;
import
java.util.Collections
;
import
java.util.HashMap
;
import
java.util.HashSet
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Objects
;
import
java.util.Set
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Logger
;
...
...
@@ -14,10 +22,14 @@ import com.fasterxml.jackson.databind.ObjectMapper;
import
lcsb.mapviewer.annotation.data.Chemical
;
import
lcsb.mapviewer.annotation.data.Target
;
import
lcsb.mapviewer.annotation.services.dapi.dto.*
;
import
lcsb.mapviewer.annotation.services.dapi.dto.ChemicalEntityDto
;
import
lcsb.mapviewer.annotation.services.dapi.dto.ChemicalEntityDtoConverter
;
import
lcsb.mapviewer.annotation.services.dapi.dto.ListChemicalEntityDto
;
import
lcsb.mapviewer.common.exception.InvalidArgumentException
;
import
lcsb.mapviewer.model.Project
;
import
lcsb.mapviewer.model.map.*
;
import
lcsb.mapviewer.model.map.BioEntity
;
import
lcsb.mapviewer.model.map.MiriamData
;
import
lcsb.mapviewer.model.map.MiriamType
;
import
lcsb.mapviewer.model.map.model.ModelData
;
import
lcsb.mapviewer.model.map.model.ModelSubmodelConnection
;
...
...
@@ -137,8 +149,10 @@ public class ChemicalParser {
ListChemicalEntityDto
dto
=
objectMapper
.
readValue
(
content
,
ListChemicalEntityDto
.
class
);
List
<
Chemical
>
chemicals
=
fetchChemicals
(
dto
,
disease
);
for
(
Chemical
drug
:
chemicals
)
{
result
.
put
(
drug
.
getChemicalId
(),
drug
);
for
(
Chemical
chemical
:
chemicals
)
{
if
(
chemical
.
containsTarget
(
target
))
{
result
.
put
(
chemical
.
getChemicalId
(),
chemical
);
}
}
}
return
new
ArrayList
<>(
result
.
values
());
...
...
@@ -183,8 +197,10 @@ public class ChemicalParser {
}
Set
<
String
>
names
=
new
HashSet
<>();
for
(
MiriamData
hgncSymbol
:
hgncSymbols
)
{
// fetching all chemicals for big map is very memory exhaustive, therefore do it
// step by step to prevent storing everything in the memory at single point
// fetching all chemicals for big map is very memory exhaustive, therefore
// do it
// step by step to prevent storing everything in the memory at single
// point
List
<
Chemical
>
chemicals
=
getChemicalListByTarget
(
hgncSymbol
,
diseaseMiriam
);
for
(
Chemical
chemical
:
chemicals
)
{
names
.
add
(
chemical
.
getChemicalName
());
...
...
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