Skip to content

Commit e5c307b

Browse files
Adding diffloop, CHRONOS, EGSEA
git-svn-id: https://hedgehog.fhcrc.org/bioconductor/trunk/madman/Rpacks/diffloop@116512 bc3139a8-67e5-0310-9ffc-ced21a209358
0 parents  commit e5c307b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+9678
-0
lines changed

DESCRIPTION

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
Package: diffloop
2+
Type: Package
3+
Title: Differential DNA loop calling from ChIA-PET data
4+
Version: 0.99.1
5+
Date: 2016-04-12
6+
Authors@R: c( person("Caleb", "Lareau", email =
7+
"[email protected]", role = c("aut", "cre")),
8+
person("Martin", "Aryee", email =
9+
"[email protected]", role = "aut") )
10+
Maintainer: Caleb Lareau <[email protected]>
11+
Author: Caleb Lareau [aut, cre], Martin Aryee [aut]
12+
Description: A suite of tools for subsetting, visualizing, annotating,
13+
and statistically analyzing the results of one or more ChIA-PET
14+
experiments.
15+
Imports: methods, GenomicRanges, foreach, plyr, dplyr, reshape2,
16+
ggplot2, matrixStats, Sushi, edgeR, locfit, statmod, biomaRt,
17+
GenomeInfoDb, S4Vectors, IRanges, grDevices, graphics, stats,
18+
utils, Biobase, readr
19+
License: MIT + file LICENSE
20+
LazyData: TRUE
21+
Suggests: diffloopdata, knitr, rmarkdown, testthat
22+
VignetteBuilder: knitr
23+
RoxygenNote: 5.0.1
24+
Collate: 'diffloop.R' 'diffloop-class.R' 'data.R' 'core.R'
25+
'pipeline_io.R' 'loopFunctions.R' 'sugar.R' 'union.R'
26+
'annotation.R' 'assoc.R' 'colData.R' 'plotting.R'
27+
biocViews: Preprocessing, QualityControl, Visualization, DataImport,
28+
DataRepresentation, GO
29+
NeedsCompilation: no

LICENSE

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
YEAR: 2016
2+
COPYRIGHT HOLDER: Caleb Lareau & Martin Aryee

NAMESPACE

+69
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
# Generated by roxygen2: do not edit by hand
2+
3+
export(addchr)
4+
export(annotateAnchors)
5+
export(bedToGRanges)
6+
export(calcLDSizeFactors)
7+
export(featureTest)
8+
export(filterLoops)
9+
export(getHumanGenes)
10+
export(interchromosomal)
11+
export(intrachromosomal)
12+
export(loopFit)
13+
export(loopGenes)
14+
export(loopMetrics)
15+
export(loopPlot)
16+
export(loopTest)
17+
export(loopWidth)
18+
export(loopdataMake)
19+
export(loopdataSubset)
20+
export(mergeAnchors)
21+
export(numAnchors)
22+
export(numLoops)
23+
export(pcaPlot)
24+
export(quickAssoc)
25+
export(removeSelfLoops)
26+
export(rmchr)
27+
export(slidingWindowTest)
28+
export(subsetLoops)
29+
export(subsetRegion)
30+
export(topLoops)
31+
export(updateLDGroups)
32+
exportClasses(loopdata)
33+
exportClasses(loopfit)
34+
exportClasses(looptest)
35+
exportMethods(summarize)
36+
exportMethods(union)
37+
import(GenomicRanges)
38+
import(Sushi)
39+
import(biomaRt)
40+
import(edgeR)
41+
import(foreach)
42+
import(ggplot2)
43+
import(locfit)
44+
import(methods)
45+
import(plyr)
46+
import(readr)
47+
import(reshape2)
48+
import(statmod)
49+
importFrom(GenomeInfoDb,"seqlevels<-")
50+
importFrom(GenomeInfoDb,seqlevels)
51+
importFrom(GenomeInfoDb,sortSeqlevels)
52+
importFrom(IRanges,IRanges)
53+
importFrom(S4Vectors,queryHits)
54+
importFrom(S4Vectors,subjectHits)
55+
importFrom(dplyr,full_join)
56+
importFrom(dplyr,group_by)
57+
importFrom(grDevices,recordPlot)
58+
importFrom(graphics,mtext)
59+
importFrom(graphics,par)
60+
importFrom(stats,complete.cases)
61+
importFrom(stats,model.matrix)
62+
importFrom(stats,p.adjust)
63+
importFrom(stats,prcomp)
64+
importFrom(stats,setNames)
65+
importFrom(utils,read.table)
66+
importFrom(utils,stack)
67+
importMethodsFrom(Biobase,"sampleNames<-")
68+
importMethodsFrom(Biobase,sampleNames)
69+
importMethodsFrom(matrixStats,colMedians)

R/annotation.R

+118
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
#' @include union.R
2+
NULL
3+
4+
#' Add meta data column to anchors based on .bed file
5+
#'
6+
#' \code{annotateAnchors} adds a logical variable to meta data columns in the
7+
#' anchors based on a GRanges object of features' genomic coordinates
8+
#'
9+
#' This function adds column of TRUE/FALSE values on the loopdata object
10+
#' anchors whether a feature is observed nearby in \code{features}. The name
11+
#' of this column that will be in the anchors GRanges object is specified by
12+
#' a user defined string \code{featureName}. Gap tolerance between a feature
13+
#' and an anchor is specified by \code{maxgap}, where the default is 1,000bp.
14+
#'
15+
#' @param dlo A loopdata object whose anchors will be annotated
16+
#' @param features A Granges object corresponding to locations of interest
17+
#' @param featureName A string that will be the mcol name in anchors
18+
#' @param maxgap A value of max permissible gap between a feature and anchor
19+
#'
20+
#' @return A loopdata object with new meta data column in anchors
21+
#'
22+
#' @examples
23+
#' # Annotate whether anchors are near a gene body; within 1kb
24+
#' rda<-paste(system.file('rda',package='diffloop'),'jpn_chr1reg.rda',sep='/')
25+
#' load(rda)
26+
#' gb <-getHumanGenes()
27+
#' jpn_chr1reg <- annotateAnchors(jpn_chr1reg,gb,'nearGeneBody')
28+
#'
29+
#' # Adding close to gene bodies with no gap tolerance
30+
#' jpn_chr1reg <- annotateAnchors(jpn_chr1reg,gb,'inGeneBody',0)
31+
#'
32+
#' @import GenomicRanges
33+
#'
34+
#' @export
35+
setGeneric(name = "annotateAnchors", def = function(dlo, features,
36+
featureName, maxgap) standardGeneric("annotateAnchors"))
37+
38+
.annotateAnchors <- function(dlo, features, featureName, maxgap) {
39+
hits <- suppressWarnings(findOverlaps(features, dlo@anchors,
40+
maxgap = maxgap))
41+
idx <- unique(subjectHits(hits))
42+
values <- data.frame(matrix(FALSE, ncol = 1, nrow = length(ranges(dlo@anchors))))
43+
values[idx, ] <- TRUE
44+
colnames(values) <- featureName
45+
mcols(dlo@anchors) <- c(mcols(dlo@anchors), values)
46+
return(dlo)
47+
}
48+
49+
#' @rdname annotateAnchors
50+
setMethod(f = "annotateAnchors", signature = c("loopdata", "GRanges",
51+
"character", "missing"), definition = function(dlo, features,
52+
featureName, maxgap=1000) {
53+
maxgap <- 1000
54+
.annotateAnchors(dlo, features, featureName, maxgap)
55+
})
56+
57+
#' @rdname annotateAnchors
58+
setMethod(f = "annotateAnchors", signature = c("loopdata", "GRanges",
59+
"character", "numeric"), definition = function(dlo, features,
60+
featureName, maxgap) {
61+
.annotateAnchors(dlo, features, featureName, maxgap)
62+
})
63+
64+
65+
#' Get protein coding gene regions
66+
#'
67+
#' \code{getHumanGenes} returns a \code{GRanges} object of all protein
68+
#' coding genes genome-wide or within specified chromosomes
69+
#'
70+
#' This function returns a \code{GRanges} object with the coordinates and
71+
#' gene IDs of all protein coding genes either genome-wide
72+
#' (by default) orspecified within a particular chromosome.
73+
#'
74+
#' @param chr A vector of chromosomes
75+
#'
76+
#' @return A GRanges object
77+
#'
78+
#' @examples
79+
#' # Grab all protein coding gene locations genome-wide
80+
#' pc.genes <- getHumanGenes()
81+
#' # Grab all protein coding gene loctions on chromosome 1
82+
#' chr1 <- getHumanGenes(c('1'))
83+
#' @import GenomicRanges
84+
#' @import biomaRt
85+
#' @importFrom GenomeInfoDb sortSeqlevels seqlevels seqlevels<-
86+
#' @importFrom S4Vectors queryHits subjectHits
87+
#'
88+
#' @export
89+
setGeneric(name = "getHumanGenes", def = function(chr) standardGeneric("getHumanGenes"))
90+
91+
#' @import GenomicRanges
92+
.getHumanGenes <- function(chr) {
93+
vals = list(chr, "protein_coding")
94+
mart = useMart(biomart = "ensembl", dataset = "hsapiens_gene_ensembl")
95+
geneinfo = getBM(attributes = c("chromosome_name", "start_position",
96+
"end_position", "external_gene_name"), filters = c("chromosome_name",
97+
"biotype"), values = vals, mart = mart)
98+
colnames(geneinfo) <- c("chr", "start", "end", "id")
99+
raw <- makeGRangesFromDataFrame(geneinfo, keep.extra.columns = TRUE,
100+
ignore.strand = TRUE, seqnames.field = c("chr"), start.field = "start",
101+
end.field = c("end"), starts.in.df.are.0based = FALSE)
102+
gr <- sortSeqlevels(raw)
103+
gr <- sort(gr)
104+
return(gr)
105+
}
106+
107+
#' @rdname getHumanGenes
108+
setMethod(f = "getHumanGenes", signature = c("missing"), definition = function(chr) {
109+
all <- c("1", "2", "3", "4", "5", "6", "7", "8", "9", "10",
110+
"11", "12", "13", "14", "15", "16", "17", "18", "19",
111+
"20", "21", "22", "X", "Y")
112+
return(.getHumanGenes(all))
113+
})
114+
115+
#' @rdname getHumanGenes
116+
setMethod(f = "getHumanGenes", signature = c("character"), definition = function(chr) {
117+
return(.getHumanGenes(chr))
118+
})

0 commit comments

Comments
 (0)