X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=srcjar%2Ffr%2Forsay%2Flri%2Fvarna%2Fmodels%2Ftreealign%2FRNANodeValue.java;fp=srcjar%2Ffr%2Forsay%2Flri%2Fvarna%2Fmodels%2Ftreealign%2FRNANodeValue.java;h=3b26b4717e544850b5de990de4798ba08841a679;hb=4898f0ae429e0c61ddba72ca46be89b34bb4df8b;hp=0000000000000000000000000000000000000000;hpb=5a6ac5b535856903629234ad43a71319a91ebee5;p=jalview.git diff --git a/srcjar/fr/orsay/lri/varna/models/treealign/RNANodeValue.java b/srcjar/fr/orsay/lri/varna/models/treealign/RNANodeValue.java new file mode 100644 index 0000000..3b26b47 --- /dev/null +++ b/srcjar/fr/orsay/lri/varna/models/treealign/RNANodeValue.java @@ -0,0 +1,102 @@ +package fr.orsay.lri.varna.models.treealign; + +/** + * We use the following convention: If the node is marked by a couple (n,m) + * these integers are stored in leftBasePosition and rightBasePosition + * (ie. we have a pair of bases), if only + * one value is present, it is stored in leftBasePosition and rightBasePosition + * contains -1 (ie. we have a non-paired base). + * The right and left nucleotides follow the same rule, but are optional, + * and '_' is used as undefined instead of -1. + * Note that it is part of the contract of this class that default + * values are -1 and _. + * + * @author Raphael Champeimont + */ +public class RNANodeValue implements GraphvizDrawableNodeValue { + private int leftBasePosition = -1; + private int rightBasePosition = -1; + + private String leftNucleotide = "_"; + private String rightNucleotide = "_"; + + public enum Origin { + BASE_PAIR_FROM_HELIX, + BASE_FROM_HELIX_STRAND5, + BASE_FROM_HELIX_STRAND3, + BASE_FROM_UNPAIRED_REGION; + } + + /** + * Used to store the origin of this base / base pair. + */ + private Origin origin = null; + + public Origin getOrigin() { + return origin; + } + public void setOrigin(Origin comesFromAnHelix) { + this.origin = comesFromAnHelix; + } + + + + public String getLeftNucleotide() { + return leftNucleotide; + } + public void setLeftNucleotide(String leftNucleotide) { + this.leftNucleotide = leftNucleotide; + } + public String getRightNucleotide() { + return rightNucleotide; + } + public void setRightNucleotide(String rightNucleotide) { + this.rightNucleotide = rightNucleotide; + } + public int getLeftBasePosition() { + return leftBasePosition; + } + public void setLeftBasePosition(int leftBasePosition) { + this.leftBasePosition = leftBasePosition; + } + public int getRightBasePosition() { + return rightBasePosition; + } + public void setRightBasePosition(int rightBasePosition) { + this.rightBasePosition = rightBasePosition; + } + + public String toGraphvizNodeName() { + if (rightNucleotide.equals("_")) { + if (leftNucleotide.equals("_")) { + if (rightBasePosition == -1) { + if (leftBasePosition == -1) { + return super.toString(); + } else { + return Integer.toString(leftBasePosition); + } + } else { + return "(" + leftBasePosition + "," + rightBasePosition + ")"; + } + } else { + return leftNucleotide; + } + } else { + return "(" + leftNucleotide + "," + rightNucleotide + ")"; + } + } + + public String toString() { + if (rightBasePosition == -1) { + if (leftBasePosition == -1) { + return super.toString(); + } else { + return Integer.toString(leftBasePosition); + } + } else { + return "(" + leftBasePosition + "," + rightBasePosition + ")"; + } + } + + +}