Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
External wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
minerva
core
Commits
3d4021db
Commit
3d4021db
authored
6 years ago
by
Piotr Gawron
Browse files
Options
Downloads
Patches
Plain Diff
is number uses proper function check
parent
8c6d4271
No related branches found
No related tags found
2 merge requests
!630
WIP: Resolve "The privileges of a new user are not saved in some cases"
,
!545
Import from sbgn issue
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
converter-SBGNML/src/main/java/lcsb/mapviewer/converter/model/sbgnml/SbgnmlXmlExporter.java
+18
-24
18 additions, 24 deletions
...b/mapviewer/converter/model/sbgnml/SbgnmlXmlExporter.java
with
18 additions
and
24 deletions
converter-SBGNML/src/main/java/lcsb/mapviewer/converter/model/sbgnml/SbgnmlXmlExporter.java
+
18
−
24
View file @
3d4021db
...
...
@@ -10,6 +10,7 @@ import java.util.Set;
import
java.util.stream.Collectors
;
import
org.apache.commons.lang3.RandomStringUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.log4j.Logger
;
import
org.sbgn.ArcClazz
;
import
org.sbgn.GlyphClazz
;
...
...
@@ -196,50 +197,45 @@ public class SbgnmlXmlExporter {
/**
* Creates new glyph element with all parameters from given alias.
*
* @param
alias
* @param
element
* alias with all parameters for the glyph
* @return newly created glyph
*/
private
Glyph
aliasToGlyph
(
Element
alias
)
{
private
Glyph
aliasToGlyph
(
Element
element
)
{
Glyph
newGlyph
=
new
Glyph
();
boolean
idIsANumber
=
true
;
try
{
Integer
.
parseInt
(
alias
.
getElementId
().
substring
(
0
,
1
));
}
catch
(
NumberFormatException
e
)
{
idIsANumber
=
false
;
}
boolean
idIsANumber
=
StringUtils
.
isNumeric
(
element
.
getElementId
().
substring
(
0
,
1
));
if
(
idIsANumber
)
{
newGlyph
.
setId
(
RandomStringUtils
.
randomAlphabetic
(
ID_RANDOM_STRING_LENGTH
).
concat
(
alias
.
getElementId
()));
newGlyph
.
setId
(
RandomStringUtils
.
randomAlphabetic
(
ID_RANDOM_STRING_LENGTH
).
concat
(
element
.
getElementId
()));
}
else
{
newGlyph
.
setId
(
alias
.
getElementId
());
newGlyph
.
setId
(
element
.
getElementId
());
}
newGlyph
.
setClazz
(
getGlyphClazzFromElement
(
alias
).
getClazz
());
newGlyph
.
setLabel
(
getGlyphLabelFromAlias
(
alias
));
newGlyph
.
setClazz
(
getGlyphClazzFromElement
(
element
).
getClazz
());
newGlyph
.
setLabel
(
getGlyphLabelFromAlias
(
element
));
Bbox
bbox
=
new
Bbox
();
bbox
.
setX
(
alias
.
getX
().
floatValue
());
bbox
.
setY
(
alias
.
getY
().
floatValue
());
bbox
.
setW
(
alias
.
getWidth
().
floatValue
());
bbox
.
setH
(
alias
.
getHeight
().
floatValue
());
bbox
.
setX
(
element
.
getX
().
floatValue
());
bbox
.
setY
(
element
.
getY
().
floatValue
());
bbox
.
setW
(
element
.
getWidth
().
floatValue
());
bbox
.
setH
(
element
.
getHeight
().
floatValue
());
newGlyph
.
setBbox
(
bbox
);
if
(
GlyphClazz
.
fromClazz
(
newGlyph
.
getClazz
()).
equals
(
GlyphClazz
.
MACROMOLECULE
)
||
GlyphClazz
.
fromClazz
(
newGlyph
.
getClazz
()).
equals
(
GlyphClazz
.
MACROMOLECULE_MULTIMER
))
{
Protein
protein
=
(
Protein
)
alias
;
Protein
protein
=
(
Protein
)
element
;
for
(
ModificationResidue
mr
:
protein
.
getModificationResidues
())
{
Glyph
stateVariableGlyph
=
parseStateVariable
(
mr
,
newGlyph
);
Glyph
stateVariableGlyph
=
parseStateVariable
(
mr
);
stateVariableGlyph
.
setId
(
newGlyph
.
getId
().
concat
(
"-"
).
concat
(
stateVariableGlyph
.
getId
()));
newGlyph
.
getGlyph
().
add
(
stateVariableGlyph
);
}
}
Glyph
unitOfInformationGlyph
=
getUnitOfInformationGlyph
(
alias
);
Glyph
unitOfInformationGlyph
=
getUnitOfInformationGlyph
(
element
);
if
(
unitOfInformationGlyph
!=
null
)
{
newGlyph
.
getGlyph
().
add
(
unitOfInformationGlyph
);
}
if
(
alias
instanceof
Complex
)
{
Complex
complexAlias
=
(
Complex
)
alias
;
if
(
element
instanceof
Complex
)
{
Complex
complexAlias
=
(
Complex
)
element
;
for
(
Species
a
:
complexAlias
.
getElements
())
{
Glyph
childGlyph
=
aliasToGlyph
(
a
);
newGlyph
.
getGlyph
().
add
(
childGlyph
);
...
...
@@ -424,11 +420,9 @@ public class SbgnmlXmlExporter {
*
* @param mr
* {@link ModificationResidue} to be parsed
* @param parentGlyph
* parent glyph for the state variable
* @return state variable glyph
*/
private
Glyph
parseStateVariable
(
ModificationResidue
mr
,
Glyph
parentGlyph
)
{
private
Glyph
parseStateVariable
(
ModificationResidue
mr
)
{
Glyph
glyph
=
new
Glyph
();
glyph
.
setId
(
mr
.
getIdModificationResidue
());
glyph
.
setClazz
(
GlyphClazz
.
STATE_VARIABLE
.
getClazz
());
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment