}
}
+ public static int findPair(SequenceFeature[] pairs,int indice){
+ for(int i=0; i<pairs.length; i++){
+ if(pairs[i].getBegin()==indice){
+ return pairs[i].getEnd();
+ }
+ }
+ return -1;
+ }
+
/**
* Method to calculate a 'base pair consensus row', very similar
* to nucleotide consensus but takes into account a given structure
*/
public static final void calculate(SequenceI[] sequences, int start,
int end, Hashtable[] result, boolean profile, AlignmentAnnotation rnaStruc){
-
+ System.out.println("StructureFrequency.calculate");
Hashtable residueHash;
String maxResidue;
char[] seq, struc=rnaStruc.getRNAStruc().toCharArray();
int[] values = new int[255];
float percentage;
+ /*for(int x=(rna.length-1); x>=0; x--){
+ System.out.println("BP-"+((rna.length-1)-x)+" "+rna[x].getBegin()+","+rna[x].getEnd()+" "+rna[x].getFeatureGroup());
+ }*/
+
+
for (i = start; i < end; i++) //foreach column
{
residueHash = new Hashtable();
- maxResidue="";
+ maxResidue="-";
values = new int[255];
bpEnd=-1;
s = '-';
}
- if(s == '-'){
+ if(s != '('){
values['-']++;
}
else
values['-']++;
continue;
}
- if(s == '('){
- bpEnd=rna[(rna.length-1-nonGap)].getEnd();
+ //if(s == '('){
+ //bpEnd=rna[(rna.length-1-nonGap)].getEnd();
+ bpEnd=findPair(rna,i);
cEnd=seq[bpEnd];
+ //System.out.println(i+","+bpEnd);
if(checkBpType(c,cEnd)){
values['H']++; //H means it's a helix (structured)
}
- }
+ maxResidue="H";
+ //}
}
}
nonGap++;
}
- /*UPDATE this for new values
- if (profile)
- {
- residueHash.put(PROFILE, new int[][]
- { values, new int[]
- { jSize, nongap } });
- }
- */
+ //UPDATE this for new values
+ //if (profile)
+ //{
+ // residueHash.put(PROFILE, new int[][]
+ // { values, new int[]
+ // { jSize, nongap } });
+ // }
+
count=values['H'];
-
- if (count == 0)
- {
- maxResidue = "-";
- }else{
- maxResidue="H";
- }
-
+
residueHash.put(MAXCOUNT, new Integer(count));
residueHash.put(MAXRESIDUE, maxResidue);
if(bpEnd>0){
result[bpEnd]=residueHash;
}
-
}
}