Giter Site home page Giter Site logo

ggplot2_functions's Introduction

Functions for plots useful in HTS data analysis, using ggplot2 R package

What is done and what is pending

  • PCA from a matrix or a DESeq2 object
  • Density plot from a data frame or a matrix
  • Hierarchical clustering from a matrix or a DESeq2 object
  • Dotplot for counts / gene from a matrix or a DESeq2 object
  • Heatmap from a matrix or a DESeq2 object

Principal component analysis

source function "pca_ggplot"

source("functions/pca.R")

arguments

data: compulsory; object of class matrix OR DESeqTransform OR DESeqDataSet: each column is a sample.
title: optional; will be used to construct the main title of the plot and the name of the file; defaults to time stamp.
first_pc, second_pc; optional: which components do you want to plot. first will go to the x axis, second will go to the y axis; defaults to 1 and 2, respectively.
groups: optional; vector that contains the name of the experimental groups (same order as in the columns of data).
samples: optional; vector that contains the name of the samples for labeling the points; defaults to the column names of data.

create an example matrix and test the function

dat <- matrix(rnorm(1200), ncol=6)
colnames(dat) <- paste0("sample", 1:6)

pca_ggplot(dat, first_pc=1, second_pc=3, 
	samples=1:6, groups=c(rep("one", 3), rep("two", 3)), 
	title="my first PCA")

Density plot

source function "density_ggplot"

source("functions/density.R")

arguments

data: compulsory; object of class data.frame or matrix: each column is a sample
title: optional; will be used to construct the main title of the plot and the name of the file; defaults to time stamp.

create an example data frame and test the function

df <- data.frame(sample1=rnorm(1000), 
	sample2=rnorm(1000),
	sample3=rnorm(1000))

density_ggplot(df, 
	title="test")

Hierarchical clustering / dendrogram

source function "dendro_ggplot"

source("functions/dendrogram.R")

arguments

data: compulsory; object of class matrix OR DESeqTransform OR DESeqDataSet: each column is a sample.
title: optional; will be used to construct the main title of the plot and the name of the file; defaults to time stamp.
groups: optional; vector that contains the name of the experimental groups (same order as in the columns of data).
samples: optional; vector that contains the name of the samples for labeling the points; defaults to the column names of data.

create an example matrix and test the function

dat <- matrix(rnorm(120000), ncol=60)
colnames(dat) <- paste0("sample", 1:60)

dendro_ggplot(dat, 
	title="my first Dendrogram",
	groups=c(rep("one", 15), rep("two", 20), rep("three", 25)))

Dot plots

source("functions/dotplot_genes_counts.R")

arguments

data: compulsory; object of class matrix OR DESeqTransform OR DESeqDataSet: each column is a sample. Row names should be gene names!
genes: compulsory; vector of gene names (should be found in row names of data).
title: optional; defaults to time stamp.
groups: optional; vector that contains the name of the experimental groups (same order as in the columns of data).
samples: optional; vector that contains the name of the samples for labeling the points; defaults to the column names of data.

create an example matrix and test the function

dat <- matrix(rnorm(120000), ncol=20, 
	dimnames=list(paste0("gene", 1:6000), paste0("sample", 1:20)))

dotplot_genes_ggplot(dat, 
	genes=c("gene2030", "gene140", "gene850"),
	title="my first dot plot",
	groups=c(rep("one", 6), rep("two", 7), rep("three", 7)))

ggplot2_functions's People

Watchers

 avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.