Created
April 8, 2020 04:23
-
-
Save FranjoIM/e46bc53ffd33b9991e62cf7136f6e26a to your computer and use it in GitHub Desktop.
DNA Reverse Complement: This function takes a string-type variable containing DNA and it returns its reverse complement
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Load a library necessary to run this code | |
library(stringi) | |
# Define the reverse complement function | |
rev.comp <- function(DNASeq) | |
return(stri_reverse(chartr("acgtACGT", "tgcaTGCA", DNASeq))) | |
# Run the code on the dataframe called DF | |
DF$Seq <- ifelse (DF$Strand == c("-"), rev.comp(DF$Seq), DF$Seq) | |
library(plyr) | |
CombinedDF <- join(MainDF, LookUpDF, by = "Column") | |
heead(CombinedDF) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment