Part 1: a-f
This commit is contained in:
parent
c9285e74e4
commit
f19f591030
@ -1,20 +1,47 @@
|
|||||||
# Lab 1 for the University of Tulsa's CS-6643 Bioinformatics Course
|
# 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
|
# Professor: Dr. McKinney, Fall 2022
|
||||||
# Noah L. Schrick - 1492657
|
# Noah L. Schrick - 1492657
|
||||||
|
|
||||||
#### Part A: Seq Function
|
#### Part A: Seq Function
|
||||||
## a
|
## a
|
||||||
|
AAvec <- seq(from = 1, to = 33, by = 2)
|
||||||
|
|
||||||
## b
|
## b
|
||||||
|
ABvec <- seq(from = 7, to = 40, length.out = 15)
|
||||||
|
|
||||||
## c
|
## c
|
||||||
|
my.dna <- sample(c("A", "C", "G", "T"), size = 20, replace = T)
|
||||||
|
|
||||||
## d
|
## d
|
||||||
|
my.dna.A <- length(which(my.dna == "A"))
|
||||||
|
|
||||||
## e
|
## 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
|
## 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)
|
#### Part B: NCBI (no supporting R code for this part)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user