selex.revcomp {SELEX} | R Documentation |
A function used to find and return the reverse complement of K-mers and the values associated with them. It is useful for calculating forward/reverse complement symmetrized values.
selex.revcomp(kmer,value)
kmer |
A string array representing K-mers. |
value |
An array of associated values. |
selex.revcomp
finds and returns the reverse complement and associated value of every input K-mer, if it exists. If a reverse complement does not exist for a given K-mer, it is removed from the output. For example, consider the following K-mer and value arrays:
ACGT | .34 | |
GCTA | .22 | |
CGAC | .98 | |
TAGC | .19 |
The output of selex.revcomp
will be:
ACGT | .34 | ACGT | .34 | |||
GCTA | .22 | TAGC | .19 | |||
TAGC | .19 | GCTA | .22 |
selex.revcomp
returns a data frame containing the original K-mers and values, along with their reverse complements and associated values.
selex.affinities
, selex.counts
# Find round 2 affinities r2Aff = selex.affinities(sample=r2, k=10, markovModel=mm) # Find the reverse complement affinities and standard errors Aff = selex.revcomp(kmer=r2Aff$Kmer, value=r2Aff$Affinity) SE = selex.revcomp(kmer=r2Aff$Kmer, value=r2Aff$SE) # Find the forward/reverse complement symmetrized Affinity and SE values symAff = (Aff$Value+Aff$Reverse.Complement.Values)/2 symSE = sqrt((SE$Value^2+SE$Reverse.Complement.Values^2)/2) # Final Result final = data.frame(Kmer=Aff$Kmer, Affinity=Aff$Value, SymmetrizedAffinity=symAff/max(symAff), SE=SE$Value, SymmetrizedSE=symSE/max(symAff)) final = final[order(-final$SymmetrizedAffinity),]