diff --git a/Schrick-Noah_CS-6643_Lab1.R b/Schrick-Noah_CS-6643_Lab1.R index d18c0c6..e7c50b3 100644 --- a/Schrick-Noah_CS-6643_Lab1.R +++ b/Schrick-Noah_CS-6643_Lab1.R @@ -1,20 +1,47 @@ # Lab 1 for the University of Tulsa's CS-6643 Bioinformatics Course -# Introduction to R, Online bioinformatics resources, nucleotide frequency statistics +# Intro to R, online bioinformatics resources, nucleotide frequency statistics # Professor: Dr. McKinney, Fall 2022 # Noah L. Schrick - 1492657 #### Part A: Seq Function ## a +AAvec <- seq(from = 1, to = 33, by = 2) ## b - +ABvec <- seq(from = 7, to = 40, length.out = 15) + ## c +my.dna <- sample(c("A", "C", "G", "T"), size = 20, replace = T) ## d +my.dna.A <- length(which(my.dna == "A")) ## e +my.dna.table <- table(my.dna) + +my.dna.table.df <- as.data.frame(my.dna.table) +cols <- rainbow(nrow(my.dna.table)) +my.dna.table.df$percent <- + round(100*my.dna.table.df$Freq/sum(my.dna.table.df$Freq), digits = 1) +my.dna.table.df$label <- paste(my.dna.table.df$my.dna, + " (", my.dna.table.df$percent, "%)", sep = "") +pie(my.dna.table.df$Freq, labels = my.dna.table.df$label, col = cols, + main = "Pie Chart Representation of Random ACTG Sample") + + +bp <- barplot(as.matrix(my.dna.table), beside = TRUE, xlab = "Letter", + ylab = "Frequency", ylim = c(-1, max(as.numeric(my.dna.table))+2), + main = "Bar Plot Representation of Random ACTG Sample", col = cols, + legend = TRUE) + +text(x = bp, y = my.dna.table + 0.5, labels = as.numeric(my.dna.table)) +text(x = bp, y = -0.5, labels = names(my.dna.table)) ## f +my.dna2 <- sample(c("A", "C", "G", "T"), size = 20, replace = T, + prob = c(0.1, 0.4, 0.4, 0.1)) +my.dna2.table <- table(my.dna2) +my.dna2.table #### Part B: NCBI (no supporting R code for this part)