#include "rnautil.h"#include "common.h"Include dependency graph for rnautil.c:

Go to the source code of this file.
Functions | |
| void | dna2rna (char *s) |
| bool | rnaPair (char a, char b) |
| void | reverseFold (char *s) |
| void | fold2pairingList (char *fold, int len, int **p2pairList) |
| void | mkPairPartnerSymbols (int *pairList, char *pairSymbols, int size) |
| char * | projectString (char *s, char *ref, char refChar, char insertChar) |
| char * | gapAdjustFold (char *s, char *ref) |
| int * | projectIntArray (int *in, char *ref, char refChar, int insertInt) |
| int * | gapIntArrayAdjust (int *in, char *ref) |
| void | markCompensatoryMutations (char *s, char *ref, int *pairList, int *markList) |
| int | assignBin (double val, double minVal, double maxVal, int binCount) |
Variables | |
| const char * | RNA_PAIRS [] = {"AU","UA","GC","CG","GU","UG",0} |
| int assignBin | ( | double | val, | |
| double | minVal, | |||
| double | maxVal, | |||
| int | binCount | |||
| ) |
| void dna2rna | ( | char * | s | ) |
| void fold2pairingList | ( | char * | fold, | |
| int | len, | |||
| int ** | p2pairList | |||
| ) |
Definition at line 47 of file rnautil.c.
References needMem().
00049 : pairList[i] = j <=> i pair with j and pairList[i] = -1 00050 <=> i does not pair.*/ 00051 { 00052 int i,j, stackSize = 0; 00053 int *pairList = needMem(len * sizeof(int)); 00054 *p2pairList = pairList; 00055 00056 /* initialize array */ 00057 for (i = 0; i < len; i++) 00058 pairList[i] = -1; 00059 00060 /* fill out pairList */ 00061 for (i = 0; i < len; i++) 00062 { 00063 if (fold[i] == '(') 00064 { 00065 stackSize = 1; 00066 for (j = i+1; j < len; j++) 00067 { 00068 if (fold[j] == '(') 00069 stackSize += 1; 00070 else if (fold[j] == ')') 00071 stackSize -= 1; 00072 if (stackSize == 0) /* found pair partner */ 00073 { 00074 pairList[i] = j; 00075 pairList[j] = i; 00076 break; 00077 } 00078 } 00079 } 00080 } 00081 }
Here is the call graph for this function:

| char* gapAdjustFold | ( | char * | s, | |
| char * | ref | |||
| ) |
Definition at line 134 of file rnautil.c.
References projectString().
00136 { 00137 return projectString(s, ref, '-', ' '); 00138 }
Here is the call graph for this function:

| int* gapIntArrayAdjust | ( | int * | in, | |
| char * | ref | |||
| ) |
Definition at line 160 of file rnautil.c.
References projectIntArray().
00162 { 00163 return projectIntArray(in, ref, '-', 0); 00164 }
Here is the call graph for this function:

| void markCompensatoryMutations | ( | char * | s, | |
| char * | ref, | |||
| int * | pairList, | |||
| int * | markList | |||
| ) |
Definition at line 166 of file rnautil.c.
References rnaPair().
00170 : 00171 * 0: not pairing, no substitution (default) 00172 * 1: not pairing, single substitution 00173 * 2: pairing, no substitutions 00174 * 3: pairing, single substitution (one of: CG<->TG, GC<->GT, TA<->TG, AT<->GT) 00175 * 4: pairing, double substitution (i.e. a compensatory change) 00176 * 5: annoated as pairing but dinucleotide cannot pair 00177 */ 00178 { 00179 int i, size = strlen(s); 00180 for (i = 0; i < size; i++) 00181 { 00182 if (pairList[i] == -1) 00183 if (toupper(s[i]) != toupper(ref[i]) && s[i] != '.' && s[i] != '-' && ref[i] != '-') 00184 markList[i] = 1; 00185 else 00186 markList[i] = 0; 00187 else 00188 { 00189 if (s[i] == '.' || s[pairList[i]] == '.') /* treat missing data as possible pair partner */ 00190 markList[i] = 2; 00191 else if (!rnaPair(s[i], s[pairList[i]])) 00192 markList[i] = 5; 00193 else if (toupper( s[i] ) != toupper( ref[i] ) && toupper( s[pairList[i]] ) != toupper( ref[pairList[i]] ) ) 00194 markList[i] = 4; 00195 else if (toupper( s[i] ) != toupper( ref[i] ) || toupper( s[pairList[i]] ) != toupper( ref[pairList[i]] ) ) 00196 markList[i] = 3; 00197 else 00198 markList[i] = 2; 00199 } 00200 } 00201 }
Here is the call graph for this function:

| void mkPairPartnerSymbols | ( | int * | pairList, | |
| char * | pairSymbols, | |||
| int | size | |||
| ) |
Definition at line 83 of file rnautil.c.
00084 { 00085 /* Make a symbol string indicating pairing partner */ 00086 int i; 00087 char symbols[] = "abcdefghiklmnopqrstuvwxyzABCDEFGHIKLMNOPQRSTUVWXYZ1234567890!@#$%^&*=+{}|[]\\;'<>"; /* length 80 */ 00088 int symbolMax = strlen(symbols); 00089 int index; 00090 for (i = 0, index = 0; i < size; i++) 00091 { 00092 pairSymbols[i] = ' '; 00093 if (pairList[i] >= 0) 00094 { 00095 if (pairList[i] < i) 00096 { 00097 --index; 00098 if (index<0) 00099 index = symbolMax-1; 00100 } 00101 pairSymbols[i] = symbols[index]; 00102 if (pairList[i] > i) 00103 { 00104 ++index; 00105 if (index>=symbolMax) 00106 index=0; 00107 } 00108 } 00109 } 00110 }
| int* projectIntArray | ( | int * | in, | |
| char * | ref, | |||
| char | refChar, | |||
| int | insertInt | |||
| ) |
Definition at line 141 of file rnautil.c.
References needMem().
Referenced by gapIntArrayAdjust().
00143 { 00144 int i,j,size = strlen(ref); 00145 int *copy = (int *) needMem(size *sizeof(int) ); 00146 00147 for (i = 0, j = 0; i < size; i++) 00148 { 00149 if (ref[i] == refChar) 00150 copy[i] = insertInt; 00151 else 00152 { 00153 copy[i] = in[j]; 00154 j++; 00155 } 00156 } 00157 return copy; 00158 }
Here is the call graph for this function:

Here is the caller graph for this function:

| char* projectString | ( | char * | s, | |
| char * | ref, | |||
| char | refChar, | |||
| char | insertChar | |||
| ) |
Definition at line 112 of file rnautil.c.
References countChars(), errAbort(), and needMem().
Referenced by gapAdjustFold().
00114 { 00115 int i,j,size = strlen(ref); 00116 char *copy = (char *) needMem(size + 1); 00117 00118 if (strlen(s) != strlen(ref) - countChars(ref, refChar)) 00119 errAbort("ERROR from rnautil::projectString: Input string 's' has wrong length.\n"); 00120 00121 for (i = 0, j = 0; i < size; i++) 00122 { 00123 if (ref[i] == refChar) 00124 copy[i] = insertChar; 00125 else 00126 { 00127 copy[i] = s[j]; 00128 j++; 00129 } 00130 } 00131 return copy; 00132 }
Here is the call graph for this function:

Here is the caller graph for this function:

| void reverseFold | ( | char * | s | ) |
Definition at line 34 of file rnautil.c.
References reverseBytes().
00036 { 00037 reverseBytes(s, strlen(s)); 00038 for (;*s;s++) 00039 { 00040 if (*s == '(') 00041 *s = ')'; 00042 else if (*s == ')') 00043 *s = '('; 00044 } 00045 }
Here is the call graph for this function:

| bool rnaPair | ( | char | a, | |
| char | b | |||
| ) |
Definition at line 20 of file rnautil.c.
References dna2rna(), FALSE, RNA_PAIRS, touppers(), and TRUE.
Referenced by markCompensatoryMutations().
00022 { 00023 char pair[] = {a,b,'\0'}; 00024 int i; 00025 dna2rna(pair); 00026 touppers(pair); 00027 00028 for (i=0;RNA_PAIRS[i] != 0; i++) 00029 if (pair[0] == RNA_PAIRS[i][0] && pair[1] == RNA_PAIRS[i][1] ) 00030 return TRUE; 00031 return FALSE; 00032 }
Here is the call graph for this function:

Here is the caller graph for this function:

| const char* RNA_PAIRS[] = {"AU","UA","GC","CG","GU","UG",0} |
1.5.2