Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev jg 0701 Show Diffs #1500

Open
wants to merge 38 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
2b3c722
Updates
jeffmgranja May 31, 2022
55f0923
update release_1.0.3
jeffmgranja Jun 3, 2022
44a0d27
Update with testing and bug fixes
jgranja-cartographybio Jul 2, 2022
259a517
update issues
jgranja-cartographybio Jul 2, 2022
c67f3a1
update with ryans edits
jgranja-cartographybio Jul 2, 2022
4207688
Merge branch 'master' into dev_jg_0701
jeffmgranja Jul 2, 2022
e623ea8
Added new ArchR Arrow version
jgranja-cartographybio Jul 14, 2022
7052c68
Update RNAIntegration.R
jgranja-cartographybio Jul 14, 2022
14935c9
bug fix
jgranja-cartographybio Jul 14, 2022
98dfafa
fix import10xFeatureMatrix to account for missing intervals
jgranja-cartographybio Jul 14, 2022
37267fc
handling issues with weird genes
jgranja-cartographybio Jul 14, 2022
983419f
Update MatrixGeneScores.R
jgranja-cartographybio Jul 14, 2022
bd77c78
change folder hierarchy for peakSet
jgranja-cartographybio Jul 14, 2022
f49141f
Update Module Score for GRanges for Tile/Peak Matrix
jgranja-cartographybio Jul 14, 2022
4c5b7c2
getFeatures support range matrix without names
jgranja-cartographybio Jul 14, 2022
2aeea8d
validate positions for footprinting
jgranja-cartographybio Jul 14, 2022
d3ba771
ensure no asks greater than chromosome!
jgranja-cartographybio Jul 14, 2022
944f5ab
bugfix 1 annotation
jgranja-cartographybio Jul 14, 2022
c5b111d
bugfix 10x csv
jgranja-cartographybio Jul 15, 2022
6d26bcd
Check that dimsToUse exist in ArchRProj
rcorces Jul 15, 2022
be4d9fc
update dimsToUse param
rcorces Jul 15, 2022
da89910
Update handling of empty chromosomes
jgranja-cartographybio Jul 17, 2022
c196662
check seqnames for input seRNA and chromSizes
jgranja-cartographybio Jul 17, 2022
2a7eb44
better messaging for matching in markerFeatures
jgranja-cartographybio Jul 17, 2022
8457acc
GroupExport Fragments from ArchRProject
jgranja-cartographybio Jul 17, 2022
9848fa2
custom motif enrichment and more stability checks for backgroundPeaks
jgranja-cartographybio Jul 17, 2022
e3c6d4c
Add regner 2021 approach for permuted pvals for peak2gene links
jgranja-cartographybio Jul 17, 2022
c059abf
highlight browser track added
jgranja-cartographybio Jul 18, 2022
10ec887
document
jgranja-cartographybio Jul 18, 2022
ac4857e
version bump
jgranja-cartographybio Jul 18, 2022
075ab6b
update species param in addMotifAnnotations
rcorces Jul 18, 2022
9183c43
bugfix handling with testthat
jgranja-cartographybio Jul 18, 2022
606e699
Add ChromVAR Test
jgranja-cartographybio Jul 19, 2022
56025dd
tests update
jgranja-cartographybio Jul 19, 2022
23ef3cf
update differential and pseudobulk
jgranja-cartographybio Jul 21, 2022
2cdc299
getGroupFragments
jgranja-cartographybio Jul 22, 2022
ab3bebd
fix name
jgranja-cartographybio Jul 22, 2022
8272fc3
Merge remote-tracking branch 'origin/dev' into dev_jg_0701
jeffmgranja Jul 22, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified .DS_Store
Binary file not shown.
6 changes: 4 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Package: ArchR
Type: Package
Date: 2022-04-03
Date: 2022-07-17
Title: Analyzing single-cell regulatory chromatin in R.
Version: 1.0.2
Version: 1.0.3
Authors@R: c(
person("Jeffrey", "Granja", email = "[email protected]", role = c("aut","cre")),
person("Ryan", "Corces", role = "aut"))
Expand All @@ -14,6 +14,7 @@ LazyData: TRUE
RoxygenNote: 7.1.2
Encoding: UTF-8
Imports:
devtools,
ggplot2,
SummarizedExperiment,
data.table,
Expand Down Expand Up @@ -83,6 +84,7 @@ Collate:
'RNAIntegration.R'
'RcppExports.R'
'ReproduciblePeakSet.R'
'SparseUtils.R'
'Trajectory.R'
'ValidationUtils.R'
'VisualizeData.R'
10 changes: 10 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,15 @@ export("%ni%")
export(.DollarNames.ArchRProject)
export(ArchRBrowser)
export(ArchRBrowserTrack)
export(ArchRHeatmap)
export(ArchRPalettes)
export(ArchRProject)
export(addArchRAnnotations)
export(addArchRChrPrefix)
export(addArchRDebugging)
export(addArchRGenome)
export(addArchRH5Level)
export(addArchRLocking)
export(addArchRLogging)
export(addArchRThreads)
export(addArchRVerbose)
Expand Down Expand Up @@ -57,6 +60,7 @@ export(createArrowFiles)
export(createGeneAnnotation)
export(createGenomeAnnotation)
export(createLogFile)
export(customEnrichment)
export(enrichHeatmap)
export(exportGroupSE)
export(exportPeakMatrixForSTREAM)
Expand All @@ -67,6 +71,7 @@ export(findMacs2)
export(getArchRChrPrefix)
export(getArchRDebugging)
export(getArchRGenome)
export(getArchRH5Level)
export(getArchRLogging)
export(getArchRThreads)
export(getArchRVerbose)
Expand All @@ -90,6 +95,7 @@ export(getGenes)
export(getGenome)
export(getGenomeAnnotation)
export(getGroupBW)
export(getGroupFragments)
export(getGroupSE)
export(getGroupSummary)
export(getImputeWeights)
Expand All @@ -101,6 +107,7 @@ export(getMatrixFromArrow)
export(getMatrixFromProject)
export(getMonocleTrajectories)
export(getOutputDirectory)
export(getPBGroupSE)
export(getPeak2GeneLinks)
export(getPeakAnnotation)
export(getPeakSet)
Expand All @@ -111,6 +118,7 @@ export(getSampleColData)
export(getSampleNames)
export(getSeqnames)
export(getTSS)
export(getTestArrow)
export(getTestFragments)
export(getTestProject)
export(getTrajectory)
Expand Down Expand Up @@ -153,12 +161,14 @@ export(projectBulkATAC)
export(recoverArchRProject)
export(reformatFragmentFiles)
export(saveArchRProject)
export(setArchRLocking)
export(subsetArchRProject)
export(subsetCells)
export(theme_ArchR)
export(trajectoryHeatmap)
export(validBSgenome)
import(data.table)
importClassesFrom(GenomicRanges,GRanges)
importFrom(GenomicRanges,GRanges)
importFrom(Rcpp,sourceCpp)
useDynLib(ArchR)
60 changes: 59 additions & 1 deletion R/AllClasses.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#' @useDynLib ArchR
#' @importFrom Rcpp sourceCpp
#' @importClassesFrom GenomicRanges GRanges
#' @importFrom GenomicRanges GRanges
#' @import data.table
NULL
Expand Down Expand Up @@ -87,6 +88,15 @@ setMethod("show", "ArchRProject",
#' genome information such as nucleotide information or chromosome sizes.
#' @param showLogo A boolean value indicating whether to show the ascii ArchR logo after successful creation of an `ArchRProject`.
#' @param threads The number of threads to use for parallel execution.
#'
#' @examples
#'
#' # Get Test Arrow
#' arrow <- getTestArrow()
#'
#' # Create ArchR Project for Analysis
#' proj <- ArchRProject(arrow)
#'
#' @export
ArchRProject <- function(
ArrowFiles = NULL,
Expand Down Expand Up @@ -209,6 +219,15 @@ ArchRProject <- function(
#' This function will recover an ArchRProject if it has broken sampleColData or cellColData due to different versions of bioconductor s4vectors.
#'
#' @param ArchRProj An `ArchRProject` object.
#'
#' @examples
#'
#' # Get Test Project
#' proj <- getTestProject()
#'
#' # Try to Recover ArchR Project
#' proj <- recoverArchRProject(proj)
#'
#' @export
recoverArchRProject <- function(ArchRProj){

Expand All @@ -230,6 +249,11 @@ recoverArchRProject <- function(ArchRProj){
}
}

#Try to make sure that DataFrame matches currently loaded
#S4Vectors Package
ArchRProj@cellColData <- DataFrame(ArchRProj@cellColData)
ArchRProj@sampleColData <- DataFrame(ArchRProj@sampleColData)

if(inherits(ArchRProj@peakSet, "GRanges")){

peakSet <- tryCatch({
Expand Down Expand Up @@ -355,6 +379,24 @@ recoverArchRProject <- function(ArchRProj){
#' background peaks) should be ignored when re-normalizing file paths. If set to `FALSE` loading of the `ArchRProject`
#' will fail unless all components can be found.
#' @param showLogo A boolean value indicating whether to show the ascii ArchR logo after successful creation of an `ArchRProject`.
#'
#' @examples
#'
#' # Get Small PBMC Project Location
#' zipProj <- file.path(system.file("testdata", package="ArchR"), "PBSmall.zip")
#'
#' # Copy to current directory
#' file.copy(zipProj, basename(zipProj), overwrite = TRUE)
#'
#' # Unzip
#' unzip(basename(zipProj), overwrite = TRUE)
#'
#' # Remove
#' file.remove(basename(zipProj))
#'
#' # Load
#' loadArchRProject("PBSmall")
#'
#' @export
loadArchRProject <- function(
path = "./",
Expand Down Expand Up @@ -482,6 +524,14 @@ loadArchRProject <- function(
#' @param dropCells A boolean indicating whether to drop cells that are not in `ArchRProject` from corresponding Arrow Files.
#' @param logFile The path to a file to be used for logging ArchR output.
#' @param threads The number of threads to use for parallel execution.
#' @examples
#'
#' # Get Small Test Project
#' proj <- getTestProject()
#'
#' # Save
#' saveArchRProject(proj)
#'
#' @export
saveArchRProject <- function(
ArchRProj = NULL,
Expand Down Expand Up @@ -617,6 +667,15 @@ saveArchRProject <- function(
#' @param logFile The path to a file to be used for logging ArchR output.
#' @param threads The number of threads to use for parallel execution.
#' @param force If output directory exists overwrite.
#'
#' @examples
#'
#' # Get Small Test Project
#' proj <- getTestProject()
#'
#' #Subset
#' proj <- subsetArchRProject(proj, cells = getCellNames(proj)[1:50])
#'
#' @export
subsetArchRProject <- function(
ArchRProj = NULL,
Expand Down Expand Up @@ -784,7 +843,6 @@ subsetArchRProject <- function(

}


setMethod(
f = "colnames",
signature = c("x" = "ArchRProject"),
Expand Down
45 changes: 43 additions & 2 deletions R/AnnotationGenome.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,21 @@
#' @param filterChr A character vector indicating the seqlevels that should be removed if manual removal is desired for certain seqlevels.
#' If no manual removal is desired, `filterChr` should be set to `NULL`. If `filter` is set to `TRUE` but `filterChr` is set to `NULL`,
#' non-standard chromosomes will still be removed as defined in `filterChrGR()`.
#'
#' @examples
#'
#' if (!require("BSgenome.Hsapiens.UCSC.hg19", quietly = TRUE)) BiocManager::install("BSgenome.Hsapiens.UCSC.hg19")
#' library(BSgenome.Hsapiens.UCSC.hg19)
#'
#' # Get Genome
#' genome <- BSgenome.Hsapiens.UCSC.hg19
#'
#' # Create Genome Annotation
#' genomeAnno <- createGenomeAnnotation(genome)
#'
#' # Also can create from a string if BSgenome exists
#' genomeAnno <- createGenomeAnnotation("hg19")
#'
#' @export
createGenomeAnnotation <- function(
genome = NULL,
Expand Down Expand Up @@ -78,6 +93,27 @@ createGenomeAnnotation <- function(
#' @param exons A `GRanges` object containing gene exon coordinates. Must have a symbols column matching the symbols column of `genes`.
#' @param TSS A `GRanges` object containing standed transcription start site coordinates for computing TSS enrichment scores downstream.
#' @param annoStyle annotation style to map between gene names and various gene identifiers e.g. "ENTREZID", "ENSEMBL".
#' @param singleStrand A boolean for GenomicFeatures::genes(`single.strand.genes.only`) parameter
#'
#' @examples
#'
#' if (!require("TxDb.Hsapiens.UCSC.hg19.knownGene", quietly = TRUE)) BiocManager::install("TxDb.Hsapiens.UCSC.hg19.knownGene")
#' if (!require("org.Hs.eg.db", quietly = TRUE)) BiocManager::install("org.Hs.eg.db")
#' library(TxDb.Hsapiens.UCSC.hg19.knownGene)
#' library(org.Hs.eg.db)
#'
#' # Get Txdb
#' TxDb <- TxDb.Hsapiens.UCSC.hg19.knownGene
#'
#' # Get OrgDb
#' OrgDb <- org.Hs.eg.db
#'
#' # Create Genome Annotation
#' geneAnno <- createGeneAnnotation(TxDb=TxDb, OrgDb=OrgDb)
#'
#' # Also can create from a string if BSgenome exists
#' geneAnno <- createGeneAnnotation("hg19")
#'
#' @export
createGeneAnnotation <- function(
genome = NULL,
Expand All @@ -86,7 +122,8 @@ createGeneAnnotation <- function(
genes = NULL,
exons = NULL,
TSS = NULL,
annoStyle = NULL
annoStyle = NULL,
singleStrand = FALSE
){

.validInput(input = genome, name = "genome", valid = c("character", "null"))
Expand Down Expand Up @@ -118,7 +155,11 @@ createGeneAnnotation <- function(

###########################
message("Getting Genes..")
genes <- GenomicFeatures::genes(TxDb)
genes <- tryCatch({ #Legacy Catch In Case
GenomicFeatures::genes(TxDb, single.strand.genes.only = singleStrand)
}, error = function(e){
GenomicFeatures::genes(TxDb)
})

if(is.null(annoStyle)){
isEntrez <- mcols(genes)$symbol <- tryCatch({
Expand Down
Loading