課程作者是美國Cold Spring Harbor 研究所的Maria Nattestad。這個(gè)課程適合初學(xué)bioinformatics 和 computational biology的同學(xué)。R編程語言非常適合數(shù)據(jù)分析,統(tǒng)計(jì)和科學(xué)制圖。這個(gè)課程本打算是付費(fèi)課程,后來作者改成免費(fèi)資源,但是歡迎打賞,我這里是記筆記學(xué)習(xí),如果有人覺得打賞過來我會(huì)轉(zhuǎn)捐給原作者,屆時(shí)會(huì)把轉(zhuǎn)錢信息公開。
課程里提到的DATA/腳本下載。鏈接:http://pan.baidu.com/s/1bpaZ9Rx 密碼:c439
如果有Youtube看不到的請(qǐng)留言給我發(fā)你其他鏈接,清晰度沒有Youtube好。
課程內(nèi)容
Lesson 1: A quick start guide — From data to plot with a few magic words
Lesson 2: Importing and downloading data — From Excel, text files, or publicly available data, this lesson covers how to get all of it into R and addresses a number of common problems with data formatting issues.
Lesson 3: Interrogating your data — Getting quick summary statistics and navigating data frames.
Lesson 4: Filtering and cleaning up data — Kicking out the data that annoys you and polishing up the rest
Lesson 5: Tweaking everything in your plots — Everything from color schemes to fonts to grid lines and tick marks, this lesson will show you how to change just about anything in a plot. Especially useful for creating plots for publication.
Lesson 6: Plot anything! — Quick guide to each plot type including which types of data fit into each one.
Bar plots
Scatter plots
Box plots
Violin plots
Density plots
Dot-plots
Line-plots for time-course data
Venn diagrams
Lesson 7: Multifaceted figures — Splitting up your data by some column into multiple plots arranged in rows, columns, or even tables.
Lesson 8: Heatmaps -- How to create everything from simple heatmaps to adding different clustering and trees, partitions, and labels on the sides.
# ==========================================================
#
# Lesson 1 -- Hit the ground running 了解運(yùn)行平臺(tái)Rstudio
# ? Reading in data 讀取數(shù)據(jù)
# ? Creating a quick plot 快速用R做圖
# ? Saving publication-quality plots in multiple
# file formats (.png, .jpg, .pdf, and .tiff) 輸出不同格式的圖
#
# ==========================================================
# Go to the packages tab in the bottom right part of Rstudio, click "Install" at the top, type in ggplot2, and hit Install
# Go to the Files tab in the bottom right part of Rstudio, navigate to where you can see the Lesson-01 folder.
# then click "More" and choose "Set As Working Directory"
library(ggplot2)
filename <- "Lesson-01/Encode_HMM_data.txt"
# Select a file and read the data into a data-frame
my_data <- read.csv(filename, sep="\t", header=FALSE)
# if this gives an error, make sure you have followed the steps above to set your working directory to the folder that contains the file you are trying to open
head(my_data)
# Rename the columns so we can plot things more easily without looking up which column is which
names(my_data)[1:4] <- c("chrom","start","stop","type")
# At any time, you can see what your data looks like using the head() function:
head(my_data)
# Now we can make an initial plot and see how it looks
ggplot(my_data,aes(x=chrom,fill=type)) + geom_bar()
# Save the plot to a file
# Different file formats:
png("Lesson-01/plot.png")
ggplot(my_data,aes(x=chrom,fill=type)) + geom_bar()
dev.off()
tiff("Lesson-01/plot.tiff")
ggplot(my_data,aes(x=chrom,fill=type)) + geom_bar()
dev.off()
jpeg("Lesson-01/plot.jpg")
ggplot(my_data,aes(x=chrom,fill=type)) + geom_bar()
dev.off()
pdf("Lesson-01/plot.pdf")
ggplot(my_data,aes(x=chrom,fill=type)) + geom_bar()
dev.off()
# High-resolution:
png("Lesson-01/plot_hi_res.png",1000,1000)
ggplot(my_data,aes(x=chrom,fill=type)) + geom_bar()
dev.off()