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
dc2cc206
Commit
dc2cc206
authored
Oct 28, 2019
by
Piotr Gawron
Browse files
Merge branch '325-admin-panel-structured-log' into 'master'
Resolve "Admin panel: structured log" Closes #325 See merge request
minerva/core!983
parents
6ce765c9
e6de34f7
Changes
42
Hide whitespace changes
Inline
Side-by-side
CHANGELOG
View file @
dc2cc206
minerva
(
15.0.0
~
alpha
.0
)
stable
;
urgency
=
medium
*
Improvement
:
logs
provided
for
validation
data
model
are
structurized
(#
325
)
*
Small
improvement
:
when
downloading
a
map
results
in
too
big
file
(>
1
MB
)
the
content
is
compressed
and
returned
as
a
zip
file
(#
348
)
*
Small
improvement
:
confirmation
dialog
when
removing
"general view"
...
...
annotation/src/main/java/lcsb/mapviewer/annotation/services/ImproperAnnotations.java
View file @
dc2cc206
...
...
@@ -3,10 +3,13 @@ package lcsb.mapviewer.annotation.services;
import
java.util.ArrayList
;
import
java.util.List
;
import
org.apache.logging.log4j.Marker
;
import
lcsb.mapviewer.common.exception.InvalidArgumentException
;
import
lcsb.mapviewer.model.LogMarker
;
import
lcsb.mapviewer.model.ProjectLogEntryType
;
import
lcsb.mapviewer.model.map.BioEntity
;
import
lcsb.mapviewer.model.map.MiriamData
;
import
lcsb.mapviewer.modelutils.map.ElementUtils
;
/**
* Class describing improper annotation. All elements are annotated in the
...
...
@@ -35,7 +38,7 @@ public class ImproperAnnotations implements ProblematicAnnotation {
* @param list
* list of improper {@link MiriamData}
* @param bioEntity
* bioentity
* bio
entity
*/
public
ImproperAnnotations
(
BioEntity
bioEntity
,
List
<
MiriamData
>
list
)
{
if
(
list
.
size
()
==
0
)
{
...
...
@@ -61,8 +64,7 @@ public class ImproperAnnotations implements ProblematicAnnotation {
@Override
public
String
getMessage
()
{
StringBuilder
result
=
new
StringBuilder
(
new
ElementUtils
().
getElementTag
(
bioEntity
));
result
.
append
(
"contains invalid annotations: "
);
StringBuilder
result
=
new
StringBuilder
(
"Invalid annotations found: "
);
for
(
MiriamData
miriamData
:
wrongAnnotations
)
{
result
.
append
(
miriamData
.
getDataType
().
getCommonName
()
+
"("
+
miriamData
.
getResource
()
+
"), "
);
}
...
...
@@ -74,4 +76,9 @@ public class ImproperAnnotations implements ProblematicAnnotation {
return
getMessage
();
}
@Override
public
Marker
getLogMarker
()
{
return
new
LogMarker
(
ProjectLogEntryType
.
INVALID_ANNOTATION
,
bioEntity
);
}
}
annotation/src/main/java/lcsb/mapviewer/annotation/services/MissingAnnotation.java
View file @
dc2cc206
package
lcsb.mapviewer.annotation.services
;
import
org.apache.logging.log4j.Marker
;
import
lcsb.mapviewer.model.LogMarker
;
import
lcsb.mapviewer.model.ProjectLogEntryType
;
import
lcsb.mapviewer.model.map.BioEntity
;
import
lcsb.mapviewer.modelutils.map.ElementUtils
;
...
...
@@ -29,7 +33,7 @@ public class MissingAnnotation implements ProblematicAnnotation {
@Override
public
String
getMessage
()
{
return
new
ElementUtils
().
getElementTag
(
bioEntity
)
+
"misses
annotations."
;
return
"Missing
annotations."
;
}
@Override
...
...
@@ -37,4 +41,9 @@ public class MissingAnnotation implements ProblematicAnnotation {
return
getMessage
();
}
@Override
public
Marker
getLogMarker
()
{
return
new
LogMarker
(
ProjectLogEntryType
.
MISSING_ANNOTATION
,
bioEntity
);
}
}
annotation/src/main/java/lcsb/mapviewer/annotation/services/MissingRequiredAnnotations.java
View file @
dc2cc206
...
...
@@ -2,7 +2,11 @@ package lcsb.mapviewer.annotation.services;
import
java.util.*
;
import
org.apache.logging.log4j.Marker
;
import
lcsb.mapviewer.common.exception.InvalidArgumentException
;
import
lcsb.mapviewer.model.LogMarker
;
import
lcsb.mapviewer.model.ProjectLogEntryType
;
import
lcsb.mapviewer.model.map.*
;
import
lcsb.mapviewer.modelutils.map.ElementUtils
;
...
...
@@ -44,8 +48,7 @@ public class MissingRequiredAnnotations implements ProblematicAnnotation {
@Override
public
String
getMessage
()
{
StringBuilder
result
=
new
StringBuilder
(
new
ElementUtils
().
getElementTag
(
bioEntity
));
result
.
append
(
"misses one of the following annotations: "
);
StringBuilder
result
=
new
StringBuilder
(
"Missing one of the required annotations: "
);
for
(
MiriamType
type
:
requiredMiriamType
)
{
result
.
append
(
type
.
getCommonName
()
+
", "
);
}
...
...
@@ -57,4 +60,9 @@ public class MissingRequiredAnnotations implements ProblematicAnnotation {
return
getMessage
();
}
@Override
public
Marker
getLogMarker
()
{
return
new
LogMarker
(
ProjectLogEntryType
.
MISSING_REQUIRED_ANNOTATION
,
bioEntity
);
}
}
annotation/src/main/java/lcsb/mapviewer/annotation/services/ModelAnnotator.java
View file @
dc2cc206
...
...
@@ -12,6 +12,7 @@ import lcsb.mapviewer.annotation.services.annotators.AnnotatorException;
import
lcsb.mapviewer.annotation.services.annotators.ElementAnnotator
;
import
lcsb.mapviewer.common.IProgressUpdater
;
import
lcsb.mapviewer.common.exception.InvalidArgumentException
;
import
lcsb.mapviewer.model.LogMarker
;
import
lcsb.mapviewer.model.map.*
;
import
lcsb.mapviewer.model.map.model.Model
;
import
lcsb.mapviewer.model.map.reaction.Reaction
;
...
...
@@ -244,7 +245,7 @@ public class ModelAnnotator {
public
Collection
<
ImproperAnnotations
>
findImproperAnnotations
(
Model
m
,
IProgressUpdater
updater
,
Map
<
Class
<?
extends
BioEntity
>,
Set
<
MiriamType
>>
validAnnotations
)
{
if
(
validAnnotations
==
null
)
{
logger
.
warn
(
"List of valid annotations is missing. Using default."
);
logger
.
warn
(
LogMarker
.
IGNORE
,
"List of valid annotations is missing. Using default."
);
validAnnotations
=
getDefaultValidClasses
();
}
updater
.
setProgress
(
0.0
);
...
...
@@ -310,14 +311,14 @@ public class ModelAnnotator {
* model where the search is performed
* @param requestedAnnotations
* map that contains information which {@link MiriamType miriam types}
* are obigatory for which class
* are ob
l
igatory for which class
*
* @return list of all elements that miss annotation
*/
public
Collection
<
ProblematicAnnotation
>
findMissingAnnotations
(
Model
m
,
Map
<
Class
<?
extends
BioEntity
>,
Set
<
MiriamType
>>
requestedAnnotations
)
{
if
(
requestedAnnotations
==
null
)
{
logger
.
warn
(
"List of requested annotations is missing. Using default."
);
logger
.
warn
(
LogMarker
.
IGNORE
,
"List of requested annotations is missing. Using default."
);
requestedAnnotations
=
getDefaultRequiredClasses
();
}
List
<
ProblematicAnnotation
>
result
=
new
ArrayList
<>();
...
...
annotation/src/main/java/lcsb/mapviewer/annotation/services/ProblematicAnnotation.java
View file @
dc2cc206
package
lcsb.mapviewer.annotation.services
;
import
org.apache.logging.log4j.Marker
;
/**
* Interface that describes annotation that is problematic.
*
...
...
@@ -14,4 +16,6 @@ public interface ProblematicAnnotation {
* @return problem error message
*/
String
getMessage
();
Marker
getLogMarker
();
}
annotation/src/main/java/lcsb/mapviewer/annotation/services/annotators/BrendaAnnotator.java
View file @
dc2cc206
...
...
@@ -11,6 +11,7 @@ import lcsb.mapviewer.annotation.cache.GeneralCacheInterface;
import
lcsb.mapviewer.annotation.cache.WebPageDownloader
;
import
lcsb.mapviewer.annotation.services.*
;
import
lcsb.mapviewer.common.exception.NotImplementedException
;
import
lcsb.mapviewer.model.ProjectLogEntryType
;
import
lcsb.mapviewer.model.map.MiriamData
;
import
lcsb.mapviewer.model.map.MiriamType
;
import
lcsb.mapviewer.model.map.species.*
;
...
...
@@ -96,7 +97,8 @@ public class BrendaAnnotator extends ElementAnnotator implements IExternalServic
}
}
}
catch
(
UniprotSearchException
e
)
{
logger
.
warn
(
"Cannot find EC data for UniProt id: "
+
mdUniprot
.
getResource
());
logger
.
warn
(
object
.
getLogMarker
(
ProjectLogEntryType
.
CANNOT_FIND_INFORMATION
),
"Cannot find EC data for UniProt id: "
+
mdUniprot
.
getResource
());
}
}
...
...
annotation/src/main/java/lcsb/mapviewer/annotation/services/annotators/CazyAnnotator.java
View file @
dc2cc206
...
...
@@ -15,6 +15,8 @@ import lcsb.mapviewer.annotation.cache.WebPageDownloader;
import
lcsb.mapviewer.annotation.services.*
;
import
lcsb.mapviewer.common.exception.InvalidArgumentException
;
import
lcsb.mapviewer.common.exception.NotImplementedException
;
import
lcsb.mapviewer.model.LogMarker
;
import
lcsb.mapviewer.model.ProjectLogEntryType
;
import
lcsb.mapviewer.model.map.MiriamData
;
import
lcsb.mapviewer.model.map.MiriamType
;
import
lcsb.mapviewer.model.map.species.*
;
...
...
@@ -59,7 +61,7 @@ public class CazyAnnotator extends ElementAnnotator implements IExternalService
this
.
setCache
(
null
);
try
{
MiriamData
md
=
uniprotToCazy
(
getExampleValidAnnotation
());
MiriamData
md
=
uniprotToCazy
(
getExampleValidAnnotation
()
,
new
LogMarker
(
ProjectLogEntryType
.
OTHER
,
new
GenericProtein
(
""
))
);
status
.
setStatus
(
ExternalServiceStatusType
.
OK
);
if
(
md
==
null
||
!
md
.
getResource
().
equalsIgnoreCase
(
"GH5_7"
))
{
...
...
@@ -86,7 +88,7 @@ public class CazyAnnotator extends ElementAnnotator implements IExternalService
}
List
<
String
>
cazyIds
=
new
ArrayList
<
String
>();
for
(
MiriamData
mdUniprot
:
mdUniprots
)
{
MiriamData
mdCazy
=
uniprotToCazy
(
mdUniprot
);
MiriamData
mdCazy
=
uniprotToCazy
(
mdUniprot
,
object
.
getLogMarker
(
ProjectLogEntryType
.
OTHER
)
);
if
(
mdCazy
!=
null
&&
cazyIds
.
indexOf
(
mdCazy
.
getResource
())
==
-
1
)
{
cazyIds
.
add
(
mdCazy
.
getResource
());
object
.
addMiriamData
(
mdCazy
);
...
...
@@ -158,7 +160,7 @@ public class CazyAnnotator extends ElementAnnotator implements IExternalService
* @throws AnnotatorException
* thrown when there is a problem with accessing external database
*/
public
MiriamData
uniprotToCazy
(
MiriamData
uniprot
)
throws
AnnotatorException
{
public
MiriamData
uniprotToCazy
(
MiriamData
uniprot
,
LogMarker
marker
)
throws
AnnotatorException
{
if
(
uniprot
==
null
)
{
return
null
;
}
...
...
@@ -174,11 +176,13 @@ public class CazyAnnotator extends ElementAnnotator implements IExternalService
if
(
collection
.
size
()
>
0
)
{
return
collection
.
iterator
().
next
();
}
else
{
logger
.
warn
(
"Cannot find CAZy data for UniProt id: "
+
uniprot
.
getResource
());
marker
.
getEntry
().
setType
(
ProjectLogEntryType
.
INVALID_IDENTIFIER
);
logger
.
warn
(
marker
,
"Cannot find CAZy data for UniProt id: "
+
uniprot
.
getResource
());
return
null
;
}
}
catch
(
WrongResponseCodeIOException
exception
)
{
logger
.
warn
(
"Wrong response code when retrieving CAZy data for UniProt id: "
+
uniprot
.
getResource
());
marker
.
getEntry
().
setType
(
ProjectLogEntryType
.
OTHER
);
logger
.
warn
(
marker
,
"Wrong response code when retrieving CAZy data for UniProt id: "
+
uniprot
.
getResource
());
return
null
;
}
catch
(
IOException
exception
)
{
throw
new
AnnotatorException
(
exception
);
...
...
annotation/src/main/java/lcsb/mapviewer/annotation/services/annotators/ChebiAnnotator.java
View file @
dc2cc206
...
...
@@ -12,6 +12,7 @@ import lcsb.mapviewer.annotation.cache.*;
import
lcsb.mapviewer.annotation.data.Chebi
;
import
lcsb.mapviewer.annotation.services.*
;
import
lcsb.mapviewer.common.exception.InvalidArgumentException
;
import
lcsb.mapviewer.model.ProjectLogEntryType
;
import
lcsb.mapviewer.model.map.*
;
import
lcsb.mapviewer.model.map.species.Chemical
;
import
lcsb.mapviewer.model.user.annotator.*
;
...
...
@@ -449,7 +450,8 @@ public class ChebiAnnotator extends ElementAnnotator implements IExternalService
element
.
addMiriamData
(
chebi
);
return
annotateElement
(
element
,
chebi
,
parameters
);
}
else
{
logger
.
warn
(
element
.
getElementTag
()
+
"Chemical name cannot be found in chebi: "
+
name
);
logger
.
warn
(
element
.
getLogMarker
(
ProjectLogEntryType
.
CANNOT_FIND_INFORMATION
),
"Chemical name cannot be found in chebi: "
+
name
);
return
false
;
}
}
catch
(
Exception
e
)
{
...
...
annotation/src/main/java/lcsb/mapviewer/annotation/services/annotators/ElementAnnotator.java
View file @
dc2cc206
...
...
@@ -10,13 +10,14 @@ import lcsb.mapviewer.common.comparator.StringSetComparator;
import
lcsb.mapviewer.common.exception.InvalidArgumentException
;
import
lcsb.mapviewer.common.exception.NotImplementedException
;
import
lcsb.mapviewer.converter.model.celldesigner.structure.CellDesignerChemical
;
import
lcsb.mapviewer.model.LogMarker
;
import
lcsb.mapviewer.model.ProjectLogEntryType
;
import
lcsb.mapviewer.model.map.*
;
import
lcsb.mapviewer.model.map.reaction.Reaction
;
import
lcsb.mapviewer.model.map.species.*
;
import
lcsb.mapviewer.model.map.species.field.UniprotRecord
;
import
lcsb.mapviewer.model.user.AnnotatorParamDefinition
;
import
lcsb.mapviewer.model.user.annotator.*
;
import
lcsb.mapviewer.modelutils.map.ElementUtils
;
/**
* Interface that allows to annotate {@link BioEntity elements} in the system.
...
...
@@ -132,12 +133,12 @@ public abstract class ElementAnnotator extends CachableInterface {
AnnotatorData
parameters
)
throws
AnnotatorException
;
public
boolean
annotateElement
(
BioEntityProxy
element
,
String
name
,
AnnotatorData
parameters
)
public
boolean
annotateElement
(
BioEntityProxy
element
,
String
name
,
AnnotatorData
parameters
)
throws
AnnotatorException
{
throw
new
NotImplementedException
();
}
/**
/**
* Returns a list of all classes that can be annotated using this annotator.
*
* @return a list of all classes that can be annotated using this annotator
...
...
@@ -353,8 +354,10 @@ public boolean annotateElement(BioEntityProxy element, String name, AnnotatorDat
return
originalBioEntity
.
getMiriamData
().
contains
(
copy
)
||
originalBioEntity
.
getMiriamData
().
contains
(
copy2
);
}
public
String
getElementTag
()
{
return
new
ElementUtils
().
getElementTag
(
originalBioEntity
,
ElementAnnotator
.
this
);
public
LogMarker
getLogMarker
(
ProjectLogEntryType
type
)
{
LogMarker
result
=
new
LogMarker
(
type
,
originalBioEntity
);
result
.
getEntry
().
setSource
(
ElementAnnotator
.
this
.
getClass
().
getSimpleName
());
return
result
;
}
public
boolean
isElement
()
{
...
...
@@ -408,7 +411,8 @@ public boolean annotateElement(BioEntityProxy element, String name, AnnotatorDat
set2
.
addAll
(
oldCollection
);
if
(
stringSetComparator
.
compare
(
set1
,
set2
)
!=
0
)
{
logger
.
warn
(
getElementTag
()
+
field
.
getCommonName
()
+
" don't match: \""
+
set1
+
"\", \""
+
set2
+
"\""
);
logger
.
warn
(
getLogMarker
(
ProjectLogEntryType
.
ANNOTATION_CONFLICT
),
field
.
getCommonName
()
+
" don't match: \""
+
set1
+
"\", \""
+
set2
+
"\""
);
return
false
;
}
return
true
;
...
...
@@ -440,7 +444,8 @@ public boolean annotateElement(BioEntityProxy element, String name, AnnotatorDat
if
(
oldValue
==
null
||
oldValue
.
trim
().
equals
(
""
)
||
oldValue
.
equals
(
newValue
))
{
return
true
;
}
else
{
logger
.
warn
(
getElementTag
(
field
)
+
" doesn't match: \""
+
newValue
+
"\", \""
+
oldValue
+
"\""
);
logger
.
warn
(
getLogMarker
(
ProjectLogEntryType
.
ANNOTATION_CONFLICT
),
field
.
getCommonName
()
+
" doesn't match: \""
+
newValue
+
"\", \""
+
oldValue
+
"\""
);
return
false
;
}
}
...
...
@@ -455,15 +460,12 @@ public boolean annotateElement(BioEntityProxy element, String name, AnnotatorDat
if
(
oldValue
==
null
||
oldValue
==
0
||
oldValue
.
toString
().
equals
(
newValue
))
{
return
true
;
}
else
{
logger
.
warn
(
getElementTag
(
field
)
+
" doesn't match: \""
+
newValue
+
"\", \""
+
oldValue
+
"\""
);
logger
.
warn
(
getLogMarker
(
ProjectLogEntryType
.
ANNOTATION_CONFLICT
),
field
.
getCommonName
()
+
" doesn't match: \""
+
newValue
+
"\", \""
+
oldValue
+
"\""
);
return
false
;
}
}
private
String
getElementTag
(
BioEntityField
field
)
{
return
getElementTag
()
+
" "
+
field
.
getCommonName
();
}
public
void
setFormerSymbols
(
Collection
<
String
>
formerSymbols
)
{
if
(
originalBioEntity
instanceof
Element
)
{
Element
element
=
(
Element
)
originalBioEntity
;
...
...
@@ -521,7 +523,7 @@ public boolean annotateElement(BioEntityProxy element, String name, AnnotatorDat
try
{
md
=
MiriamType
.
getMiriamByUri
(
"urn:miriam:"
+
generalIdentifier
);
}
catch
(
InvalidArgumentException
e1
)
{
logger
.
warn
(
get
ElementTag
()
+
"Unknown miriam uri: "
+
generalIdentifier
);
logger
.
warn
(
get
LogMarker
(
ProjectLogEntryType
.
INVALID_IDENTIFIER
),
"Unknown miriam uri: "
+
generalIdentifier
);
}
}
addMiriamData
(
md
);
...
...
annotation/src/main/java/lcsb/mapviewer/annotation/services/annotators/EnsemblAnnotator.java
View file @
dc2cc206
...
...
@@ -15,6 +15,7 @@ import lcsb.mapviewer.annotation.services.*;
import
lcsb.mapviewer.common.XmlParser
;
import
lcsb.mapviewer.common.exception.InvalidXmlSchemaException
;
import
lcsb.mapviewer.common.exception.NotImplementedException
;
import
lcsb.mapviewer.model.ProjectLogEntryType
;
import
lcsb.mapviewer.model.map.MiriamData
;
import
lcsb.mapviewer.model.map.MiriamType
;
import
lcsb.mapviewer.model.map.species.*
;
...
...
@@ -134,7 +135,7 @@ public class EnsemblAnnotator extends ElementAnnotator implements IExternalServi
if
(
node
.
getNodeName
().
equals
(
"data"
))
{
String
error
=
XmlParser
.
getNodeAttr
(
"error"
,
node
);
if
(
error
!=
null
&&
!
error
.
isEmpty
())
{
logger
.
warn
(
element
.
get
ElementTag
()
+
error
);
logger
.
warn
(
element
.
get
LogMarker
(
ProjectLogEntryType
.
OTHER
),
error
);
}
String
dbname
=
XmlParser
.
getNodeAttr
(
"dbname"
,
node
);
...
...
@@ -188,8 +189,8 @@ public class EnsemblAnnotator extends ElementAnnotator implements IExternalServi
}
return
true
;
}
catch
(
WrongResponseCodeIOException
e
)
{
logger
.
warn
(
element
.
getElementTag
()
+
"Cannot find information for ensembl: "
+
identifier
.
getResource
());
logger
.
warn
(
element
.
getLogMarker
(
ProjectLogEntryType
.
CANNOT_FIND_INFORMATION
),
"Cannot find information for ensembl: "
+
identifier
.
getResource
());
return
false
;
}
catch
(
Exception
e
)
{
throw
new
AnnotatorException
(
e
);
...
...
annotation/src/main/java/lcsb/mapviewer/annotation/services/annotators/EntrezAnnotator.java
View file @
dc2cc206
...
...
@@ -16,6 +16,8 @@ import lcsb.mapviewer.annotation.data.EntrezData;
import
lcsb.mapviewer.annotation.services.*
;
import
lcsb.mapviewer.common.XmlParser
;
import
lcsb.mapviewer.common.exception.*
;
import
lcsb.mapviewer.model.LogMarker
;
import
lcsb.mapviewer.model.ProjectLogEntryType
;
import
lcsb.mapviewer.model.map.MiriamData
;
import
lcsb.mapviewer.model.map.MiriamType
;
import
lcsb.mapviewer.model.map.species.*
;
...
...
@@ -125,8 +127,7 @@ public class EntrezAnnotator extends ElementAnnotator implements IExternalServic
public
boolean
annotateElement
(
BioEntityProxy
element
,
MiriamData
identifier
,
AnnotatorData
parameters
)
throws
AnnotatorException
{
if
(
identifier
.
getDataType
().
equals
(
MiriamType
.
ENTREZ
))
{
String
prefix
=
element
.
getElementTag
();
EntrezData
data
=
getEntrezForMiriamData
(
identifier
,
prefix
);
EntrezData
data
=
getEntrezForMiriamData
(
identifier
,
element
.
getLogMarker
(
ProjectLogEntryType
.
OTHER
));
if
(
data
!=
null
)
{
element
.
setSymbol
(
data
.
getSymbol
());
...
...
@@ -185,7 +186,7 @@ public class EntrezAnnotator extends ElementAnnotator implements IExternalServic
* thrown when there is a problem with obtaining data from entrez
* database
*/
EntrezData
getEntrezForMiriamData
(
MiriamData
entrezMiriamData
,
String
prefix
)
throws
AnnotatorException
{
EntrezData
getEntrezForMiriamData
(
MiriamData
entrezMiriamData
,
LogMarker
marker
)
throws
AnnotatorException
{
EntrezData
result
=
entrezSerializer
.
xmlToObject
(
super
.
getCacheNode
(
ENTREZ_DATA_PREFIX
+
entrezMiriamData
.
getResource
()));
if
(
result
==
null
)
{
...
...
@@ -199,13 +200,15 @@ public class EntrezAnnotator extends ElementAnnotator implements IExternalServic
if
(
response
!=
null
)
{
Node
errorNode
=
XmlParser
.
getNode
(
"Error"
,
response
.
getChildNodes
());
if
(
errorNode
!=
null
)
{
logger
.
warn
(
prefix
+
" Invalid "
+
MiriamType
.
ENTREZ
+
" identifier: \""
+
entrezMiriamData
.
getResource
()
+
"\""
);
LogMarker
m
=
new
LogMarker
(
marker
);
m
.
getEntry
().
setType
(
ProjectLogEntryType
.
INVALID_IDENTIFIER
);
logger
.
warn
(
m
,
" Invalid "
+
MiriamType
.
ENTREZ
+
" identifier: \""
+
entrezMiriamData
.
getResource
()
+
"\""
);
return
null
;
}
}
else
{
logger
.
warn
(
prefix
+
"Problematic entrez response for identifier: \""
+
entrezMiriamData
.
getResource
()
+
"\""
);
LogMarker
m
=
new
LogMarker
(
marker
);
m
.
getEntry
().
setType
(
ProjectLogEntryType
.
OTHER
);
logger
.
warn
(
m
,
"Problematic entrez response for identifier: \""
+
entrezMiriamData
.
getResource
()
+
"\""
);
return
null
;
}
...
...
@@ -294,7 +297,9 @@ public class EntrezAnnotator extends ElementAnnotator implements IExternalServic
setCacheValue
(
ENTREZ_DATA_PREFIX
+
entrezMiriamData
.
getResource
(),
entrezSerializer
.
objectToString
(
result
));
}
catch
(
WrongResponseCodeIOException
e
)
{
if
(
e
.
getResponseCode
()
==
HttpURLConnection
.
HTTP_BAD_REQUEST
)
{
logger
.
warn
(
prefix
+
" Invalid "
+
MiriamType
.
ENTREZ
.
getCommonName
()
+
" identifier found"
);
LogMarker
m
=
new
LogMarker
(
marker
);
m
.
getEntry
().
setType
(
ProjectLogEntryType
.
INVALID_IDENTIFIER
);
logger
.
warn
(
m
,
" Invalid "
+
MiriamType
.
ENTREZ
.
getCommonName
()
+
" identifier found"
);
}
else
{
throw
new
AnnotatorException
(
e
);
}
...
...
annotation/src/main/java/lcsb/mapviewer/annotation/services/annotators/HgncAnnotator.java
View file @
dc2cc206
...
...
@@ -14,6 +14,7 @@ import lcsb.mapviewer.annotation.cache.WebPageDownloader;
import
lcsb.mapviewer.annotation.services.*
;
import
lcsb.mapviewer.common.XmlParser
;
import
lcsb.mapviewer.common.exception.*
;
import
lcsb.mapviewer.model.ProjectLogEntryType
;
import
lcsb.mapviewer.model.map.MiriamData
;
import
lcsb.mapviewer.model.map.MiriamType
;
import
lcsb.mapviewer.model.map.species.*
;
...
...
@@ -96,7 +97,8 @@ public class HgncAnnotator extends ElementAnnotator implements IExternalService
if
(
count
==
null
||
count
.
equals
(
""
)
||
count
.
equals
(
"0"
))
{
// print warn info when we have only hgnc identifiers (or no
// identifiers at all)
logger
.
warn
(
element
.
getElementTag
()
+
"Cannot find information for element."
);
logger
.
warn
(
element
.
getLogMarker
(
ProjectLogEntryType
.
CANNOT_FIND_INFORMATION
),
"Cannot find information for element."
);
return
false
;
}
else
{
Node
entry
=
XmlParser
.
getNode
(
"doc"
,
result
.
getChildNodes
());
...
...
@@ -173,7 +175,8 @@ public class HgncAnnotator extends ElementAnnotator implements IExternalService
return
true
;
}
}
catch
(
WrongResponseCodeIOException
e
)
{
logger
.
warn
(
element
.
getElementTag
()
+
"Cannot find information for element."
);
logger
.
warn
(
element
.
getLogMarker
(
ProjectLogEntryType
.
CANNOT_FIND_INFORMATION
),
"Cannot find information for element."
);
return
false
;
}
catch
(
Exception
e
)
{
throw
new
AnnotatorException
(
e
);
...
...
annotation/src/main/java/lcsb/mapviewer/annotation/services/annotators/PdbAnnotator.java
View file @
dc2cc206
...
...
@@ -16,6 +16,7 @@ import lcsb.mapviewer.annotation.cache.WebPageDownloader;
import
lcsb.mapviewer.annotation.services.*
;
import
lcsb.mapviewer.common.exception.InvalidArgumentException
;
import
lcsb.mapviewer.common.exception.NotImplementedException
;
import
lcsb.mapviewer.model.ProjectLogEntryType
;
import
lcsb.mapviewer.model.map.*
;
import
lcsb.mapviewer.model.map.species.*
;
import
lcsb.mapviewer.model.map.species.field.Structure
;
...
...
@@ -107,7 +108,8 @@ public class PdbAnnotator extends ElementAnnotator implements IExternalService {
try
{
Collection
<
Structure
>
structures
=
uniProtToPdb
(
identifier
);
if
(
structures
.
size
()
==
0
)
{
logger
.
warn
(
bioEntity
.
getElementTag
()
+
" No PDB mapping for UniProt ID: "
+
identifier
.
getResource
());
logger
.
warn
(
bioEntity
.
getLogMarker
(
ProjectLogEntryType
.
OTHER
),
" No PDB mapping for UniProt ID: "
+
identifier
.
getResource
());
return
false
;
}
else
{
// add the annotations to the set of annotation irrespective on
...
...
annotation/src/main/java/lcsb/mapviewer/annotation/services/annotators/ReconAnnotator.java
View file @
dc2cc206
...
...
@@ -15,6 +15,7 @@ import lcsb.mapviewer.annotation.cache.WebPageDownloader;
import
lcsb.mapviewer.annotation.services.*
;
import
lcsb.mapviewer.common.MinervaLoggerAppender
;
import
lcsb.mapviewer.common.exception.NotImplementedException
;
import
lcsb.mapviewer.model.ProjectLogEntryType
;
import
lcsb.mapviewer.model.map.MiriamData
;
import
lcsb.mapviewer.model.map.MiriamType
;
import
lcsb.mapviewer.model.map.reaction.Reaction
;
...
...
@@ -286,17 +287,19 @@ public class ReconAnnotator extends ElementAnnotator implements IExternalService
unknown
=
true
;
}
if
(
unknown
)
{
logger
.
warn
(
element
.
get
ElementTag
()
+
"Unknown field in recon annotation: \""
+
key
+
"\" (value: "
+
value
+
")"
);
logger
.
warn
(
element
.
get
LogMarker
(
ProjectLogEntryType
.
OTHER
),
"Unknown field in recon annotation: \""
+
key
+
"\" (value: "
+
value
+
")"
);
}
}
return
true
;
}
else
{
logger
.
warn
(
element
.
getElementTag
()
+
"No recon annotations \""
+
identifier
.
getResource
()
+
"\""
);
logger
.
warn
(
element
.
getLogMarker
(
ProjectLogEntryType
.
CANNOT_FIND_INFORMATION
),
"No recon annotations \""
+
identifier
.
getResource
()
+
"\""
);
return
false
;
}
}
else
{
logger
.
warn
(
element
.
getElementTag
()
+
"No recon annotations \""
+
identifier
.
getResource
()
+
"\""
);
logger
.
warn
(
element
.
getLogMarker
(
ProjectLogEntryType
.
CANNOT_FIND_INFORMATION
),
"No recon annotations \""
+
identifier
.
getResource
()
+
"\""
);
return
false
;
}
}
catch
(
IOException
e
)
{
...
...
@@ -370,8 +373,8 @@ public class ReconAnnotator extends ElementAnnotator implements IExternalService
}
else
if
(
value
.
startsWith
(
"K"
))
{
md
=
new
MiriamData
(
MiriamType
.
KEGG_ORTHOLOGY
,
value
);
}
else
{
logger
.
warn
(
element
.
get
ElementTag
()
+
"Unknown Kegg identifier type (only Kegg compounds and reactions are supported): \""
+
value
+
"\""
);
logger
.
warn
(
element
.
get
LogMarker
(
ProjectLogEntryType
.
INVALID_IDENTIFIER
),
"Unknown Kegg identifier type (only Kegg compounds and reactions are supported): \""
+
value
+
"\""
);
}
return
md
;
}
...
...
annotation/src/main/java/lcsb/mapviewer/annotation/services/annotators/UniprotAnnotator.java
View file @
dc2cc206
...
...
@@ -14,6 +14,7 @@ import lcsb.mapviewer.annotation.cache.WebPageDownloader;
import
lcsb.mapviewer.annotation.services.*
;
import
lcsb.mapviewer.common.exception.InvalidArgumentException
;
import
lcsb.mapviewer.common.exception.NotImplementedException
;
import
lcsb.mapviewer.model.ProjectLogEntryType
;
import
lcsb.mapviewer.model.map.MiriamData
;
import
lcsb.mapviewer.model.map.MiriamType
;
import
lcsb.mapviewer.model.map.species.*
;
...
...
@@ -106,7 +107,8 @@ public class UniprotAnnotator extends ElementAnnotator implements IExternalServi
}
else
{
// this means that entry with a given uniprot id doesn't exist
if
(
object
.
contains
(
identifier
))
{
logger
.
warn
(
object
.
getElementTag
()
+
" Invalid uniprot id: "
+
identifier
);
logger
.
warn
(
object
.
getLogMarker
(
ProjectLogEntryType
.
INVALID_IDENTIFIER
),
" Invalid uniprot id: "
+
identifier
);
}
return
false
;
}
...
...
annotation/src/test/java/lcsb/mapviewer/annotation/services/MissingAnnotationTest.java
View file @
dc2cc206
...
...
@@ -23,7 +23,7 @@ public class MissingAnnotationTest {
@Test
public
void
test
()
{
MissingAnnotation
annotation
=
new
MissingAnnotation
(
new
GenericProtein
(
"id"
));
assertTrue
(
annotation
.
toString
().
contains
(
"
m
iss
es
annotations"
));
assertTrue
(
annotation
.
toString
().
contains
(
"
M
iss
ing
annotations"
));
}
}
annotation/src/test/java/lcsb/mapviewer/annotation/services/MissingRequiredAnnotationsTest.java
View file @
dc2cc206
...
...
@@ -36,14 +36,10 @@ public class MissingRequiredAnnotationsTest {
@Test
public
void
testGetMessage
()
{
try
{
List
<
MiriamType
>
list
=
new
ArrayList
<>();
list
.
add
(
MiriamType
.
CAS
);
MissingRequiredAnnotations
mre
=
new
MissingRequiredAnnotations
(
new
GenericProtein
(
"id"
),
list
);
assertTrue
(
mre
.
toString
().
contains
(
"misses one of the following annotations"
));
}
catch
(
InvalidArgumentException
e
)
{
assertTrue
(
e
.
getMessage
().
contains
(
"List of improper annotations cannot be null"
));
}
List
<
MiriamType
>
list
=
new
ArrayList
<>();
list
.
add
(
MiriamType
.
CAS
);
MissingRequiredAnnotations
mre
=
new
MissingRequiredAnnotations
(
new
GenericProtein
(
"id"
),
list
);
assertTrue
(
mre
.
toString
().
contains
(
"Missing one of the required annotations"
));
}
}
annotation/src/test/java/lcsb/mapviewer/annotation/services/annotators/CazyAnnotatorTest.java
View file @
dc2cc206
...
...
@@ -36,7 +36,7 @@ public class CazyAnnotatorTest extends AnnotationTestFunctions {
@Test
public
void