Skip to content

Commit

Permalink
Merge pull request #1499 from GreenleafLab/release_1.0.2
Browse files Browse the repository at this point in the history
Release 1.0.2
  • Loading branch information
rcorces authored Jul 1, 2022
2 parents 041882c + 6a0ec0c commit f6c0388
Show file tree
Hide file tree
Showing 64 changed files with 1,170 additions and 452 deletions.
Binary file modified .DS_Store
Binary file not shown.
26 changes: 13 additions & 13 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Package: ArchR
Type: Package
Date: 2020-11-23
Date: 2022-04-03
Title: Analyzing single-cell regulatory chromatin in R.
Version: 1.0.1
Version: 1.0.2
Authors@R: c(
person("Jeffrey", "Granja", email = "jgranja.stanford@gmail.com", role = c("aut","cre")),
person("Ryan", "Corces", role = "aut"))
Expand All @@ -11,9 +11,17 @@ Roxygen: list(markdown = TRUE)
License: GPL (>= 2)
LinkingTo: Rcpp
LazyData: TRUE
RoxygenNote: 7.1.1
RoxygenNote: 7.1.2
Encoding: UTF-8
Imports:
ggplot2,
SummarizedExperiment,
data.table,
Matrix,
rhdf5,
magrittr,
S4Vectors (>= 0.9.25),
BiocGenerics,
Rcpp (>= 0.12.16),
matrixStats,
plyr,
Expand All @@ -29,17 +37,9 @@ Imports:
grid,
gridExtra,
Biostrings,
ComplexHeatmap
Depends:
ggplot2,
SummarizedExperiment,
data.table,
Matrix,
rhdf5,
magrittr,
S4Vectors (>= 0.9.25),
BiocGenerics,
ComplexHeatmap,
GenomicRanges
Depends:
Collate:
'AllClasses.R'
'AnnotationGenome.R'
Expand Down
4 changes: 3 additions & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
S3method("$",ArchRProject)
S3method("$<-",ArchRProject)
S3method("[",ArchRProject)
S3method(.DollarNames,ArchRProject)
export("%bcin%")
export("%bcni%")
export("%ni%")
export(.DollarNames.ArchRProject)
export(ArchRBrowser)
export(ArchRBrowserTrack)
export(ArchRPalettes)
Expand Down Expand Up @@ -158,5 +158,7 @@ export(subsetCells)
export(theme_ArchR)
export(trajectoryHeatmap)
export(validBSgenome)
import(data.table)
importFrom(GenomicRanges,GRanges)
importFrom(Rcpp,sourceCpp)
useDynLib(ArchR)
56 changes: 18 additions & 38 deletions R/AllClasses.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#' @useDynLib ArchR
#' @importFrom Rcpp sourceCpp
#' @importFrom GenomicRanges GRanges
#' @import data.table
NULL

setClassUnion("characterOrNull", c("character", "NULL"))
Expand Down Expand Up @@ -569,51 +571,29 @@ saveArchRProject <- function(
newProj@imputeWeights <- SimpleList()
}

#Copy Other Folders 2 layers nested
#Copy Recursively
message("Copying Other Files...")
for(i in seq_along(oldFiles)){

fin <- file.path(outDirOld, oldFiles[i])
fout <- file.path(outputDirectory, oldFiles[i])
message(sprintf("Copying Other Files (%s of %s): %s", i, length(oldFiles), basename(fin)))

if(dir.exists(fin)){

dir.create(file.path(outputDirectory, basename(fin)), showWarnings=FALSE)
fin2 <- list.files(fin, full.names = TRUE)

for(j in seq_along(fin2)){

if(dir.exists(fin2[j])){

dir.create(file.path(outputDirectory, basename(fin), basename(fin2)[j]), showWarnings=FALSE)
fin3 <- list.files(fin2[j], full.names = TRUE)

for(k in seq_along(fin3)){

cf <- file.copy(fin3[k], file.path(fout, basename(fin3[k])), overwrite = overwrite)

}

}else{

cf <- file.copy(fin2[j], file.path(fout, basename(fin2[j])), overwrite = overwrite)

}

}

}else{

cf <- file.copy(fin, fout, overwrite = overwrite)

}

message(sprintf("Copying Other Files (%s of %s): %s", i, length(oldFiles), oldFiles[i]))
oldPath <- file.path(outDirOld, oldFiles[i])
file.copy(oldPath, outputDirectory, recursive=TRUE, overwrite=overwrite)
}

#Set New Info
newProj@sampleColData <- newProj@sampleColData[names(ArrowFilesNew), , drop = FALSE]
newProj@sampleColData$ArrowFiles <- ArrowFilesNew[rownames(newProj@sampleColData)]

#Check for Group Coverages Copied
groupC <- length(newProj@projectMetadata$GroupCoverages)
if(length(groupC) > 0){
for(z in seq_len(groupC)){
zdata <- newProj@projectMetadata$GroupCoverages[[z]]$coverageMetadata
zfiles <- gsub(outDirOld, outputDirectory, zdata$File)
newProj@projectMetadata$GroupCoverages[[z]]$coverageMetadata$File <- zfiles
stopifnot(all(file.exists(zfiles)))
}
}

}

message("Saving ArchRProject...")
Expand Down
41 changes: 20 additions & 21 deletions R/AnnotationGenome.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@
#' @param chromSizes A `GRanges` object containing chromosome start and end coordinates.
#' @param blacklist A `GRanges` object containing regions that should be excluded from analyses due to unwanted biases.
#' @param filter A boolean value indicating whether non-standard chromosome scaffolds should be excluded.
#' These "non-standard" chromosomes are defined by `filterChrGR()`.
#' These "non-standard" chromosomes are defined by `filterChrGR()` and by manual annotation using the `filterChr` parameter.
#' @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 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()`.
#' @export
createGenomeAnnotation <- function(
genome = NULL,
Expand All @@ -24,23 +25,27 @@ createGenomeAnnotation <- function(
.validInput(input = filter, name = "filter", valid = c("boolean"))
.validInput(input = filterChr, name = "filterChr", valid = c("character", "null"))

if(is.null(genome) | is.null(blacklist) | is.null(chromSizes)){
##################
message("Getting genome..")
#validBSgenome works on both character and BSgenome inputs, which are the only allowable inputs to the param
bsg <- validBSgenome(genome)
genome <- bsg@pkgname

##################
message("Getting genome..")
bsg <- validBSgenome(genome)
genome <- bsg@pkgname

##################
message("Getting chromSizes..")
if(is.null(chromSizes)) {
message("Attempting to infer chromSizes..")
chromSizes <- GRanges(names(seqlengths(bsg)), IRanges(1, seqlengths(bsg)))
if(filter){
chromSizes <- filterChrGR(chromSizes, remove = filterChr)
chromSizes <- filterChrGR(chromSizes, remove = filterChr)
}
seqlengths(chromSizes) <- end(chromSizes)
} else {
message("Using provided chromSizes..")
chromSizes <- .validGRanges(chromSizes)
}

if(is.null(blacklist)){
##################
message("Getting blacklist..")
message("Attempting to infer blacklist..")

genomeName <- tryCatch({
bsg@provider_version
Expand All @@ -50,15 +55,9 @@ createGenomeAnnotation <- function(

blacklist <- .getBlacklist(genome = genomeName)

}else{

bsg <- validBSgenome(genome)
genome <- bsg@pkgname

chromSizes <- .validGRanges(chromSizes)

} else {
message("Using provided blacklist...")
blacklist <- .validGRanges(blacklist)

}

SimpleList(genome = genome, chromSizes = chromSizes, blacklist = blacklist)
Expand Down Expand Up @@ -172,7 +171,7 @@ createGeneAnnotation <- function(

###########################
message("Getting TSS..")
TSS <- unique(resize(GenomicFeatures::transcripts(TxDb), width = 1, fix = "start"))
TSS <- unique(GenomicRanges::resize(GenomicFeatures::transcripts(TxDb), width = 1, fix = "start"))

if(!is.null(inGenes)){
genes <- .validGRanges(inGenes)
Expand Down
Loading

0 comments on commit f6c0388

Please sign in to comment.