Giter VIP home page Giter VIP logo

chippcomp's Introduction

ChipPComp

Example

These examples use the data sets that will be in ChipPCompData, change the root directory to wherever you have this package saved.

Load the libraries

## Base library
library(ChipPComp)
## To generate fasta subsets for motif analysis
library(BSgenome.Hsapiens.UCSC.hg19)

Set the root to wherever you have saved the ChipPCompData package. Alternativly you could provide your own peaks and aligned sequences. Note that the peaks must be in the XLS format output by MACS 1.3 or 2.0+ and the aligned sequences must be in a Bed3 format (i.e. ).

root <- "/Users/agriffith/masters/r-workspace/ChipPCompData/inst/extdata/"

Generate file names

peakList <- sapply(c("cd34", "cem_1","erythroid","jurkat"),
                   function(cellType){paste0(root,"tal1_hg_", cellType, "_no_mock_peaks.xls")})
rawData <- sapply(c("cd34", "cem","erythroid","jurkat"),
                  function(cellType){paste0(root,"tal1_hg_", cellType, "_aligned.bed")})
categories <- c("cd34","cem_1","erythroid","jurkat")

makeCCCA will generate the AFS, UDM and principal components for the input sequences and peaks. The final variable is a cut off for the peaks. (pvalue = 10^-value)

ccca<-makeCCCA(rawData,peakList,categories,10)

If you have a genome installed you can now add it to the CCCA object to resolve the base pairs under individual peaks.

genome<-BSgenome.Hsapiens.UCSC.hg19
ccca<-addFasta(ccca,genome)

Simply visualize the principal components (PCs). The second arguments is a tuple of the PCs that you want to visualize.

plotPCA(ccca,c(1,2))

Based on the visualized PCs select subsections that seperate categories. For example, PC1 seperates Leukemic from Erythroid cell types and PC2 isolates CD34.

## normalize the principal components
nm<-normalizePRC(ccca$prc)
## Name leukemia, where the normalized 1st pc is less than 1 sd of the mean
ccca<-addRegion(ccca,"Leukemia",nm[,1]<(mean(nm[,1])-1*sd(nm[,1])))
## Name Erythroid, where the normalized 1st pc is greater than 1 sd of the mean
ccca<-addRegion(ccca,"Erythroid",nm[,1]>(mean(nm[,1])+1*sd(nm[,1])))
## Name CD34, where the normalized 2nd pc is greater than 1 sd of the mean
ccca<-addRegion(ccca,"CD34",nm[,2]>(mean(nm[,2])+1*sd(nm[,2])))

You can now ouput the peaks important to a specific category of cells

## The bed files for CD34
ccca$afs[ccca$reg[,"CD34"],c("chr","start","end")]

You can also output the basepairs if you wish to do motif analysis

## Output the basepairs for CD34
ccca$fasta[ccca$reg[,"CD34"],]

chippcomp's People

Contributors

alexjgriffith avatar

Watchers

 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.