Commit 1294cbb8 authored by Piotr Gawron's avatar Piotr Gawron
Browse files

protein modification uses string mapping for state

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