fr.orsay.lri.varna.models.templates
Class RNATemplateMapping

java.lang.Object
  extended by fr.orsay.lri.varna.models.templates.RNATemplateMapping

public class RNATemplateMapping
extends Object

A RNATemplateMapping is a mapping between bases in an RNA sequence and elements in a RNA template. A base is mapped to only one template element but a template element can be mapped to several bases. This class is designed to be similar to the Mapping class.

Author:
Raphael Champeimont

Field Summary
private  double distance
          Alignment distance.
private  Map<RNATemplate.RNATemplateElement,ArrayList<Integer>> invmap
           
private  Map<Integer,RNATemplate.RNATemplateElement> map
           
 
Constructor Summary
RNATemplateMapping()
           
 
Method Summary
 void addCouple(int baseIndex, RNATemplate.RNATemplateElement templateElement)
          Tell this mapping object that this base index and this element are mapped with each other.
 ArrayList<Integer> getAncestor(RNATemplate.RNATemplateElement templateElement)
          If the given template element is in the mapping, return an ArrayList containing the corresponding base indexes, otherwise return null.
 double getDistance()
           
 RNATemplate.RNATemplateElement getPartner(int baseIndex)
          If the given base index is in the mapping, return the corresponding template element, otherwise return null.
 Set<Integer> getSourceElemsAsSet()
          Return a set containing all the base indexes in the mapping.
 Set<RNATemplate.RNATemplateElement> getTargetElemsAsSet()
          Return a set containing all the template elements in the mapping.
 void setDistance(double distance)
           
 String showCompact(RNA r)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

map

private Map<Integer,RNATemplate.RNATemplateElement> map

invmap

private Map<RNATemplate.RNATemplateElement,ArrayList<Integer>> invmap

distance

private double distance
Alignment distance.

Constructor Detail

RNATemplateMapping

public RNATemplateMapping()
Method Detail

getDistance

public double getDistance()

setDistance

public void setDistance(double distance)

addCouple

public void addCouple(int baseIndex,
                      RNATemplate.RNATemplateElement templateElement)
               throws RNATemplateMappingException
Tell this mapping object that this base index and this element are mapped with each other. This will throw RNATemplateMappingException and do nothing if the base index is already in the mapping.

Throws:
RNATemplateMappingException

showCompact

public String showCompact(RNA r)

getPartner

public RNATemplate.RNATemplateElement getPartner(int baseIndex)
If the given base index is in the mapping, return the corresponding template element, otherwise return null.


getAncestor

public ArrayList<Integer> getAncestor(RNATemplate.RNATemplateElement templateElement)
If the given template element is in the mapping, return an ArrayList containing the corresponding base indexes, otherwise return null. Note that you should not modify the returned ArrayList because no copy is made, so if you modify it this mapping object will contain inconsistent data.


getSourceElemsAsSet

public Set<Integer> getSourceElemsAsSet()
Return a set containing all the base indexes in the mapping. You should not modify the returned set.


getTargetElemsAsSet

public Set<RNATemplate.RNATemplateElement> getTargetElemsAsSet()
Return a set containing all the template elements in the mapping. You should not modify the return set.