I downloaded supplementary files from GSE232480 to get used to analyzing snATAC data.
filter_premerge <- function(fragment_path, count_path, meta_data_path, annotations) {
mouse_frag <- read.delim(fragment_path, header = TRUE, nrows = 10)
mouse_count <- Read10X_h5(count_path)
mouse_assay <- CreateChromatinAssay(
counts = mouse_count,
sep = c(":", "-"),
fragments = fragment_path,
min.cells = 10,
min.features = 200
)
mouse_meta <- read.csv(meta_data_path, header = TRUE, row.names = 1)
mouse_obj <- CreateSeuratObject(
counts = mouse_assay,
= mouse_meta,
assay = 'ATAC'
)
Annotation(mouse_obj) <- annotations
mouse_obj <- NucleosomeSignal(mouse_obj)
mouse_obj <- TSSEnrichment(mouse_obj)
mouse_obj$pct_reads_in_peaks <- mouse_obj$peak_region_fragments / mouse_obj$passed_filters * 100
mouse_obj$blacklist_ratio <- mouse_obj$blacklist_region_fragments / mouse_obj$peak_region_fragments
mouse_obj <- subset(
mouse_obj,
subset = peak_region_fragments > 2000 & peak_region_fragments < 50000 &
pct_reads_in_peaks > 30 & blacklist_ratio < 0.05 &
nucleosome_signal < 2 & TSS.enrichment > 2
)
return(mouse_obj)
}
Used this function to create seurat objects, for the next step I have to merge four such objects then further downstream analysis.
But there is a problem with the merge, the ram gets exhausted and the kernel is restarted.
This is the output before the kernel restarts, I thought since I only have 32GB of memory that could be the issue.
So I used seurat IntegrateData method to see if that works, but that didn't work either and this time I still had 50% of memory left with the code running indefinitely.
Finally I tried to use Harmony integration, now again stuck at scaleData. Runs Indefinitely.
Any suggestions will be appreciated, Thanks