r3fang / SnapATAC

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

Filtering samples in snap object? #18

Closed Zepeng-Mu closed 5 years ago

Zepeng-Mu commented 5 years ago

Hi, Maybe I missed it in the tutorial but is there a function to filter barcodes based on some criteria in the snap object without extracting separate data matrix? Thanks

r3fang commented 5 years ago

Hi Zepeng,

Yes, the function is:

> x.sp = filterCells(
    obj=x.sp, 
    subset.names=c("fragment.num", "UMI"),
    low.thresholds=c(1000,1000),
    high.thresholds=c(Inf, Inf)
    );

createSnap creates a snap object and load the quality control metrics. filterCells remove cells of low quality before loading the sparse matrix.

Does it answer your question?

-R

Zepeng-Mu commented 5 years ago

Can I input a list of barcodes and filter them out?

r3fang commented 5 years ago

Yes.

> barcode.sel = c("barcode1", "barcode2");
> x.sp = x.sp[which(x.sp@barcode %in% barcode.sel),];
Zepeng-Mu commented 5 years ago

Oh, this actually can filter all the components in the data object? Thank you so much!