Notes for Computational Biology with Nick Gotelli

# Set my working directory:
setwd("/Users/phillipburnham/ComputationalBiology/CompBio")

# Clear memory of characters:
ls()
## character(0)
rm(list=ls())

January 24, 2017

Learning about R markdown comands:

This text has italics.

This text is bold.

Headers:

Third Header

Second Header

First Header

These words are widely Spaced

Add spaces to end of words to make list (3)

Object 1
Object 2
Object 3

Lists

  • First
  • Second
    • Indented Item
    • Idented Item

Linked to a website

My Website

Block Quotes:

A friend once said:

It’s always better to give than to receive.

Fencing Shows PLain Text:

Now I can     add random     spaces
I’m Pooping

I’m Pooping

Tables:

First Header Second Header
Content Cell Content Cell
Content Cell Content Cell

Inline R Code There were 50 cars studied

# Comments:

Time <- seq(1,10) # seq makes integer sequence!
print(Time) # PRINT IT!
##  [1]  1  2  3  4  5  6  7  8  9 10
Resp <- runif(10) # get 10 random numbers
print(Resp) # print it
##  [1] 0.4753715 0.1700513 0.9008218 0.6605642 0.5768860 0.4198202 0.1306029
##  [8] 0.4291741 0.3531616 0.9603647
plot(x=Time, y=Resp, type="b") # plot them

LaTex Equations

\(a = b + c\)

Here it is centered:

\[a = b + c\]

January 26, 2017

More on Latex Equations:

Subscripts:

\[x_t + t_{first}\]

Superscripts:

\[x^t + t^{first}\]

Special Symbols:

\[\alpha = \frac{\beta}{\gamma+\delta_x}\]

Using the backslash:

\[\backslash \alpha \le b \backslash\]

Summation sign:

\[z = \sum_{i=1}^X{K}\]

Rendering plaintext in LaTeX:

\[P(\mbox{Occurance of species A}) = Z\]

R code chunk:

## [1] 1 2 3 4 5

Feb. 7, 2017

using grep and general expression to manipulate data:

  • Literal
  • metacharacters
  • “Escaping the metacharacter”

    - \.
    - \\
  • wildcards

    - "\w" a songle "word" character (all caps, all lower case, 0-9)
    - "\d" a single number character (0-9)
    - "\t" a single tab space
    - "\s" a single tab, space or line break
    - "\n" a single line break
    -  "." single letters, digit, space
    - () surround everything we want to hang on to
  • negated wildcards

    - "\W" anything thats not \w
    - "\D"not \d etc.
    - "\T" and "\S"
  • creating our own custom character sets -> what follows is going to define my character set [A-Za-z]
  • [ACTG] for genomic data
  • Negate character sets [^A-Z] - anything but a capital letter
  • [^\t]= anything accept a tab
  • quantifiers

    - \w+ = 1 or more consectuative word characters 
    - + can we used with nay of the wild cards we have seen
    - \w* = 0 or more consecutive word characters 
    - \w{3} = exactly 3 consecuative word characters 
    - \w{3,5} = 3 4 or 5 that form a word
    - \w{3,} = 3 or more matches 
    - .* = get everything

Feb. 9, 2017

more regex stuff: