r3fang / SnapATAC

Analysis Pipeline for Single Cell ATAC-seq
GNU General Public License v3.0
296 stars 125 forks source link

Using only .snap file from publication for SnapATAC analysis #260

Open Jasminefighter opened 5 months ago

Jasminefighter commented 5 months ago

Hi,

I am new to SnapATAC analysis. I'd like to analyze snATAC data from a publication, but only .snap files were provided. The Barcode selection seems to be the first step of the analysis. Could I still proceed with the below analysis if no barcode files were available?

Many thanks, Jifan

Step 1. Barcode selection We select high-quality barcodes based on two criteria: 1) number of unique fragments; 2) fragments in promoter ratio;

library(SnapATAC); x.sp = createSnap( file="atac_v1_adult_brain_fresh_5k.snap", sample="atac_v1_adult_brain_fresh_5k", num.cores=1 ); barcodes = read.csv( "atac_v1_adult_brain_fresh_5k_singlecell.csv", head=TRUE ); barcodes = barcodes[2:nrow(barcodes),]; promoter_ratio = (barcodes$promoter_region_fragments+1) / (barcodes$passed_filters + 1); UMI = log(barcodes$passed_filters+1, 10); data = data.frame(UMI=UMI, promoter_ratio=promoter_ratio); barcodes$promoter_ratio = promoter_ratio; library(viridisLite); library(ggplot2); p1 = ggplot( data, aes(x= UMI, y= promoter_ratio)) + geom_point(size=0.1, col="grey") + theme_classic() + ggtitle("10X Fresh Adult Brain") + ylim(0, 1) + xlim(0, 6) + labs(x = "log10(UMI)", y="promoter ratio") p1 barcodes.sel = barcodes[which(UMI >= 3 & UMI <= 5 & promoter_ratio >= 0.15 & promoter_ratio <= 0.6),]; rownames(barcodes.sel) = barcodes.sel$barcode; x.sp = x.sp[which(x.sp@barcode %in% barcodes.sel$barcode),]; x.sp@metaData = barcodes.sel[x.sp@barcode,]; x.sp