Skip to content

Instantly share code, notes, and snippets.

@bibbers93
Created January 12, 2018 11:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bibbers93/00a7d8c56459785431b98b4b56f5ad22 to your computer and use it in GitHub Desktop.
Save bibbers93/00a7d8c56459785431b98b4b56f5ad22 to your computer and use it in GitHub Desktop.
DNA to RNA, T>U
#dna to RNA
t <- "sequence given"
t1 <- strsplit(t, split = "") [[1]]
u <- character(length=0)
for(i in 1:length(t1)){
if(t1[i]=="A"){
u[i] <- c("A")
}
if(t1[i]=="T"){
u[i] <- c("U")
}
if(t1[i]=="C"){
u[i] <- c("C")
}
if(t1[i]=="G"){
u[i] <- c("G")
}
}
uu <- unlist(u)
uuu <- paste(uu, collapse = "")
uuu
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment