r3fang / SnapATAC

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

usable barcode #174

Closed rojinsafavi closed 4 years ago

rojinsafavi commented 4 years ago

Hello,

I have 5 atacseq data that I need to combine and analyze. I am following :https://github.com/r3fang/SnapATAC/tree/master/examples/10X_PBMC_15K

After running this code:

# for both datasets, we identify usable barcodes using [3.5-5] for log10(UMI) and [0.4-0.8] for promoter ratio as cutoff.
cutoff.logUMI.low = c(3.5, 3.5);
cutoff.logUMI.high = c(5, 5);
cutoff.FRIP.low = c(0.4, 0.4);
cutoff.FRIP.high = c(0.8, 0.8);
barcode.ls = lapply(seq(snap.files), function(i){
    barcodes = barcode.ls[[i]];
    idx = which(
        barcodes$logUMI >= cutoff.logUMI.low[i] & 
        barcodes$logUMI <= cutoff.logUMI.high[i] & 
        barcodes$promoter_ratio >= cutoff.FRIP.low[i] &
        barcodes$promoter_ratio <= cutoff.FRIP.high[i]
    );
    barcodes[idx,]
  });
x.sp.ls = lapply(seq(snap.files), function(i){
    barcodes = barcode.ls[[i]];
    x.sp = x.sp.ls[[i]];
    barcode.shared = intersect(x.sp@barcode, barcodes$barcode);
    x.sp = x.sp[match(barcode.shared, x.sp@barcode),];
    barcodes = barcodes[match(barcode.shared, barcodes$barcode),];
    x.sp@metaData = barcodes;
    x.sp
  })
names(x.sp.ls) = sample.names;
x.sp.ls

the number of barcodes for some of them is zero,

$one
number of barcodes: 1794
number of bins: 0
number of genes: 0
number of peaks: 0
number of motifs: 0

$two
number of barcodes: 1077
number of bins: 0
number of genes: 0
number of peaks: 0
number of motifs: 0

$three
number of barcodes: 0
number of bins: 0
number of genes: 0
number of peaks: 0
number of motifs: 0

$four
number of barcodes: 0
number of bins: 0
number of genes: 0
number of peaks: 0
number of motifs: 0

$five
number of barcodes: 0
number of bins: 0
number of genes: 0
number of peaks: 0
number of motifs: 0

I noticed that the problem is because the filtration is only applied to the first two datasets and not the rest, I would appriciate if you can help me?