1 package fr.orsay.lri.varna.models.treealign;
4 * We use the following convention: If the node is marked by a couple (n,m)
5 * these integers are stored in leftBasePosition and rightBasePosition
6 * (ie. we have a pair of bases), if only
7 * one value is present, it is stored in leftBasePosition and rightBasePosition
8 * contains -1 (ie. we have a non-paired base).
9 * The right and left nucleotides follow the same rule, but are optional,
10 * and '_' is used as undefined instead of -1.
11 * Note that it is part of the contract of this class that default
12 * values are -1 and _.
14 * @author Raphael Champeimont
16 public class RNANodeValue implements GraphvizDrawableNodeValue {
17 private int leftBasePosition = -1;
18 private int rightBasePosition = -1;
20 private String leftNucleotide = "_";
21 private String rightNucleotide = "_";
25 BASE_FROM_HELIX_STRAND5,
26 BASE_FROM_HELIX_STRAND3,
27 BASE_FROM_UNPAIRED_REGION;
31 * Used to store the origin of this base / base pair.
33 private Origin origin = null;
35 public Origin getOrigin() {
38 public void setOrigin(Origin comesFromAnHelix) {
39 this.origin = comesFromAnHelix;
44 public String getLeftNucleotide() {
45 return leftNucleotide;
47 public void setLeftNucleotide(String leftNucleotide) {
48 this.leftNucleotide = leftNucleotide;
50 public String getRightNucleotide() {
51 return rightNucleotide;
53 public void setRightNucleotide(String rightNucleotide) {
54 this.rightNucleotide = rightNucleotide;
56 public int getLeftBasePosition() {
57 return leftBasePosition;
59 public void setLeftBasePosition(int leftBasePosition) {
60 this.leftBasePosition = leftBasePosition;
62 public int getRightBasePosition() {
63 return rightBasePosition;
65 public void setRightBasePosition(int rightBasePosition) {
66 this.rightBasePosition = rightBasePosition;
69 public String toGraphvizNodeName() {
70 if (rightNucleotide.equals("_")) {
71 if (leftNucleotide.equals("_")) {
72 if (rightBasePosition == -1) {
73 if (leftBasePosition == -1) {
74 return super.toString();
76 return Integer.toString(leftBasePosition);
79 return "(" + leftBasePosition + "," + rightBasePosition + ")";
82 return leftNucleotide;
85 return "(" + leftNucleotide + "," + rightNucleotide + ")";
89 public String toString() {
90 if (rightBasePosition == -1) {
91 if (leftBasePosition == -1) {
92 return super.toString();
94 return Integer.toString(leftBasePosition);
97 return "(" + leftBasePosition + "," + rightBasePosition + ")";