- Project 1 is due on the 24th
- The first hour of tomorrow's class will be a lecture
- No class on Tuesday (stud section)
- Read The Art of R Programming (Chapters 2 and 3)
Patrick D. Schloss, PhD (microbialinformatics.github.io)
Department of Microbiology & Immunology
Imagine you have a bacterial genome and you want to find all of the open reading frames (ORFs). What might the pseudocode look like?
for position in the genome
codon = that base plus the next two bases
if codon == "ATG" then save that position as a start codon
if codon == "TAG", "TAA", or "TGA" then save that position as a stop codon
return list of start and stop codon positions
myFunction <- function(arguements){
# insert special sauce
}
myFunction()
return
function to be safemyFunction <- function(arguements){
# insert special sauce
return(output)
}
myFunction()
x <- 1:10
sum.squared <- function(x){
squared <- x^2
sum.sq <- sum(squared)
return(sum.sq)
}
sum.squared(x)
## [1] 385
sum.squared <- function(x){
sum.sq <- sum(x^2)
return(sum.sq)
}
sum.squared(x)
## [1] 385
sum.squared <- function(x){
return(sum(x^2))
}
sum.squared(x)
## [1] 385
sum.squared <- function(x){
sum(x^2)
}
sum.squared(x)
## [1] 385
sum.squared <- function(x) sum(x^2)
sum.squared(x)
## [1] 385
sum(x^2)
## [1] 385
sum.squared <- function(x, mu=0){
sum((x-mu)^2)
}
sum.squared(x)
## [1] 385
sum.squared(x, 3)
## [1] 145
sum.squared <- function(x){
sum.sq <- sum(x^2)
}
sum.squared(c(1,2,3))
sum.sq
## Error: object 'sum.sq' not found