diff --git a/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/structure/CellDesignerRna.java b/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/structure/CellDesignerRna.java
index a1d476c3f02c9681fed20b53cf0bbd62b8d869ef..aafc654fbfc5bd0541873786b84f35e272779e06 100644
--- a/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/structure/CellDesignerRna.java
+++ b/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/structure/CellDesignerRna.java
@@ -1,147 +1,152 @@
-package lcsb.mapviewer.converter.model.celldesigner.structure;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.log4j.Logger;
-
-import lcsb.mapviewer.common.exception.NotImplementedException;
-import lcsb.mapviewer.converter.model.celldesigner.structure.fields.CellDesignerRnaRegion;
-import lcsb.mapviewer.model.map.species.Rna;
-
-/**
- * Class representing CellDesigner {@link Rna}.
- * 
- * @author Piotr Gawron
- * 
- */
-public class CellDesignerRna extends CellDesignerSpecies<Rna> {
-
-	/**
-	 * 
-	 */
-	private static final long						serialVersionUID = 1L;
-
-	/**
-	 * Default class logger.
-	 */
-	@SuppressWarnings("unused")
-	private static Logger								logger					 = Logger.getLogger(CellDesignerRna.class.getName());
-
-	/**
-	 * List of rna regions (some rna sequences) in this object.
-	 */
-	private List<CellDesignerRnaRegion>	regions					 = new ArrayList<>();
-
-	/**
-	 * Constructor that initializes rna with the data passed in the argument.
-	 * 
-	 * @param species
-	 *          original species used for data initialization
-	 */
-	public CellDesignerRna(CellDesignerSpecies<?> species) {
-		super(species);
-		if (species instanceof CellDesignerRna) {
-			CellDesignerRna rna = (CellDesignerRna) species;
-			for (CellDesignerRnaRegion region : rna.getRegions()) {
-				addRegion(new CellDesignerRnaRegion(region));
-			}
-		}
-	}
-
-	/**
-	 * Default constructor.
-	 */
-	public CellDesignerRna() {
-		super();
-	}
-
-	@Override
-	public CellDesignerRna copy() {
-		if (this.getClass() == CellDesignerRna.class) {
-			return new CellDesignerRna(this);
-		} else {
-			throw new NotImplementedException("Method copy() should be overriden in class " + this.getClass());
-		}
-	}
-
-	@Override
-	public void update(CellDesignerSpecies<?> species) {
-		super.update(species);
-		if (species instanceof CellDesignerRna) {
-			CellDesignerRna rna = (CellDesignerRna) species;
-			for (CellDesignerRnaRegion mr : getRegions()) {
-				mr.setState(null);
-			}
-
-			for (CellDesignerRnaRegion region : rna.getRegions()) {
-				updateRegion(region);
-			}
-		}
-	}
-
-	/**
-	 * Updates region in the rna. If region doesn't exist then it is added.
-	 * 
-	 * @param param
-	 *          region that with the data to update
-	 */
-	private void updateRegion(CellDesignerRnaRegion param) {
-		for (CellDesignerRnaRegion region : regions) {
-			if (region.getIdRnaRegion().equals(param.getIdRnaRegion())) {
-				region.update(param);
-				return;
-			}
-		}
-		addRegion(new CellDesignerRnaRegion(param));
-	}
-
-	/**
-	 * Adds region. If the region with given id exists then the data of this
-	 * region is copied to the one that is already in the {@link CellDesignerRna}.
-	 * 
-	 * @param rnaRegion
-	 *          region to add
-	 */
-	public void addRegion(CellDesignerRnaRegion rnaRegion) {
-		for (CellDesignerRnaRegion region2 : regions) {
-			if (region2.getIdRnaRegion().equals(rnaRegion.getIdRnaRegion())) {
-				region2.update(rnaRegion);
-				return;
-			}
-		}
-
-		regions.add(rnaRegion);
-		rnaRegion.setSpecies(this);
-
-	}
-
-	/**
-	 * @return the regions
-	 * @see #regions
-	 */
-	public List<CellDesignerRnaRegion> getRegions() {
-		return regions;
-	}
-
-	/**
-	 * @param regions
-	 *          the regions to set
-	 * @see #regions
-	 */
-	public void setRegions(List<CellDesignerRnaRegion> regions) {
-		this.regions = regions;
-	}
-
-	@Override
-	public Rna createModelElement(String aliasId) {
-		Rna result = new Rna(aliasId);
-		super.setModelObjectFields(result);
-		for (CellDesignerRnaRegion region : regions) {
-			result.addRegion(region.createRnaRegionAlias());
-		}
-
-		return result;
-	}
-
-}
+package lcsb.mapviewer.converter.model.celldesigner.structure;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.log4j.Logger;
+
+import lcsb.mapviewer.common.exception.NotImplementedException;
+import lcsb.mapviewer.converter.model.celldesigner.structure.fields.CellDesignerRnaRegion;
+import lcsb.mapviewer.model.map.species.Rna;
+import lcsb.mapviewer.model.map.species.Species;
+
+/**
+ * Class representing CellDesigner {@link Rna}.
+ * 
+ * @author Piotr Gawron
+ * 
+ */
+public class CellDesignerRna extends CellDesignerSpecies<Rna> {
+
+  /**
+   * 
+   */
+  private static final long serialVersionUID = 1L;
+
+  /**
+   * Default class logger.
+   */
+  @SuppressWarnings("unused")
+  private static Logger logger = Logger.getLogger(CellDesignerRna.class.getName());
+
+  /**
+   * List of rna regions (some rna sequences) in this object.
+   */
+  private List<CellDesignerRnaRegion> regions = new ArrayList<>();
+
+  /**
+   * Constructor that initializes rna with the data passed in the argument.
+   * 
+   * @param species
+   *          original species used for data initialization
+   */
+  public CellDesignerRna(CellDesignerSpecies<?> species) {
+    super(species);
+    if (species instanceof CellDesignerRna) {
+      CellDesignerRna rna = (CellDesignerRna) species;
+      for (CellDesignerRnaRegion region : rna.getRegions()) {
+        addRegion(new CellDesignerRnaRegion(region));
+      }
+    }
+  }
+
+  /**
+   * Default constructor.
+   */
+  public CellDesignerRna() {
+    super();
+  }
+
+  @Override
+  public CellDesignerRna copy() {
+    if (this.getClass() == CellDesignerRna.class) {
+      return new CellDesignerRna(this);
+    } else {
+      throw new NotImplementedException("Method copy() should be overriden in class " + this.getClass());
+    }
+  }
+
+  @Override
+  public void update(CellDesignerSpecies<?> species) {
+    super.update(species);
+    if (species instanceof CellDesignerRna) {
+      CellDesignerRna rna = (CellDesignerRna) species;
+      for (CellDesignerRnaRegion mr : getRegions()) {
+        mr.setState(null);
+      }
+
+      for (CellDesignerRnaRegion region : rna.getRegions()) {
+        updateRegion(region);
+      }
+    }
+  }
+
+  /**
+   * Updates region in the rna. If region doesn't exist then it is added.
+   * 
+   * @param param
+   *          region that with the data to update
+   */
+  private void updateRegion(CellDesignerRnaRegion param) {
+    for (CellDesignerRnaRegion region : regions) {
+      if (region.getIdRnaRegion().equals(param.getIdRnaRegion())) {
+        region.update(param);
+        return;
+      }
+    }
+    addRegion(new CellDesignerRnaRegion(param));
+  }
+
+  /**
+   * Adds region. If the region with given id exists then the data of this region
+   * is copied to the one that is already in the {@link CellDesignerRna}.
+   * 
+   * @param rnaRegion
+   *          region to add
+   */
+  public void addRegion(CellDesignerRnaRegion rnaRegion) {
+    for (CellDesignerRnaRegion region2 : regions) {
+      if (region2.getIdRnaRegion().equals(rnaRegion.getIdRnaRegion())) {
+        region2.update(rnaRegion);
+        return;
+      }
+    }
+
+    regions.add(rnaRegion);
+    rnaRegion.setSpecies(this);
+
+  }
+
+  /**
+   * @return the regions
+   * @see #regions
+   */
+  public List<CellDesignerRnaRegion> getRegions() {
+    return regions;
+  }
+
+  /**
+   * @param regions
+   *          the regions to set
+   * @see #regions
+   */
+  public void setRegions(List<CellDesignerRnaRegion> regions) {
+    this.regions = regions;
+  }
+
+  @Override
+  public Rna createModelElement(String aliasId) {
+    Rna result = new Rna(aliasId);
+    super.setModelObjectFields(result);
+    return result;
+  }
+
+  @Override
+  public void updateModelElementAfterLayoutAdded(Species element) {
+    for (CellDesignerRnaRegion region : regions) {
+      Rna rna = (Rna) element;
+      rna.addRegion(region.createRnaRegionAlias(rna));
+    }
+  }
+
+}
diff --git a/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/structure/fields/CellDesignerRnaRegion.java b/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/structure/fields/CellDesignerRnaRegion.java
index bbb44414758cd125082930ee1f9f62f290b94edd..3741aaa8fa4a099b1301a5f1a1170e51ccec34f7 100644
--- a/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/structure/fields/CellDesignerRnaRegion.java
+++ b/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/structure/fields/CellDesignerRnaRegion.java
@@ -1,301 +1,302 @@
-package lcsb.mapviewer.converter.model.celldesigner.structure.fields;
-
-import java.io.Serializable;
-
-import org.apache.log4j.Logger;
-
-import lcsb.mapviewer.common.exception.InvalidArgumentException;
-import lcsb.mapviewer.converter.model.celldesigner.structure.CellDesignerRna;
-import lcsb.mapviewer.model.map.species.field.ModificationState;
-import lcsb.mapviewer.model.map.species.field.RnaRegion;
-
-/**
- * This structure contains information about rna region (rna fragment of
- * interest) for a specific
- * {@link lcsb.mapviewer.converter.model.celldesigner.structure.CellDesignerRna
- * Rna}.
- * 
- * @author Piotr Gawron
- * 
- */
-public class CellDesignerRnaRegion implements Serializable {
-
-	/**
-	 * 
-	 */
-	private static final long		serialVersionUID = 1L;
-
-	/**
-	 * Default {@link #size} of the region.
-	 */
-	private static final double	DEFAULT_SIZE		 = 0.1;
-
-	/**
-	 * Default class logger.
-	 */
-	@SuppressWarnings("unused")
-	private static Logger				logger					 = Logger.getLogger(CellDesignerRnaRegion.class.getName());
-
-	/**
-	 * Identifier of the region. Unique in the
-	 * {@link lcsb.mapviewer.model.map.model.Model}.
-	 */
-	private String							idRnaRegion			 = "";
-
-	/**
-	 * Type of the region in the rna. There are three possible values:
-	 * <ul>
-	 * <li>Coding region,</li>
-	 * <li>Protein binding domain,</li>
-	 * <li>Modification site.</li>
-	 * </ul>
-	 */
-	private String							type						 = "";
-
-	/**
-	 * Defines a state of the region (for instance ubiquitinated etc).
-	 * 
-	 * @see ModificationState
-	 */
-	private ModificationState		state						 = null;
-
-	/**
-	 * Name of the region.
-	 */
-	private String							name						 = "";
-
-	/**
-	 * Size of the region in the graphic representation.
-	 */
-	private double							size						 = DEFAULT_SIZE;
-
-	/**
-	 * Position on the species in graphic representation.
-	 */
-	private Double							pos;
-
-	/**
-	 * Defines a species where the region belongs to.
-	 */
-	private CellDesignerRna			species;
-
-	/**
-	 * Default constructor.
-	 */
-	public CellDesignerRnaRegion() {
-
-	}
-
-	/**
-	 * Creates object with the data taken from paramter region.
-	 * 
-	 * @param mr
-	 *          original {@link CellDesignerRnaRegion}
-	 */
-	public CellDesignerRnaRegion(CellDesignerRnaRegion mr) {
-		this.idRnaRegion = mr.idRnaRegion;
-		this.size = mr.size;
-		setPos(mr.getPos());
-		this.type = mr.type;
-		this.state = mr.state;
-		this.name = mr.name;
-	}
-
-	/**
-	 * Sets {@link #size}.
-	 * 
-	 * @param text
-	 *          new size value in string format
-	 */
-	public void setSize(String text) {
-		try {
-			size = Double.parseDouble(text);
-		} catch (NumberFormatException e) {
-			throw new InvalidArgumentException("Invalid angle: " + text, e);
-		}
-
-	}
-
-	/**
-	 * Sets {@link #pos}.
-	 * 
-	 * @param text
-	 *          new {@link #pos} value in string format
-	 */
-	public void setPos(String text) {
-		try {
-			setPos(Double.parseDouble(text));
-		} catch (NumberFormatException e) {
-			throw new InvalidArgumentException("Invalid pos: " + text, e);
-		}
-
-	}
-
-	/**
-	 * Updates fields in the object with the data given in the parameter rna
-	 * region.
-	 * 
-	 * @param mr
-	 *          {@link CellDesignerRnaRegion} from which data will be used to
-	 *          update
-	 */
-	public void update(CellDesignerRnaRegion mr) {
-		if (this.idRnaRegion != null && !this.idRnaRegion.equals("") && !this.idRnaRegion.equals(mr.getIdRnaRegion())) {
-			throw new InvalidArgumentException("Cannot update from mr with different id");
-		}
-		this.size = mr.getSize();
-		if (mr.getState() != null) {
-			this.state = mr.getState();
-		}
-		if (mr.getName() != null) {
-			this.name = mr.getName();
-		}
-		if (mr.getPos() != null) {
-			this.setPos(mr.getPos());
-		}
-
-	}
-
-	@Override
-	public String toString() {
-		String result = "" + getIdRnaRegion() + "," + getType() + "," + getPos() + "," + getSize() + "," + getState() + ",";
-		return result;
-
-	}
-
-	/**
-	 * @return the id
-	 * @see #id
-	 */
-	public String getIdRnaRegion() {
-		return idRnaRegion;
-	}
-
-	/**
-	 * @param id
-	 *          the id to set
-	 * @see #id
-	 */
-	public void setIdRnaRegion(String id) {
-		this.idRnaRegion = id;
-	}
-
-	/**
-	 * @return the type
-	 * @see #type
-	 */
-	public String getType() {
-		return type;
-	}
-
-	/**
-	 * @param type
-	 *          the type to set
-	 * @see #type
-	 */
-	public void setType(String type) {
-		this.type = type;
-	}
-
-	/**
-	 * @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 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 size
-	 * @see #size
-	 */
-	public double getSize() {
-		return size;
-	}
-
-	/**
-	 * @param size
-	 *          the size to set
-	 * @see #size
-	 */
-	public void setSize(double size) {
-		this.size = size;
-	}
-
-	/**
-	 * @return the pos
-	 * @see #pos
-	 */
-	public Double getPos() {
-		return pos;
-	}
-
-	/**
-	 * @param pos
-	 *          the pos to set
-	 * @see #pos
-	 */
-	public void setPos(Double pos) {
-		this.pos = pos;
-	}
-
-	/**
-	 * @return the species
-	 * @see #species
-	 */
-	public CellDesignerRna getSpecies() {
-		return species;
-	}
-
-	/**
-	 * @param species
-	 *          the species to set
-	 * @see #species
-	 */
-	public void setSpecies(CellDesignerRna species) {
-		this.species = species;
-	}
-
-	/**
-	 * Creates model representation of {@link RnaRegion}.
-	 * 
-	 * @return {@link RnaRegion} representing this object in a model
-	 */
-	public RnaRegion createRnaRegionAlias() {
-		RnaRegion result = new RnaRegion();
-		result.setIdRnaRegion(this.idRnaRegion);
-		result.setSize(this.size);
-		result.setPos(this.getPos());
-		result.setType(this.getType());
-		result.setState(this.state);
-		result.setName(this.name);
-		return result;
-	}
-
-}
+package lcsb.mapviewer.converter.model.celldesigner.structure.fields;
+
+import java.awt.geom.Point2D;
+import java.io.Serializable;
+
+import org.apache.log4j.Logger;
+
+import lcsb.mapviewer.common.exception.InvalidArgumentException;
+import lcsb.mapviewer.converter.model.celldesigner.structure.CellDesignerRna;
+import lcsb.mapviewer.model.map.species.Rna;
+import lcsb.mapviewer.model.map.species.field.ModificationState;
+import lcsb.mapviewer.model.map.species.field.RnaRegion;
+
+/**
+ * This structure contains information about rna region (rna fragment of
+ * interest) for a specific
+ * {@link lcsb.mapviewer.converter.model.celldesigner.structure.CellDesignerRna
+ * Rna}.
+ * 
+ * @author Piotr Gawron
+ * 
+ */
+public class CellDesignerRnaRegion implements Serializable {
+
+  /**
+   * 
+   */
+  private static final long serialVersionUID = 1L;
+
+  /**
+   * Default {@link #size} of the region.
+   */
+  private static final double DEFAULT_SIZE = 0.1;
+
+  /**
+   * Default class logger.
+   */
+  @SuppressWarnings("unused")
+  private static Logger logger = Logger.getLogger(CellDesignerRnaRegion.class.getName());
+
+  /**
+   * Identifier of the region. Unique in the
+   * {@link lcsb.mapviewer.model.map.model.Model}.
+   */
+  private String idRnaRegion = "";
+
+  /**
+   * Type of the region in the rna. There are three possible values:
+   * <ul>
+   * <li>Coding region,</li>
+   * <li>Protein binding domain,</li>
+   * <li>Modification site.</li>
+   * </ul>
+   */
+  private String type = "";
+
+  /**
+   * Defines a state of the region (for instance ubiquitinated etc).
+   * 
+   * @see ModificationState
+   */
+  private ModificationState state = null;
+
+  /**
+   * Name of the region.
+   */
+  private String name = "";
+
+  /**
+   * Size of the region in the graphic representation.
+   */
+  private double size = DEFAULT_SIZE;
+
+  /**
+   * Position on the species in graphic representation.
+   */
+  private Double pos;
+
+  /**
+   * Defines a species where the region belongs to.
+   */
+  private CellDesignerRna species;
+
+  /**
+   * Default constructor.
+   */
+  public CellDesignerRnaRegion() {
+
+  }
+
+  /**
+   * Creates object with the data taken from paramter region.
+   * 
+   * @param mr
+   *          original {@link CellDesignerRnaRegion}
+   */
+  public CellDesignerRnaRegion(CellDesignerRnaRegion mr) {
+    this.idRnaRegion = mr.idRnaRegion;
+    this.size = mr.size;
+    setPos(mr.getPos());
+    this.type = mr.type;
+    this.state = mr.state;
+    this.name = mr.name;
+  }
+
+  /**
+   * Sets {@link #size}.
+   * 
+   * @param text
+   *          new size value in string format
+   */
+  public void setSize(String text) {
+    try {
+      size = Double.parseDouble(text);
+    } catch (NumberFormatException e) {
+      throw new InvalidArgumentException("Invalid angle: " + text, e);
+    }
+
+  }
+
+  /**
+   * Sets {@link #pos}.
+   * 
+   * @param text
+   *          new {@link #pos} value in string format
+   */
+  public void setPos(String text) {
+    try {
+      setPos(Double.parseDouble(text));
+    } catch (NumberFormatException e) {
+      throw new InvalidArgumentException("Invalid pos: " + text, e);
+    }
+
+  }
+
+  /**
+   * Updates fields in the object with the data given in the parameter rna region.
+   * 
+   * @param mr
+   *          {@link CellDesignerRnaRegion} from which data will be used to update
+   */
+  public void update(CellDesignerRnaRegion mr) {
+    if (this.idRnaRegion != null && !this.idRnaRegion.equals("") && !this.idRnaRegion.equals(mr.getIdRnaRegion())) {
+      throw new InvalidArgumentException("Cannot update from mr with different id");
+    }
+    this.size = mr.getSize();
+    if (mr.getState() != null) {
+      this.state = mr.getState();
+    }
+    if (mr.getName() != null) {
+      this.name = mr.getName();
+    }
+    if (mr.getPos() != null) {
+      this.setPos(mr.getPos());
+    }
+
+  }
+
+  @Override
+  public String toString() {
+    String result = "" + getIdRnaRegion() + "," + getType() + "," + getPos() + "," + getSize() + "," + getState() + ",";
+    return result;
+
+  }
+
+  /**
+   * @return the id
+   * @see #id
+   */
+  public String getIdRnaRegion() {
+    return idRnaRegion;
+  }
+
+  /**
+   * @param id
+   *          the id to set
+   * @see #id
+   */
+  public void setIdRnaRegion(String id) {
+    this.idRnaRegion = id;
+  }
+
+  /**
+   * @return the type
+   * @see #type
+   */
+  public String getType() {
+    return type;
+  }
+
+  /**
+   * @param type
+   *          the type to set
+   * @see #type
+   */
+  public void setType(String type) {
+    this.type = type;
+  }
+
+  /**
+   * @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 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 size
+   * @see #size
+   */
+  public double getSize() {
+    return size;
+  }
+
+  /**
+   * @param size
+   *          the size to set
+   * @see #size
+   */
+  public void setSize(double size) {
+    this.size = size;
+  }
+
+  /**
+   * @return the pos
+   * @see #pos
+   */
+  public Double getPos() {
+    return pos;
+  }
+
+  /**
+   * @param pos
+   *          the pos to set
+   * @see #pos
+   */
+  public void setPos(Double pos) {
+    this.pos = pos;
+  }
+
+  /**
+   * @return the species
+   * @see #species
+   */
+  public CellDesignerRna getSpecies() {
+    return species;
+  }
+
+  /**
+   * @param species
+   *          the species to set
+   * @see #species
+   */
+  public void setSpecies(CellDesignerRna species) {
+    this.species = species;
+  }
+
+  /**
+   * Creates model representation of {@link RnaRegion}.
+   * 
+   * @return {@link RnaRegion} representing this object in a model
+   */
+  public RnaRegion createRnaRegionAlias(Rna element) {
+    RnaRegion result = new RnaRegion();
+    result.setIdRnaRegion(this.idRnaRegion);
+    result.setSize(this.size);
+    result.setPosition(new Point2D.Double(
+        element.getX() + element.getWidth() / 4.0 + element.getWidth() * 3.0 / 4.0 * pos, element.getY()));
+    result.setType(this.getType());
+    result.setState(this.state);
+    result.setName(this.name);
+    return result;
+  }
+
+}
diff --git a/converter-graphics/src/main/java/lcsb/mapviewer/converter/graphics/bioEntity/element/species/RnaConverter.java b/converter-graphics/src/main/java/lcsb/mapviewer/converter/graphics/bioEntity/element/species/RnaConverter.java
index bf0b0533f521cf4572b7b00fdcca619f978c9263..ab2e0cf26c2c17101a1950a2b272535e0eb901a0 100644
--- a/converter-graphics/src/main/java/lcsb/mapviewer/converter/graphics/bioEntity/element/species/RnaConverter.java
+++ b/converter-graphics/src/main/java/lcsb/mapviewer/converter/graphics/bioEntity/element/species/RnaConverter.java
@@ -1,162 +1,154 @@
-/**
- * Default constructor.
- * 
- * @param colorExtractor
- *          Object that helps to convert {@link ColorSchema} values into colors
- *          when drawing {@link Species}
- */
-package lcsb.mapviewer.converter.graphics.bioEntity.element.species;
-
-import java.awt.Color;
-import java.awt.Font;
-import java.awt.Graphics2D;
-import java.awt.Stroke;
-import java.awt.geom.AffineTransform;
-import java.awt.geom.Ellipse2D;
-import java.awt.geom.GeneralPath;
-import java.awt.geom.Path2D;
-import java.awt.geom.PathIterator;
-import java.awt.geom.Point2D;
-
-import org.apache.log4j.Logger;
-
-import lcsb.mapviewer.commands.ColorExtractor;
-import lcsb.mapviewer.converter.graphics.ConverterParams;
-import lcsb.mapviewer.model.map.layout.ColorSchema;
-import lcsb.mapviewer.model.map.species.Rna;
-import lcsb.mapviewer.model.map.species.Species;
-import lcsb.mapviewer.model.map.species.field.ModificationState;
-import lcsb.mapviewer.model.map.species.field.RnaRegion;
-
-/**
- * This class defines methods used for drawing {@link Rna} on the
- * {@link Graphics2D} object.
- * 
- * @author Piotr Gawron
- * 
- */
-public class RnaConverter extends SpeciesConverter<Rna> {
-	/**
-	 * Default class logger.
-	 */
-	@SuppressWarnings("unused")
-	private static Logger logger = Logger.getLogger(RnaConverter.class.getName());
-
-	/**
-	 * Default constructor.
-	 * 
-	 * @param colorExtractor
-	 *          Object that helps to convert {@link ColorSchema} values into
-	 *          colors when drawing {@link Species}
-	 */
-	public RnaConverter(ColorExtractor colorExtractor) {
-		super(colorExtractor);
-	}
-
-	@Override
-	public void draw(final Rna rna, final Graphics2D graphics, final ConverterParams params) {
-		GeneralPath path = getRnaPath(rna);
-		Color c = graphics.getColor();
-		graphics.setColor(rna.getColor());
-		graphics.fill(path);
-		graphics.setColor(c);
-		Stroke stroke = graphics.getStroke();
-		graphics.setStroke(getBorderLine(rna));
-		graphics.draw(path);
-		graphics.setStroke(stroke);
-
-		for (RnaRegion mr : rna.getRegions()) {
-			drawModification(rna, mr, graphics, false, false);
-		}
-
-		drawText(rna, graphics, params);
-	}
-
-	/**
-	 * Returns shape of the {@link Rna} as a {@link GeneralPath} object.
-	 * 
-	 * @param rna
-	 *          {@link Rna} for which we are looking for a border
-	 * @return {@link GeneralPath} object defining border of the given {@link Rna}
-	 */
-	private GeneralPath getRnaPath(final Rna rna) {
-		// CHECKSTYLE:OFF
-		GeneralPath path = new GeneralPath(Path2D.WIND_EVEN_ODD, 4);
-		path.moveTo(rna.getX() + rna.getWidth() / 4, rna.getY());
-		path.lineTo(rna.getX() + rna.getWidth(), rna.getY());
-		path.lineTo(rna.getX() + rna.getWidth() * 3 / 4, rna.getY() + rna.getHeight());
-		path.lineTo(rna.getX(), rna.getY() + rna.getHeight());
-		// CHECKSTYLE:ON
-		path.closePath();
-		return path;
-	}
-
-	@Override
-	public PathIterator getBoundPathIterator(final Rna rna) {
-		return getRnaPath(rna).getPathIterator(new AffineTransform());
-	}
-
-	/**
-	 * This method draws modification of the alias. If drawEmptyModification is
-	 * set to false then modification is not drawn if empty. If drawDescription is
-	 * set then also description (position) of the modification is drawn on the
-	 * canvas.
-	 * 
-	 * @param rna
-	 *          object that is 'parent' of the residue
-	 * @param region
-	 *          {@link RnaRegion modification} to be drawn
-	 * @param graphics
-	 *          - where the modification should be drawn
-	 * @param drawEmptyModification
-	 *          flag that indicates if we should draw empty modification
-	 * @param drawDescription
-	 *          flag that indicates if we should draw description of the
-	 *          modification
-	 */
-	private void drawModification(final Rna rna, final RnaRegion region, final Graphics2D graphics, final boolean drawEmptyModification,
-			final boolean drawDescription) {
-		if ((!drawEmptyModification) && (region.getState() == null)) {
-			return;
-		}
-		double diameter = DEFAULT_MODIFICATION_DIAMETER;
-
-		double x = rna.getX();
-		double y = rna.getY();
-
-		double width = rna.getWidth();
-
-		// CHECKSTYLE:OFF
-		// we draw modifier on the upper border of rna (which is only in
-		// 3/4 of the width of alias, but starts in 1/4 of the width)
-		Point2D p = new Point2D.Double(x + width / 4.0 + width * 3.0 / 4.0 * region.getPos(), y - DEFAULT_MODIFICATION_DIAMETER);
-		// CHECKSTYLE:ON
-
-		Ellipse2D ellipse = new Ellipse2D.Double(p.getX() - diameter / 2, p.getY() - diameter / 2, diameter, diameter);
-		Color c = graphics.getColor();
-		graphics.setColor(Color.WHITE);
-		graphics.fill(ellipse);
-		graphics.setColor(c);
-		graphics.draw(ellipse);
-		graphics.drawLine((int) p.getX(), (int) (p.getY() + diameter / 2), (int) p.getX(), (int) y);
-
-		String text = region.getName();
-		if (!text.equals("") && drawDescription) {
-			double textWidth = graphics.getFontMetrics().stringWidth(text);
-			Point2D p2 = new Point2D.Double(p.getX() - textWidth / 2, p.getY() - DEFAULT_SPECIES_MODIFIER_FONT_SIZE);
-			graphics.drawString(text, (int) p2.getX(), (int) p2.getY());
-		}
-		ModificationState state = region.getState();
-		if (state != null) {
-			String str = state.getAbbreviation();
-			Font tmpFont = graphics.getFont();
-			graphics.setFont(getStructuralFont());
-			double textX = p.getX() - graphics.getFontMetrics().stringWidth(str) / 2;
-			double textY = p.getY() + graphics.getFontMetrics().getAscent() / 2;
-			graphics.drawString(str, (int) textX, (int) textY);
-			graphics.setFont(tmpFont);
-		}
-
-	}
-
-}
+/**
+ * Default constructor.
+ * 
+ * @param colorExtractor
+ *          Object that helps to convert {@link ColorSchema} values into colors
+ *          when drawing {@link Species}
+ */
+package lcsb.mapviewer.converter.graphics.bioEntity.element.species;
+
+import java.awt.Color;
+import java.awt.Font;
+import java.awt.Graphics2D;
+import java.awt.Stroke;
+import java.awt.geom.AffineTransform;
+import java.awt.geom.Ellipse2D;
+import java.awt.geom.GeneralPath;
+import java.awt.geom.Path2D;
+import java.awt.geom.PathIterator;
+import java.awt.geom.Point2D;
+
+import org.apache.log4j.Logger;
+
+import lcsb.mapviewer.commands.ColorExtractor;
+import lcsb.mapviewer.converter.graphics.ConverterParams;
+import lcsb.mapviewer.model.map.layout.ColorSchema;
+import lcsb.mapviewer.model.map.species.Rna;
+import lcsb.mapviewer.model.map.species.Species;
+import lcsb.mapviewer.model.map.species.field.ModificationState;
+import lcsb.mapviewer.model.map.species.field.RnaRegion;
+
+/**
+ * This class defines methods used for drawing {@link Rna} on the
+ * {@link Graphics2D} object.
+ * 
+ * @author Piotr Gawron
+ * 
+ */
+public class RnaConverter extends SpeciesConverter<Rna> {
+  /**
+   * Default class logger.
+   */
+  @SuppressWarnings("unused")
+  private static Logger logger = Logger.getLogger(RnaConverter.class.getName());
+
+  /**
+   * Default constructor.
+   * 
+   * @param colorExtractor
+   *          Object that helps to convert {@link ColorSchema} values into colors
+   *          when drawing {@link Species}
+   */
+  public RnaConverter(ColorExtractor colorExtractor) {
+    super(colorExtractor);
+  }
+
+  @Override
+  public void draw(final Rna rna, final Graphics2D graphics, final ConverterParams params) {
+    GeneralPath path = getRnaPath(rna);
+    Color c = graphics.getColor();
+    graphics.setColor(rna.getColor());
+    graphics.fill(path);
+    graphics.setColor(c);
+    Stroke stroke = graphics.getStroke();
+    graphics.setStroke(getBorderLine(rna));
+    graphics.draw(path);
+    graphics.setStroke(stroke);
+
+    for (RnaRegion mr : rna.getRegions()) {
+      drawModification(rna, mr, graphics, false, false);
+    }
+
+    drawText(rna, graphics, params);
+  }
+
+  /**
+   * Returns shape of the {@link Rna} as a {@link GeneralPath} object.
+   * 
+   * @param rna
+   *          {@link Rna} for which we are looking for a border
+   * @return {@link GeneralPath} object defining border of the given {@link Rna}
+   */
+  private GeneralPath getRnaPath(final Rna rna) {
+    // CHECKSTYLE:OFF
+    GeneralPath path = new GeneralPath(Path2D.WIND_EVEN_ODD, 4);
+    path.moveTo(rna.getX() + rna.getWidth() / 4, rna.getY());
+    path.lineTo(rna.getX() + rna.getWidth(), rna.getY());
+    path.lineTo(rna.getX() + rna.getWidth() * 3 / 4, rna.getY() + rna.getHeight());
+    path.lineTo(rna.getX(), rna.getY() + rna.getHeight());
+    // CHECKSTYLE:ON
+    path.closePath();
+    return path;
+  }
+
+  @Override
+  public PathIterator getBoundPathIterator(final Rna rna) {
+    return getRnaPath(rna).getPathIterator(new AffineTransform());
+  }
+
+  /**
+   * This method draws modification of the alias. If drawEmptyModification is set
+   * to false then modification is not drawn if empty. If drawDescription is set
+   * then also description (position) of the modification is drawn on the canvas.
+   * 
+   * @param rna
+   *          object that is 'parent' of the residue
+   * @param region
+   *          {@link RnaRegion modification} to be drawn
+   * @param graphics
+   *          - where the modification should be drawn
+   * @param drawEmptyModification
+   *          flag that indicates if we should draw empty modification
+   * @param drawDescription
+   *          flag that indicates if we should draw description of the
+   *          modification
+   */
+  private void drawModification(final Rna rna, final RnaRegion region, final Graphics2D graphics,
+      final boolean drawEmptyModification, final boolean drawDescription) {
+    if ((!drawEmptyModification) && (region.getState() == null)) {
+      return;
+    }
+    double diameter = DEFAULT_MODIFICATION_DIAMETER;
+
+    double y = rna.getY();
+
+    Point2D p = new Point2D.Double(region.getPosition().getX(), region.getPosition().getY() - diameter);
+
+    Ellipse2D ellipse = new Ellipse2D.Double(p.getX() - diameter / 2, p.getY() - diameter / 2, diameter, diameter);
+    Color c = graphics.getColor();
+    graphics.setColor(Color.WHITE);
+    graphics.fill(ellipse);
+    graphics.setColor(c);
+    graphics.draw(ellipse);
+    graphics.drawLine((int) p.getX(), (int) (p.getY() + diameter / 2), (int) p.getX(), (int) y);
+
+    String text = region.getName();
+    if (!text.equals("") && drawDescription) {
+      double textWidth = graphics.getFontMetrics().stringWidth(text);
+      Point2D p2 = new Point2D.Double(p.getX() - textWidth / 2, p.getY() - DEFAULT_SPECIES_MODIFIER_FONT_SIZE);
+      graphics.drawString(text, (int) p2.getX(), (int) p2.getY());
+    }
+    ModificationState state = region.getState();
+    if (state != null) {
+      String str = state.getAbbreviation();
+      Font tmpFont = graphics.getFont();
+      graphics.setFont(getStructuralFont());
+      double textX = p.getX() - graphics.getFontMetrics().stringWidth(str) / 2;
+      double textY = p.getY() + graphics.getFontMetrics().getAscent() / 2;
+      graphics.drawString(str, (int) textX, (int) textY);
+      graphics.setFont(tmpFont);
+    }
+
+  }
+
+}
diff --git a/model/src/main/java/lcsb/mapviewer/model/map/species/field/RnaRegion.java b/model/src/main/java/lcsb/mapviewer/model/map/species/field/RnaRegion.java
index 9c5e32a201e2f8d6e4f84d40db4b6af0beab72e1..4dd65ffe78d7066baa1b3bdf0543fb2127c77463 100644
--- a/model/src/main/java/lcsb/mapviewer/model/map/species/field/RnaRegion.java
+++ b/model/src/main/java/lcsb/mapviewer/model/map/species/field/RnaRegion.java
@@ -1,327 +1,305 @@
-package lcsb.mapviewer.model.map.species.field;
-
-import java.io.Serializable;
-
-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 lcsb.mapviewer.common.exception.InvalidArgumentException;
-import lcsb.mapviewer.model.map.species.Rna;
-
-/**
- * This structure contains information about rna region (rna fragment of
- * interest) for a specific {@link Rna}.
- * 
- * @author Piotr Gawron
- * 
- */
-@Entity
-@Table(name = "rna_region_table")
-@org.hibernate.annotations.GenericGenerator(name = "test-increment-strategy", strategy = "increment")
-public class RnaRegion implements Serializable, ElementModification {
-
-	/**
-	 * 
-	 */
-	private static final long		serialVersionUID = 1L;
-
-	/**
-	 * Default {@link #size} of the region.
-	 */
-	private static final double	DEFAULT_SIZE		 = 0.1;
-
-	/**
-	 * Default class logger.
-	 */
-	@SuppressWarnings("unused")
-	private static Logger				logger					 = Logger.getLogger(RnaRegion.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 region. Unique in the
-	 * {@link lcsb.mapviewer.model.map.model.Model}.
-	 */
-	@Column(name = "idrnaregion")
-	private String							idRnaRegion			 = "";
-	/**
-	 * Type of the region in the rna. There are three possible values:
-	 * <ul>
-	 * <li>Coding region,</li>
-	 * <li>Protein binding domain,</li>
-	 * <li>Modification site.</li>
-	 * </ul>
-	 */
-
-	@Column(name = "type")
-	private String							type						 = "";
-
-	/**
-	 * Defines a state of the region (for instance ubiquitinated etc).
-	 * 
-	 * @see ModificationState
-	 */
-	@Column(name = "state")
-	private ModificationState		state						 = null;
-
-	/**
-	 * Name of the region.
-	 */
-	@Column(name = "name")
-	private String							name						 = "";
-
-	/**
-	 * Size of the region in the graphic representation.
-	 */
-	@Column(name = "size")
-	private double							size						 = DEFAULT_SIZE;
-
-	/**
-	 * Position on the species in graphic representation.
-	 */
-	@Column(name = "pos")
-	private Double							pos;
-
-	/**
-	 * Defines a species where the region belongs to.
-	 */
-	@ManyToOne(fetch = FetchType.LAZY)
-	@JoinColumn(name = "idSpeciesDb")
-	private Rna									species;
-
-	/**
-	 * Default constructor.
-	 */
-	public RnaRegion() {
-
-	}
-
-	/**
-	 * Creates object with the data taken from paramter region.
-	 * 
-	 * @param mr
-	 *          original {@link RnaRegion}
-	 */
-	public RnaRegion(RnaRegion mr) {
-		this.id = mr.id;
-		this.idRnaRegion = mr.idRnaRegion;
-		this.size = mr.size;
-		setPos(mr.getPos());
-		this.type = mr.type;
-		this.state = mr.state;
-		this.name = mr.name;
-	}
-
-	/**
-	 * Sets {@link #size}.
-	 * 
-	 * @param text
-	 *          new size value in string format
-	 */
-	public void setSize(String text) {
-		try {
-			size = Double.parseDouble(text);
-		} catch (NumberFormatException e) {
-			throw new InvalidArgumentException("Invalid angle: " + text, e);
-		}
-
-	}
-
-	/**
-	 * Sets {@link #pos}.
-	 * 
-	 * @param text
-	 *          new {@link #pos} value in string format
-	 */
-	public void setPos(String text) {
-		try {
-			setPos(Double.parseDouble(text));
-		} catch (NumberFormatException e) {
-			throw new InvalidArgumentException("Invalid pos: " + text, e);
-		}
-
-	}
-
-	/**
-	 * Updates fields in the object with the data given in the parameter rna
-	 * region.
-	 * 
-	 * @param mr
-	 *          {@link RnaRegion} from which data will be used to update
-	 */
-	public void update(RnaRegion mr) {
-		if (this.idRnaRegion != null && !this.idRnaRegion.equals("") && !this.idRnaRegion.equals(mr.getIdRnaRegion())) {
-			throw new InvalidArgumentException("Cannot update from mr with different id");
-		}
-		this.size = mr.getSize();
-		if (mr.getState() != null) {
-			this.state = mr.getState();
-		}
-		if (mr.getName() != null) {
-			this.name = mr.getName();
-		}
-		if (mr.getPos() != null) {
-			this.setPos(mr.getPos());
-		}
-
-	}
-
-	@Override
-	public String toString() {
-		String result = "" + getIdRnaRegion() + "," + getType() + "," + getPos() + "," + getSize() + "," + getState() + ",";
-		return result;
-
-	}
-
-	/**
-	 * @return the idRnaRegion
-	 * @see #idRnaRegion
-	 */
-	public int getId() {
-		return id;
-	}
-
-	/**
-	 * @param id
-	 *          the idRnaRegion to set
-	 * @see #id
-	 */
-	public void setId(int id) {
-		this.id = id;
-	}
-
-	/**
-	 * @return the id
-	 * @see #id
-	 */
-	public String getIdRnaRegion() {
-		return idRnaRegion;
-	}
-
-	/**
-	 * @param id
-	 *          the id to set
-	 * @see #id
-	 */
-	public void setIdRnaRegion(String id) {
-		this.idRnaRegion = id;
-	}
-
-	/**
-	 * @return the type
-	 * @see #type
-	 */
-	public String getType() {
-		return type;
-	}
-
-	/**
-	 * @param type
-	 *          the type to set
-	 * @see #type
-	 */
-	public void setType(String type) {
-		this.type = type;
-	}
-
-	/**
-	 * @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 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 size
-	 * @see #size
-	 */
-	public double getSize() {
-		return size;
-	}
-
-	/**
-	 * @param size
-	 *          the size to set
-	 * @see #size
-	 */
-	public void setSize(double size) {
-		this.size = size;
-	}
-
-	/**
-	 * @return the pos
-	 * @see #pos
-	 */
-	public Double getPos() {
-		return pos;
-	}
-
-	/**
-	 * @param pos
-	 *          the pos to set
-	 * @see #pos
-	 */
-	public void setPos(Double pos) {
-		this.pos = pos;
-	}
-
-	/**
-	 * @return the species
-	 * @see #species
-	 */
-	public Rna getSpecies() {
-		return species;
-	}
-
-	/**
-	 * @param species
-	 *          the species to set
-	 * @see #species
-	 */
-	public void setSpecies(Rna species) {
-		this.species = species;
-	}
-
-}
+package lcsb.mapviewer.model.map.species.field;
+
+import java.awt.geom.Point2D;
+import java.io.Serializable;
+
+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.InvalidArgumentException;
+import lcsb.mapviewer.model.map.species.Rna;
+
+/**
+ * This structure contains information about rna region (rna fragment of
+ * interest) for a specific {@link Rna}.
+ * 
+ * @author Piotr Gawron
+ * 
+ */
+@Entity
+@Table(name = "rna_region_table")
+@org.hibernate.annotations.GenericGenerator(name = "test-increment-strategy", strategy = "increment")
+public class RnaRegion implements Serializable, ElementModification {
+
+  /**
+   * 
+   */
+  private static final long serialVersionUID = 1L;
+
+  /**
+   * Default {@link #size} of the region.
+   */
+  private static final double DEFAULT_SIZE = 0.1;
+
+  /**
+   * Default class logger.
+   */
+  @SuppressWarnings("unused")
+  private static Logger logger = Logger.getLogger(RnaRegion.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 region. Unique in the
+   * {@link lcsb.mapviewer.model.map.model.Model}.
+   */
+  @Column(name = "idrnaregion")
+  private String idRnaRegion = "";
+  /**
+   * Type of the region in the rna. There are three possible values:
+   * <ul>
+   * <li>Coding region,</li>
+   * <li>Protein binding domain,</li>
+   * <li>Modification site.</li>
+   * </ul>
+   */
+
+  @Column(name = "type")
+  private String type = "";
+
+  /**
+   * Defines a state of the region (for instance ubiquitinated etc).
+   * 
+   * @see ModificationState
+   */
+  @Column(name = "state")
+  private ModificationState state = null;
+
+  /**
+   * Name of the region.
+   */
+  @Column(name = "name")
+  private String name = "";
+
+  /**
+   * Size of the region in the graphic representation.
+   */
+  @Column(name = "size")
+  private double size = DEFAULT_SIZE;
+
+  /**
+   * Position on the species in graphic representation.
+   */
+  @Column(name = "position")
+  @Type(type = "lcsb.mapviewer.persist.mapper.Point2DMapper")
+  private Point2D position;
+
+  /**
+   * Defines a species where the region belongs to.
+   */
+  @ManyToOne(fetch = FetchType.LAZY)
+  @JoinColumn(name = "idSpeciesDb")
+  private Rna species;
+
+  /**
+   * Default constructor.
+   */
+  public RnaRegion() {
+
+  }
+
+  /**
+   * Creates object with the data taken from paramter region.
+   * 
+   * @param mr
+   *          original {@link RnaRegion}
+   */
+  public RnaRegion(RnaRegion mr) {
+    this.id = mr.id;
+    this.idRnaRegion = mr.idRnaRegion;
+    this.size = mr.size;
+    setPosition(mr.getPosition());
+    this.type = mr.type;
+    this.state = mr.state;
+    this.name = mr.name;
+  }
+
+  /**
+   * Sets {@link #size}.
+   * 
+   * @param text
+   *          new size value in string format
+   */
+  public void setSize(String text) {
+    try {
+      size = Double.parseDouble(text);
+    } catch (NumberFormatException e) {
+      throw new InvalidArgumentException("Invalid angle: " + text, e);
+    }
+
+  }
+
+  /**
+   * Updates fields in the object with the data given in the parameter rna region.
+   * 
+   * @param mr
+   *          {@link RnaRegion} from which data will be used to update
+   */
+  public void update(RnaRegion mr) {
+    if (this.idRnaRegion != null && !this.idRnaRegion.equals("") && !this.idRnaRegion.equals(mr.getIdRnaRegion())) {
+      throw new InvalidArgumentException("Cannot update from mr with different id");
+    }
+    this.size = mr.getSize();
+    if (mr.getState() != null) {
+      this.state = mr.getState();
+    }
+    if (mr.getName() != null) {
+      this.name = mr.getName();
+    }
+    if (mr.getPosition() != null) {
+      this.setPosition(mr.getPosition());
+    }
+
+  }
+
+  @Override
+  public String toString() {
+    String result = "" + getIdRnaRegion() + "," + getType() + "," + getPosition() + "," + getSize() + "," + getState() + ",";
+    return result;
+
+  }
+
+  /**
+   * @return the idRnaRegion
+   * @see #idRnaRegion
+   */
+  public int getId() {
+    return id;
+  }
+
+  /**
+   * @param id
+   *          the idRnaRegion to set
+   * @see #id
+   */
+  public void setId(int id) {
+    this.id = id;
+  }
+
+  /**
+   * @return the id
+   * @see #id
+   */
+  public String getIdRnaRegion() {
+    return idRnaRegion;
+  }
+
+  /**
+   * @param id
+   *          the id to set
+   * @see #id
+   */
+  public void setIdRnaRegion(String id) {
+    this.idRnaRegion = id;
+  }
+
+  /**
+   * @return the type
+   * @see #type
+   */
+  public String getType() {
+    return type;
+  }
+
+  /**
+   * @param type
+   *          the type to set
+   * @see #type
+   */
+  public void setType(String type) {
+    this.type = type;
+  }
+
+  /**
+   * @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 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 size
+   * @see #size
+   */
+  public double getSize() {
+    return size;
+  }
+
+  /**
+   * @param size
+   *          the size to set
+   * @see #size
+   */
+  public void setSize(double size) {
+    this.size = size;
+  }
+
+  /**
+   * @return the species
+   * @see #species
+   */
+  public Rna getSpecies() {
+    return species;
+  }
+
+  /**
+   * @param species
+   *          the species to set
+   * @see #species
+   */
+  public void setSpecies(Rna species) {
+    this.species = species;
+  }
+
+  public Point2D getPosition() {
+    return position;
+  }
+
+  public void setPosition(Point2D position) {
+    this.position = position;
+  }
+
+}
diff --git a/model/src/test/java/lcsb/mapviewer/model/map/species/RnaComparatorTest.java b/model/src/test/java/lcsb/mapviewer/model/map/species/RnaComparatorTest.java
index 3ead55dee76b0c53b570b725795334aed2bfa48c..6f57d01966e8951fc74d3fca102c0f19a3d5a934 100644
--- a/model/src/test/java/lcsb/mapviewer/model/map/species/RnaComparatorTest.java
+++ b/model/src/test/java/lcsb/mapviewer/model/map/species/RnaComparatorTest.java
@@ -1,108 +1,110 @@
-package lcsb.mapviewer.model.map.species;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.mockito.Mockito;
-
-import lcsb.mapviewer.common.exception.NotImplementedException;
-import lcsb.mapviewer.model.map.species.field.ModificationState;
-import lcsb.mapviewer.model.map.species.field.RnaRegion;
-
-public class RnaComparatorTest {
-
-	RnaComparator comparator = new RnaComparator();
-
-	@Before
-	public void setUp() throws Exception {
-	}
-
-	@After
-	public void tearDown() throws Exception {
-	}
-
-	@Test
-	public void testEquals() {
-		try {
-			Rna aRna1 = createRna();
-			Rna aRna2 = createRna();
-
-			assertEquals(0, comparator.compare(aRna1, aRna1));
-
-			assertEquals(0, comparator.compare(aRna1, aRna2));
-			assertEquals(0, comparator.compare(aRna2, aRna1));
-
-		} catch (Exception e) {
-			e.printStackTrace();
-			fail("Unknowne exception occurred");
-		}
-	}
-
-	@Test
-	public void testDifferent() {
-		try {
-			Rna aRna1 = createRna();
-			Rna aRna2 = createRna();
-			aRna1.getRegions().get(0).setState(ModificationState.ACETYLATED);
-			assertTrue(comparator.compare(aRna1, aRna2) != 0);
-			assertTrue(comparator.compare(aRna2, aRna1) != 0);
-
-			aRna1 = createRna();
-			aRna2 = createRna();
-			aRna1.getRegions().clear();
-			assertTrue(comparator.compare(aRna1, aRna2) != 0);
-			assertTrue(comparator.compare(aRna2, aRna1) != 0);
-
-			aRna1 = createRna();
-			aRna2 = createRna();
-			assertTrue(comparator.compare(null, aRna2) != 0);
-			assertTrue(comparator.compare(aRna2, null) != 0);
-			assertTrue(comparator.compare(null, null) == 0);
-
-			Rna rna = createRna();
-			rna.setName("n");
-			assertTrue(comparator.compare(rna, aRna2) != 0);
-
-			assertTrue(comparator.compare(rna, Mockito.mock(Rna.class)) != 0);
-
-		} catch (Exception e) {
-			e.printStackTrace();
-			fail("Unknowne exception occurred");
-		}
-	}
-
-	public Rna createRna() {
-		Rna result = new Rna();
-		result.setHypothetical(true);
-
-		RnaRegion region1 = new RnaRegion();
-		result.addRegion(region1);
-		region1.setIdRnaRegion("a");
-		region1.setState(ModificationState.DONT_CARE);
-		region1.setPos("1");
-		region1.setSize("2");
-		region1.setType("type");
-		return result;
-	}
-
-	@Test
-	public void testInvalid() {
-		try {
-			Rna object = Mockito.mock(Rna.class);
-
-			comparator.compare(object, object);
-
-			fail("Exception expected");
-		} catch (NotImplementedException e) {
-
-		} catch (Exception e) {
-			e.printStackTrace();
-			fail("Unknowne exception occurred");
-		}
-	}
-
-}
+package lcsb.mapviewer.model.map.species;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.awt.geom.Point2D;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.Mockito;
+
+import lcsb.mapviewer.common.exception.NotImplementedException;
+import lcsb.mapviewer.model.map.species.field.ModificationState;
+import lcsb.mapviewer.model.map.species.field.RnaRegion;
+
+public class RnaComparatorTest {
+
+  RnaComparator comparator = new RnaComparator();
+
+  @Before
+  public void setUp() throws Exception {
+  }
+
+  @After
+  public void tearDown() throws Exception {
+  }
+
+  @Test
+  public void testEquals() {
+    try {
+      Rna aRna1 = createRna();
+      Rna aRna2 = createRna();
+
+      assertEquals(0, comparator.compare(aRna1, aRna1));
+
+      assertEquals(0, comparator.compare(aRna1, aRna2));
+      assertEquals(0, comparator.compare(aRna2, aRna1));
+
+    } catch (Exception e) {
+      e.printStackTrace();
+      fail("Unknowne exception occurred");
+    }
+  }
+
+  @Test
+  public void testDifferent() {
+    try {
+      Rna aRna1 = createRna();
+      Rna aRna2 = createRna();
+      aRna1.getRegions().get(0).setState(ModificationState.ACETYLATED);
+      assertTrue(comparator.compare(aRna1, aRna2) != 0);
+      assertTrue(comparator.compare(aRna2, aRna1) != 0);
+
+      aRna1 = createRna();
+      aRna2 = createRna();
+      aRna1.getRegions().clear();
+      assertTrue(comparator.compare(aRna1, aRna2) != 0);
+      assertTrue(comparator.compare(aRna2, aRna1) != 0);
+
+      aRna1 = createRna();
+      aRna2 = createRna();
+      assertTrue(comparator.compare(null, aRna2) != 0);
+      assertTrue(comparator.compare(aRna2, null) != 0);
+      assertTrue(comparator.compare(null, null) == 0);
+
+      Rna rna = createRna();
+      rna.setName("n");
+      assertTrue(comparator.compare(rna, aRna2) != 0);
+
+      assertTrue(comparator.compare(rna, Mockito.mock(Rna.class)) != 0);
+
+    } catch (Exception e) {
+      e.printStackTrace();
+      fail("Unknowne exception occurred");
+    }
+  }
+
+  public Rna createRna() {
+    Rna result = new Rna();
+    result.setHypothetical(true);
+
+    RnaRegion region1 = new RnaRegion();
+    result.addRegion(region1);
+    region1.setIdRnaRegion("a");
+    region1.setState(ModificationState.DONT_CARE);
+    region1.setPosition(new Point2D.Double(0, 10));
+    region1.setSize("2");
+    region1.setType("type");
+    return result;
+  }
+
+  @Test
+  public void testInvalid() {
+    try {
+      Rna object = Mockito.mock(Rna.class);
+
+      comparator.compare(object, object);
+
+      fail("Exception expected");
+    } catch (NotImplementedException e) {
+
+    } catch (Exception e) {
+      e.printStackTrace();
+      fail("Unknowne exception occurred");
+    }
+  }
+
+}
diff --git a/model/src/test/java/lcsb/mapviewer/model/map/species/field/RnaRegionTest.java b/model/src/test/java/lcsb/mapviewer/model/map/species/field/RnaRegionTest.java
index 11e0edc346820fc24d8807caa425f8ed8d7e138e..bd87bdb2e71c36f0e4e92aa4db114cc3d3a4653e 100644
--- a/model/src/test/java/lcsb/mapviewer/model/map/species/field/RnaRegionTest.java
+++ b/model/src/test/java/lcsb/mapviewer/model/map/species/field/RnaRegionTest.java
@@ -1,133 +1,119 @@
-package lcsb.mapviewer.model.map.species.field;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.fail;
-
-import org.apache.commons.lang3.SerializationUtils;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-import lcsb.mapviewer.common.Configuration;
-import lcsb.mapviewer.common.exception.InvalidArgumentException;
-import lcsb.mapviewer.model.map.species.Rna;
-
-public class RnaRegionTest {
-
-	@Before
-	public void setUp() throws Exception {
-	}
-
-	@After
-	public void tearDown() throws Exception {
-	}
-
-	@Test
-	public void testSerialization() {
-		try {
-			SerializationUtils.serialize(new RnaRegion());
-		} catch (Exception e) {
-			e.printStackTrace();
-			throw e;
-		}
-	}
-
-	@Test
-	public void testConstructor() {
-		try {
-			RnaRegion region = new RnaRegion(new RnaRegion());
-			assertNotNull(region);
-		} catch (Exception e) {
-			e.printStackTrace();
-			throw e;
-		}
-	}
-
-	@Test
-	public void testSetSize() {
-		try {
-			RnaRegion region = new RnaRegion();
-			try {
-				region.setSize("as");
-				fail("Exception expected");
-			} catch (InvalidArgumentException e) {
-			}
-			region.setSize("0.0");
-			assertEquals(0.0, region.getSize(), Configuration.EPSILON);
-		} catch (Exception e) {
-			e.printStackTrace();
-			throw e;
-		}
-	}
-
-	@Test
-	public void testSetPos() {
-		try {
-			RnaRegion region = new RnaRegion();
-			try {
-				region.setPos("as");
-				fail("Exception expected");
-			} catch (InvalidArgumentException e) {
-			}
-			region.setPos("1.0");
-			assertEquals(1.0, region.getPos(), Configuration.EPSILON);
-		} catch (Exception e) {
-			e.printStackTrace();
-			throw e;
-		}
-	}
-
-	@Test
-	public void testUpdate() {
-		try {
-			RnaRegion region = new RnaRegion();
-			RnaRegion region2 = new RnaRegion();
-			region2.setState(ModificationState.ACETYLATED);
-			region2.setName("asd");
-			region2.setPos(2.2);
-			region.update(region2);
-			assertEquals(region2.getName(), region.getName());
-			assertEquals(region2.getPos(), region.getPos());
-			assertEquals(region2.getState(), region.getState());
-		} catch (Exception e) {
-			e.printStackTrace();
-			throw e;
-		}
-	}
-
-	@Test
-	public void testUpdate2() {
-		try {
-			RnaRegion region = new RnaRegion();
-			region.setIdRnaRegion("1");
-			RnaRegion region2 = new RnaRegion();
-			region2.setIdRnaRegion("2");
-			region.update(region2);
-			fail("Exception expected");
-		} catch (InvalidArgumentException e) {
-		} catch (Exception e) {
-			e.printStackTrace();
-			throw e;
-		}
-	}
-
-	@Test
-	public void testGetters() {
-		try {
-			RnaRegion region = new RnaRegion();
-			double size = 2.5;
-			int id = 58;
-			Rna species = new Rna("id");
-			region.setSize(size);
-			region.setSpecies(species);
-			region.setId(id);
-			assertEquals(id, region.getId());
-			assertEquals(size, region.getSize(), Configuration.EPSILON);
-			assertEquals(species, region.getSpecies());
-		} catch (Exception e) {
-			e.printStackTrace();
-			throw e;
-		}
-	}
-}
+package lcsb.mapviewer.model.map.species.field;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.awt.geom.Point2D;
+
+import org.apache.commons.lang3.SerializationUtils;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import lcsb.mapviewer.common.Configuration;
+import lcsb.mapviewer.common.exception.InvalidArgumentException;
+import lcsb.mapviewer.model.map.species.Rna;
+
+public class RnaRegionTest {
+
+  @Before
+  public void setUp() throws Exception {
+  }
+
+  @After
+  public void tearDown() throws Exception {
+  }
+
+  @Test
+  public void testSerialization() {
+    try {
+      SerializationUtils.serialize(new RnaRegion());
+    } catch (Exception e) {
+      e.printStackTrace();
+      throw e;
+    }
+  }
+
+  @Test
+  public void testConstructor() {
+    try {
+      RnaRegion region = new RnaRegion(new RnaRegion());
+      assertNotNull(region);
+    } catch (Exception e) {
+      e.printStackTrace();
+      throw e;
+    }
+  }
+
+  @Test
+  public void testSetSize() {
+    try {
+      RnaRegion region = new RnaRegion();
+      try {
+        region.setSize("as");
+        fail("Exception expected");
+      } catch (InvalidArgumentException e) {
+      }
+      region.setSize("0.0");
+      assertEquals(0.0, region.getSize(), Configuration.EPSILON);
+    } catch (Exception e) {
+      e.printStackTrace();
+      throw e;
+    }
+  }
+
+  @Test
+  public void testUpdate() {
+    try {
+      RnaRegion region = new RnaRegion();
+      RnaRegion region2 = new RnaRegion();
+      region2.setState(ModificationState.ACETYLATED);
+      region2.setName("asd");
+      region2.setPosition(new Point2D.Double(0, 10));
+      region.update(region2);
+      assertEquals(region2.getName(), region.getName());
+      assertTrue(region2.getPosition().distance(region.getPosition()) <= Configuration.EPSILON);
+      assertEquals(region2.getState(), region.getState());
+    } catch (Exception e) {
+      e.printStackTrace();
+      throw e;
+    }
+  }
+
+  @Test
+  public void testUpdate2() {
+    try {
+      RnaRegion region = new RnaRegion();
+      region.setIdRnaRegion("1");
+      RnaRegion region2 = new RnaRegion();
+      region2.setIdRnaRegion("2");
+      region.update(region2);
+      fail("Exception expected");
+    } catch (InvalidArgumentException e) {
+    } catch (Exception e) {
+      e.printStackTrace();
+      throw e;
+    }
+  }
+
+  @Test
+  public void testGetters() {
+    try {
+      RnaRegion region = new RnaRegion();
+      double size = 2.5;
+      int id = 58;
+      Rna species = new Rna("id");
+      region.setSize(size);
+      region.setSpecies(species);
+      region.setId(id);
+      assertEquals(id, region.getId());
+      assertEquals(size, region.getSize(), Configuration.EPSILON);
+      assertEquals(species, region.getSpecies());
+    } catch (Exception e) {
+      e.printStackTrace();
+      throw e;
+    }
+  }
+}
diff --git a/persist/src/db/12.1.0~alpha.0/fix_db_20180710.sql b/persist/src/db/12.1.0~alpha.0/fix_db_20180710.sql
index a82728a19d662c7e435277f85036891252aed455..c391524b79276d2df05443cda3f190fafd25ae18 100644
--- a/persist/src/db/12.1.0~alpha.0/fix_db_20180710.sql
+++ b/persist/src/db/12.1.0~alpha.0/fix_db_20180710.sql
@@ -17,3 +17,11 @@ update modification_residue_table set state_string='PROTONATED' where state=12;
 update modification_residue_table set state_string='DONT_CARE' where state=13;
 alter table modification_residue_table drop column state;
 alter table modification_residue_table rename column state_string to state;
+
+-- coordinates for rna region changed into absolute x,y
+
+alter table rna_region_table add column position varchar(255);
+update rna_region_table set position=concat(element_table.x+element_table.width/4 +(element_table.width*3/4*rna_region_table.pos),',',element_table.y) from  element_table where element_table.iddb = rna_region_table.idspeciesdb and not pos is null;
+update rna_region_table set position=concat(element_table.x,',',element_table.y) from  element_table where element_table.iddb = rna_region_table.idspeciesdb and pos is null;
+alter table rna_region_table drop column pos;
+