firstRNA1stBaseSecondRNA1stBaseFirstRNA2ndBaseSecondRNA2ndBase [...]
* AAC-GUAGA--UGG
* @param struct
* - The super-structure
* @param basesOwn
* - The RNA owning bases array (each index will be:0 when common
* base, 1 when first RNA alignment base, 2 when second RNA
* alignment base)
* @throws ExceptionUnmatchedClosingParentheses
* @throws ExceptionFileFormatOrSyntax
*/
public void setRNA(String seq, String struct, ArrayListnum
, -1
of no such base model exists.
*/
public int getIndexFromBaseNumber(int num) {
for (int i = 0; i < this._listeBases.size(); i++) {
if (_listeBases.get(i).getBaseNumber() == num) {
return i;
}
}
return -1;
}
/**
* Adds a base pair to this RNA's structure. Tries to add it to the
* secondary structure first, eventually adding it to the 'tertiary'
* interactions if it clashes with the current secondary structure.
*
* @param baseNumber5
* - Base number of the origin of this base pair
* @param baseNumber3
* - Base number of the destination of this base pair
*/
public void addBPToStructureUsingNumbers(int baseNumber5, int baseNumber3) {
int i = getIndexFromBaseNumber(baseNumber5);
int j = getIndexFromBaseNumber(baseNumber3);
addBP(i, j);
}
/**
* Adds a base pair to this RNA's structure. Tries to add it to the
* secondary structure first, possibly adding it to the 'tertiary'
* interactions if it clashes with the current secondary structure.
*
* @param number5
* - Base number of the origin of this base pair
* @param number3
* - Base number of the destination of this base pair
*/
public void addBPToStructureUsingNumbers(int number5, int number3,
ModeleBP msbp) {
addBP(getIndexFromBaseNumber(number5), getIndexFromBaseNumber(number3),
msbp);
}
public void addBP(int index5, int index3) {
int i = index5;
int j = index3;
ModeleBase part5 = _listeBases.get(i);
ModeleBase part3 = _listeBases.get(j);
ModeleBP msbp = new ModeleBP(part5, part3);
addBP(i, j, msbp);
}
public void addBP(int index5, int index3, ModeleBP msbp) {
int i = index5;
int j = index3;
if (j < i) {
int k = j;
j = i;
i = k;
}
if (i != -1) {
for (int k = i; k <= j; k++) {
ModeleBase tmp = _listeBases.get(k);
int l = tmp.getElementStructure();
if (l != -1) {
if ((l <= i) || (l >= j)) {
addBPAux(i, j, msbp);
return;
}
}
}
addBPnow(i, j, msbp);
}
}
public void removeBP(ModeleBP ms) {
if (_structureAux.contains(ms)) {
_structureAux.remove(ms);
} else {
ModeleBase m5 = ms.getPartner5();
ModeleBase m3 = ms.getPartner3();
int i = m5.getIndex();
int j = m3.getIndex();
if ((m5.getElementStructure() == m3.getIndex())
&& (m3.getElementStructure() == m5.getIndex())) {
m5.removeElementStructure();
m3.removeElementStructure();
}
}
}
/**
* Register base-pair, no question asked. More precisely, this function will
* not try to determine if the base-pairs crosses any other.
*
* @param i
* @param j
* @param msbp
*/
private void addBPNow(int i, int j) {
if (j < i) {
int k = j;
j = i;
i = k;
}
ModeleBase part5 = _listeBases.get(i);
ModeleBase part3 = _listeBases.get(j);
ModeleBP msbp = new ModeleBP(part5, part3);
addBPnow(i, j, msbp);
}
/**
* Register base-pair, no question asked. More precisely, this function will
* not try to determine if the base-pairs crosses any other.
*
* @param i
* @param j
* @param msbp
*/
private void addBPnow(int i, int j, ModeleBP msbp) {
if (j < i) {
int k = j;
j = i;
i = k;
}
ModeleBase part5 = _listeBases.get(i);
ModeleBase part3 = _listeBases.get(j);
msbp.setPartner5(part5);
msbp.setPartner3(part3);
part5.setElementStructure(j, msbp);
part3.setElementStructure(i, msbp);
}
public void addBPAux(int i, int j) {
ModeleBase part5 = _listeBases.get(i);
ModeleBase part3 = _listeBases.get(j);
ModeleBP msbp = new ModeleBP(part5, part3);
addBPAux(i, j, msbp);
}
public void addBPAux(int i, int j, ModeleBP msbp) {
if (j < i) {
int k = j;
j = i;
i = k;
}
ModeleBase part5 = _listeBases.get(i);
ModeleBase part3 = _listeBases.get(j);
msbp.setPartner5(part5);
msbp.setPartner3(part3);
_structureAux.add(msbp);
}
public ArrayListindex
. Indices are contiguous in
* the sequence over an interval [0,this.getSize()-1]
, where
* n
is the length of the sequence.
*
* @param index
* The index, 0 ≤ index < this.getSize()
, of the
* base model
* @return The base model of index index
*/
public ModeleBase getBaseAt(int index) {
return this._listeBases.get(index);
}
/**
* Returns the set of bases of indices in indices
. Indices are
* contiguous in the sequence, and belong to an interval
* [0,n-1]
, where n
is the length of the sequence.
*
* @param indices
* A Collection of indices i
,
* 0 ≤ index < this.getSize()
, where some base
* models are found.
* @return A list of base model of indices in indices
*/
public ArrayListName: | " + this._name + " |
Length: | " + this.getSize() + " nts |
Base-pairs: | " + this.getAllBPs().size() + " |