GreenleafLab / MPAL-Single-Cell-2019

Publication Page for MPAL Paper 2019
77 stars 39 forks source link

'keepFilteredChromosomes' function seems invalid #16

Closed wangmeijiao closed 4 years ago

wangmeijiao commented 4 years ago

keepFilteredChromosomes function at line 310 of scATAC_04_Compute_Gene_Scores.R seems invalid and can not be found in any R packages (for example GenomicRanges, IRanges). Did you defined this function as your own and forget to upload?

Thanks

jgranja24 commented 4 years ago

yeah

keepFilteredChromosomes <- function(x, remove = c("chrM"), underscore = TRUE, standard = TRUE, pruning.mode="coarse"){

first we remove all non standard chromosomes

if(standard){ x <- GenomeInfoDb::keepStandardChromosomes(x, pruning.mode = pruning.mode) }

Then check for underscores or specified remove

seqNames <- seqlevels(x) chrRemove <- c()

first we remove all chr with an underscore

if(underscore){ chrRemove <- c(chrRemove, which(grepl("_", seqNames))) }

next we remove all chr specified in remove

chrRemove <- c(chrRemove, which(seqNames %in% remove)) if(length(chrRemove) > 0){ chrKeep <- seqNames[-chrRemove] }else{ chrKeep <- seqNames }

this function restores seqlevels

seqlevels(x, pruning.mode=pruning.mode) <- chrKeep return(x) }

wangmeijiao commented 4 years ago

Thanks and I will update the codes (downloaded from this git repository).