Commit 9387aca3 authored by HYsxe's avatar HYsxe
Browse files

Try resolving dependency of BuenRTools

parents 7a4b66e1 e0a283d7
Loading
Loading
Loading
Loading
+8 −7
Original line number Diff line number Diff line
@@ -2,6 +2,7 @@
if (Sys.getenv("RSTUDIO") == "1"){
  setwd(dirname(rstudioapi::getActiveDocumentContext()$path))
}
source("../../code/utils.R")
library(ggplot2)
library(Seurat)
library(GenomicRanges)
@@ -66,7 +67,7 @@ dev.off()

norm <- 100
flank <- 2000
TSS <- sort(sortSeqlevels(BuenRTools::hg38TSSRanges))
TSS <- sort(sortSeqlevels(FigR::hg38TSSRanges))
chr <- paste0(seqnames(TSS))
chr <- gtools::mixedsort(intersect(chr, paste0(seqnames(TSS))))
splitTSS <- split(GenomicRanges::resize(TSS,1,"start"), seqnames(TSS))[chr]
@@ -134,7 +135,7 @@ markers <- c("CD34", "TCL1A", "CD79A", "CD4", "CD3D", "GIMAP5", "CREM",
             "HBA2", "GNG11")

scRNACounts <- scRNASeurat@assays$RNA@counts
scRNACounts <- BuenRTools::centerCounts(scRNACounts, chunkSize = 1e5)
scRNACounts <- centerCounts(scRNACounts, chunkSize = 1e5)

pdf("../../data/BMMC/plots/QC/RNADotPlot.pdf",
    width = 7, height = 5.5)
@@ -155,13 +156,13 @@ scATACSE <- SummarizedExperiment::SummarizedExperiment(
)

# Calculate gene scores
geneScores <- BuenRTools::getGeneScoresFromPeaks(scATACSE, 
geneScores <- getGeneScoresFromPeaks(scATACSE, 
                                     genome = "hg38",
                                     TSSwindow = 10000, 
                                     getWeightsOnly = FALSE)

# Normalize gene scores
geneScores <- BuenRTools::centerCounts(geneScores, chunkSize = 1e5)
geneScores <- centerCounts(geneScores, chunkSize = 1e5)

pdf("../../data/BMMC/plots/QC/ATACDotPlot.pdf",
    width = 7, height = 5.5)
+6 −6
Original line number Diff line number Diff line
@@ -77,13 +77,13 @@ pseudobulkCenters$group <- pseudobulkNames
#########################################

# Calculate gene scores
geneScores <- BuenRTools::getGeneScoresFromPeaks(scATACSE, 
geneScores <- getGeneScoresFromPeaks(scATACSE, 
                                     genome = "mm10", 
                                     TSSwindow = 10000, 
                                     getWeightsOnly = FALSE)

# Normalize gene scores
geneScores <- BuenRTools::centerCounts(geneScores, chunkSize = 1e4)
geneScores <- centerCounts(geneScores, chunkSize = 1e4)

# Marker genes to plot
markers <- c("Cd3d", "Gata1", "Cd79a", "Selp",
@@ -164,7 +164,7 @@ dev.off()
scRNAMtx <- scRNASeurat@assays$RNA@counts

# Normalize RNA data
scRNAMtx <- BuenRTools::centerCounts(scRNAMtx, chunkSize = 5000)
scRNAMtx <- centerCounts(scRNAMtx, chunkSize = 5000)

# Smooth the gene scores of marker genes
KNN <- FNN::get.knn(scATACSeurat@reductions$lsi@cell.embeddings[colnames(scRNASeurat), 2:20], k = 500)$nn.index
+6 −6
Original line number Diff line number Diff line
@@ -2,7 +2,7 @@
if (Sys.getenv("RSTUDIO") == "1"){
  setwd(dirname(rstudioapi::getActiveDocumentContext()$path))
}

source("../../code/utils.R")
library(Seurat)
library(Signac)
library(SummarizedExperiment)
@@ -159,13 +159,13 @@ dev.off()
#################

# Calculate gene scores
geneScores <- BuenRTools::getGeneScoresFromPeaks(scATACSE, 
geneScores <- getGeneScoresFromPeaks(scATACSE, 
                                     genome = "mm10", 
                                     TSSwindow = 10000, 
                                     getWeightsOnly = FALSE)

# Normalize gene scores
geneScores <- BuenRTools::centerCounts(geneScores)
geneScores <- centerCounts(geneScores)

# Calculate gene score of cluster markers
seuratClusters <- scATACSeurat$seurat_clusters
+1 −0
Original line number Diff line number Diff line
source("../../code/utils.R")
library("data.table")
library(GenomicRanges)
library(dplyr)
+1 −0
Original line number Diff line number Diff line
source("../../code/utils.R")
library("data.table")
library(BuenRTools)
library(GenomicRanges)
Loading