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
minerva
core
Commits
1294cbb8
Commit
1294cbb8
authored
Jul 10, 2018
by
Piotr Gawron
Browse files
protein modification uses string mapping for state
parent
1fe7ff92
Changes
4
Hide whitespace changes
Inline
Side-by-side
model/src/main/java/lcsb/mapviewer/model/map/species/field/ModificationResidue.java
View file @
1294cbb8
package
lcsb.mapviewer.model.map.species.field
;
import
java.awt.geom.Point2D
;
import
java.io.Serializable
;
import
java.text.DecimalFormat
;
import
javax.persistence.Column
;
import
javax.persistence.Entity
;
import
javax.persistence.FetchType
;
import
javax.persistence.GeneratedValue
;
import
javax.persistence.GenerationType
;
import
javax.persistence.Id
;
import
javax.persistence.JoinColumn
;
import
javax.persistence.ManyToOne
;
import
javax.persistence.Table
;
import
org.apache.log4j.Logger
;
import
org.hibernate.annotations.Type
;
import
lcsb.mapviewer.common.exception.NotImplementedException
;
import
lcsb.mapviewer.model.map.species.Species
;
/**
* This class represent modification residue in protein and gene. However, it is
* sometimes also used for storing information about AntisenseRna/Rna regions...
* (due to CellDesigner xml strange structure).
*
* @author Piotr Gawron
*
*/
@Entity
@Table
(
name
=
"modification_residue_table"
)
@org
.
hibernate
.
annotations
.
GenericGenerator
(
name
=
"test-increment-strategy"
,
strategy
=
"increment"
)
public
class
ModificationResidue
implements
Serializable
,
ElementModification
{
/**
*
*/
private
static
final
long
serialVersionUID
=
1L
;
/**
* Default class logger.
*/
@SuppressWarnings
(
"unused"
)
private
static
Logger
logger
=
Logger
.
getLogger
(
ModificationResidue
.
class
.
getName
());
/**
* Unique identifier in the database.
*/
@Id
@GeneratedValue
(
strategy
=
GenerationType
.
IDENTITY
)
@Column
(
name
=
"iddb"
,
unique
=
true
,
nullable
=
false
)
private
int
id
;
/**
* Identifier of the modification. Must be unique in single map model.
*/
private
String
idModificationResidue
=
""
;
/**
* Name of the modification.
*/
private
String
name
=
""
;
/**
* State in which this modification is.
*/
private
ModificationState
state
=
null
;
@Column
(
name
=
"position"
)
@Type
(
type
=
"lcsb.mapviewer.persist.mapper.Point2DMapper"
)
private
Point2D
position
=
null
;
/**
* Species to which this modification belong to.
*/
@ManyToOne
(
fetch
=
FetchType
.
LAZY
)
@JoinColumn
(
name
=
"idSpeciesDb"
,
nullable
=
false
)
private
Species
species
;
/**
* Default constructor.
*/
public
ModificationResidue
()
{
}
/**
* Constructor that initialize object with the data taken from the parameter.
*
* @param mr
* original object from which data is taken
*/
public
ModificationResidue
(
ModificationResidue
mr
)
{
this
.
idModificationResidue
=
mr
.
idModificationResidue
;
this
.
name
=
mr
.
name
;
this
.
state
=
mr
.
state
;
this
.
position
=
mr
.
position
;
}
@Override
public
String
toString
()
{
DecimalFormat
format
=
new
DecimalFormat
(
"#.##"
);
String
result
=
getIdModificationResidue
()
+
","
+
getName
()
+
","
+
getState
()
+
",Point2D["
+
format
.
format
(
getPosition
().
getX
())
+
","
+
format
.
format
(
getPosition
().
getY
())
+
"]"
;
return
result
;
}
/**
* Creates copy of the object.
*
* @return copy of the object.
*/
public
ModificationResidue
copy
()
{
if
(
this
.
getClass
()
==
ModificationResidue
.
class
)
{
return
new
ModificationResidue
(
this
);
}
else
{
throw
new
NotImplementedException
(
"Method copy() should be overriden in class "
+
this
.
getClass
());
}
}
/**
* @return the idModificationResidue
* @see #id
*/
public
int
getId
()
{
return
id
;
}
/**
* @param id
* the idModificationResidue to set
* @see #id
*/
public
void
setId
(
int
id
)
{
this
.
id
=
id
;
}
/**
* @return the id
* @see #idModificationResidue
*/
public
String
getIdModificationResidue
()
{
return
idModificationResidue
;
}
/**
* @param idModificationResidue
* the id to set
* @see #idModificationResidue
*/
public
void
setIdModificationResidue
(
String
idModificationResidue
)
{
this
.
idModificationResidue
=
idModificationResidue
;
}
/**
* @return the name
* @see #name
*/
public
String
getName
()
{
return
name
;
}
/**
* @param name
* the name to set
* @see #name
*/
public
void
setName
(
String
name
)
{
this
.
name
=
name
;
}
/**
* @return the state
* @see #state
*/
public
ModificationState
getState
()
{
return
state
;
}
/**
* @param state
* the state to set
* @see #state
*/
public
void
setState
(
ModificationState
state
)
{
this
.
state
=
state
;
}
/**
* @return the species
* @see #species
*/
public
Species
getSpecies
()
{
return
species
;
}
/**
* @param species
* the species to set
* @see #species
*/
public
void
setSpecies
(
Species
species
)
{
this
.
species
=
species
;
}
public
Point2D
getPosition
()
{
return
position
;
}
public
void
setPosition
(
Point2D
position
)
{
this
.
position
=
position
;
}
}
package
lcsb.mapviewer.model.map.species.field
;
import
java.awt.geom.Point2D
;
import
java.io.Serializable
;
import
java.text.DecimalFormat
;
import
javax.persistence.Column
;
import
javax.persistence.Entity
;
import
javax.persistence.EnumType
;
import
javax.persistence.Enumerated
;
import
javax.persistence.FetchType
;
import
javax.persistence.GeneratedValue
;
import
javax.persistence.GenerationType
;
import
javax.persistence.Id
;
import
javax.persistence.JoinColumn
;
import
javax.persistence.ManyToOne
;
import
javax.persistence.Table
;
import
org.apache.log4j.Logger
;
import
org.hibernate.annotations.Type
;
import
lcsb.mapviewer.common.exception.NotImplementedException
;
import
lcsb.mapviewer.model.map.species.Species
;
/**
* This class represent modification residue in protein and gene. However, it is
* sometimes also used for storing information about AntisenseRna/Rna regions...
* (due to CellDesigner xml strange structure).
*
* @author Piotr Gawron
*
*/
@Entity
@Table
(
name
=
"modification_residue_table"
)
@org
.
hibernate
.
annotations
.
GenericGenerator
(
name
=
"test-increment-strategy"
,
strategy
=
"increment"
)
public
class
ModificationResidue
implements
Serializable
,
ElementModification
{
/**
*
*/
private
static
final
long
serialVersionUID
=
1L
;
/**
* Default class logger.
*/
@SuppressWarnings
(
"unused"
)
private
static
Logger
logger
=
Logger
.
getLogger
(
ModificationResidue
.
class
.
getName
());
/**
* Unique identifier in the database.
*/
@Id
@GeneratedValue
(
strategy
=
GenerationType
.
IDENTITY
)
@Column
(
name
=
"iddb"
,
unique
=
true
,
nullable
=
false
)
private
int
id
;
/**
* Identifier of the modification. Must be unique in single map model.
*/
private
String
idModificationResidue
=
""
;
/**
* Name of the modification.
*/
private
String
name
=
""
;
/**
* State in which this modification is.
*/
@Enumerated
(
EnumType
.
STRING
)
private
ModificationState
state
=
null
;
@Column
(
name
=
"position"
)
@Type
(
type
=
"lcsb.mapviewer.persist.mapper.Point2DMapper"
)
private
Point2D
position
=
null
;
/**
* Species to which this modification belong to.
*/
@ManyToOne
(
fetch
=
FetchType
.
LAZY
)
@JoinColumn
(
name
=
"idSpeciesDb"
,
nullable
=
false
)
private
Species
species
;
/**
* Default constructor.
*/
public
ModificationResidue
()
{
}
/**
* Constructor that initialize object with the data taken from the parameter.
*
* @param mr
* original object from which data is taken
*/
public
ModificationResidue
(
ModificationResidue
mr
)
{
this
.
idModificationResidue
=
mr
.
idModificationResidue
;
this
.
name
=
mr
.
name
;
this
.
state
=
mr
.
state
;
this
.
position
=
mr
.
position
;
}
@Override
public
String
toString
()
{
DecimalFormat
format
=
new
DecimalFormat
(
"#.##"
);
String
result
=
getIdModificationResidue
()
+
","
+
getName
()
+
","
+
getState
()
+
",Point2D["
+
format
.
format
(
getPosition
().
getX
())
+
","
+
format
.
format
(
getPosition
().
getY
())
+
"]"
;
return
result
;
}
/**
* Creates copy of the object.
*
* @return copy of the object.
*/
public
ModificationResidue
copy
()
{
if
(
this
.
getClass
()
==
ModificationResidue
.
class
)
{
return
new
ModificationResidue
(
this
);
}
else
{
throw
new
NotImplementedException
(
"Method copy() should be overriden in class "
+
this
.
getClass
());
}
}
/**
* @return the idModificationResidue
* @see #id
*/
public
int
getId
()
{
return
id
;
}
/**
* @param id
* the idModificationResidue to set
* @see #id
*/
public
void
setId
(
int
id
)
{
this
.
id
=
id
;
}
/**
* @return the id
* @see #idModificationResidue
*/
public
String
getIdModificationResidue
()
{
return
idModificationResidue
;
}
/**
* @param idModificationResidue
* the id to set
* @see #idModificationResidue
*/
public
void
setIdModificationResidue
(
String
idModificationResidue
)
{
this
.
idModificationResidue
=
idModificationResidue
;
}
/**
* @return the name
* @see #name
*/
public
String
getName
()
{
return
name
;
}
/**
* @param name
* the name to set
* @see #name
*/
public
void
setName
(
String
name
)
{
this
.
name
=
name
;
}
/**
* @return the state
* @see #state
*/
public
ModificationState
getState
()
{
return
state
;
}
/**
* @param state
* the state to set
* @see #state
*/
public
void
setState
(
ModificationState
state
)
{
this
.
state
=
state
;
}
/**
* @return the species
* @see #species
*/
public
Species
getSpecies
()
{
return
species
;
}
/**
* @param species
* the species to set
* @see #species
*/
public
void
setSpecies
(
Species
species
)
{
this
.
species
=
species
;
}
public
Point2D
getPosition
()
{
return
position
;
}
public
void
setPosition
(
Point2D
position
)
{
this
.
position
=
position
;
}
}
model/src/main/java/lcsb/mapviewer/model/map/species/field/ModificationState.java
View file @
1294cbb8
package
lcsb.mapviewer.model.map.species.field
;
/**
* Defines a type of modification (in protein or rna). Possible values are:
* <ul>
* <li>{@link ModificationState#ACETYLATED ACETYLATED},</li>
* <li>{@link ModificationState#DONT_CARE DON'T CARE},</li>
* <li>{@link ModificationState#EMPTY EMPTY},</li>
* <li>{@link ModificationState#GLYCOSYLATED GLYCOSYLATED},</li>
* <li>{@link ModificationState#HYDROXYLATED HYDROXYLATED},</li>
* <li>{@link ModificationState#METHYLATED METHYLATED},</li>
* <li>{@link ModificationState#MYRISTOYLATED MYRISTOYLATED},</li>
* <li>{@link ModificationState#PALMYTOYLATED PALMYTOYLATED},</li>
* <li>{@link ModificationState#PHOSPHORYLATED PHOSPHORYLATED},</li>
* <li>{@link ModificationState#PRENYLATED PRENYLATED},</li>
* <li>{@link ModificationState#PROTONATED PROTONATED},</li>
* <li>{@link ModificationState#SULFATED SULFATED},</li>
* <li>{@link ModificationState#UBIQUITINATED UBIQUITINATED},</li>
* <li>{@link ModificationState#UNKNOWN UNKNOWN}.</li>
* </ul>
*
* @author Piotr Gawron
*
*/
public
enum
ModificationState
{
/**
* Phosporylated state.
*/
PHOSPHORYLATED
(
"phosphorylated"
,
"P"
),
//
/**
* Acetylated state.
*/
ACETYLATED
(
"acetylated"
,
"Ac"
),
//
/**
* Ubiquitinated state.
*/
UBIQUITINATED
(
"ubiquitinated"
,
"Ub"
),
//
/**
* Methylated state.
*/
METHYLATED
(
"methylated"
,
"Me"
),
//
/**
* Hydroxylated state.
*/
HYDROXYLATED
(
"hydroxylated"
,
"OH"
),
//
/**
* Myristoylated state.
*/
MYRISTOYLATED
(
"myristoylated"
,
"My"
),
//
/**
* Sulfated state.
*/
SULFATED
(
"sulfated"
,
"S"
),
//
/**
* Prenylated state.
*/
PRENYLATED
(
"prenylated"
,
"Pr"
),
//
/**
* Glycosylated state.
*/
GLYCOSYLATED
(
"glycosylated"
,
"G"
),
//
/**
* Palmytoylated state.
*/
PALMYTOYLATED
(
"palmytoylated"
,
"Pa"
),
//
/**
* Unknown state.
*/
UNKNOWN
(
"unknown"
,
"?"
),
//
/**
* Empty state.
*/
EMPTY
(
"empty"
,
""
),
//
/**
* Protonated state.
*/
PROTONATED
(
"protonated"
,
"H"
),
//
/**
* We don't care in which state it is.
*/
DONT_CARE
(
"don't care"
,
"*"
);
/**
* Full name of the modification.
*/
private
String
fullName
;
/**
* Abbreviation used for the modification.
*/
private
String
abbreviation
;
/**
* Default constructor with the name and abbreviation.
*
* @param name
* name used for this state
* @param abbreviation
* abbreviation used in this state
*/
ModificationState
(
String
name
,
String
abbreviation
)
{
this
.
fullName
=
name
;
this
.
abbreviation
=
abbreviation
;
}
/**
* @return the fullName
* @see #fullName
*/
public
String
getFullName
()
{
return
fullName
;
}
/**
* @return the abbreviation
* @see #abbreviation
*/
public
String
getAbbreviation
()
{
return
abbreviation
;
}
/**
* Returns {@link ModificationState} identified by the full name.
*
* @param name
* full name of the state
* @return {@link ModificationState} identified by the full name
*/
public
static
ModificationState
getByName
(
String
name
)
{
for
(
ModificationState
state
:
values
())
{
if
(
state
.
getFullName
().
equalsIgnoreCase
(
name
))
{
return
state
;
}
}
return
null
;
}