Package: cellSNP
cellSNP aims to pileup the expressed alleles in single-cell or bulk RNA-seq
data, which can be directly used for donor deconvolution in multiplexed
single-cell RNA-seq data, particularly withvireo, which assigns cells to
donors and detects doublets, even without genotyping reference.cellSNP heavily depends onpysam, a Python interface for samtools and bcftools.
This program should give very similar results as samtools/bcftools mpileup.
Also, there are two major differences comparing to bcftools mpileup:cellSNP can pileup either the whole genome or a list of positions, with
directly splitting into a list of cell barcodes, e.g., for 10x genome. With
bcftools, you may need to manipulate the RG tag in the bam file if you want
to divide reads into cell barcode groups.cellSNP uses simple filtering for outputting SNPs, i.e., total UMIs or counts
and minor alleles fractions. The idea here is to keep most information of
SNPs and the downstream statistical model can take the full use of it.cellSNP has now a C version namedcellsnp-lite, which is basically more efficient with higher speed and
less memory usage while lacking mode 2.NewsWe have turn off the PCR duplicate filtering by default (–maxFLAG), as it is not well flagged in CellRanger, hence may result in loss of a substantial fraction of SNPs. Please use v0.3.1 or setting –maxFLAG to large number. Credits toissue13.All release notes can be found indoc/release.rst.For computational efficiency, we initialised comments on this:doc/speed.rstInstallationcellSNP is available throughpypi. To install, type the following command
line, and add-Ufor upgrading:pipinstall-UcellSNPAlternatively, you can install from this GitHub repository for latest (often
development) version by following command linepipinstall-Ugit+https://github.com/single-cell-genetics/cellSNPIn either case, if you don’t have write permission for your current Python
environment, we suggest creating a separateconda environmentor add--userfor your current one.Quick usageOnce installed, check all arguments by typecellSNP-h(see asnapshot)
There are three modes of cellSNP:Mode 1: pileup a list of SNPs for a single BAM/SAM fileUse both-Rand-b.Require: a single BAM/SAM file, e.g., from cellranger, a list of cell barcodes,
a VCF file for common SNPs. This mode is recommended comparing to mode 2, if a
list of common SNP is known, e.g., human (see Candidate SNPs below)cellSNP-s$BAM-b$BARCODE-O$OUT_DIR-R$REGION_VCF-p20--minMAF0.1--minCOUNT20As shown in the above command line, we recommend filtering SNPs with <20UMIs
or <10% minor alleles for downstream donor deconvolution, by adding--minMAF0.1--minCOUNT20Besides, special care needs to be taken when filtering PCR duplicates for scRNA-seq data by
setting maxFLAG to a small value, for the upstream pipeline may mark each extra read sharing
the same CB/UMI pair as PCR duplicate, which will result in most variant data being lost.
Due to the reason above, cellSNP by default uses a large maxFLAG value to include PCR
duplicates for scRNA-seq data when UMItag is turned on.Mode 2: pileup whole chromosome(s) for a single BAM/SAM fileDon’t use-Rbut flexible on-b.This mode requires inputting a single bam file with either cell barcoded
(add-b) or a bulk sample:# 10x sample with cell barcodescellSNP-s$BAM-b$BARCODE-O$OUT_DIR-p22--minMAF0.1--minCOUNT100# a bulk sample without cell barcodes and UMI tagcellSNP-s$bulkBAM-O$OUT_DIR-p22--minMAF0.1--minCOUNT100--UMItagNoneAdd–chromif you only want to genotype specific chromosomes, e.g.,1,2,
orchrMT.Recommend filtering SNPs with <100UMIs or <10% minor alleles for saving space
and speed up inference when pileup whole genome:--minMAF0.1--minCOUNT100Note, this mode may output false positive SNPs, for example somatic variants or
falses caussed by RNA editing. These false SNPs are probably not consistent in
all cells within one individual, hence confounding the demultiplexing.
Nevertheless, for species, e.g., zebrafish, without a good list of common SNPs,
this strategy is still worth a good try, and it does not take much more time
than mode 1.Mode 3: pileup a list of SNPs for one or multiple BAM/SAM filesUse-Rbut not-b.Require: one or multiple BAM/SAM files (bulk or smart-seq), their according
sample ids (optional), and a VCF file for a list of common SNPs. BAM/SAM files
can be input in comma separated way (-s) or in a list file (-S).cellSNP-s$BAM1,$BAM2,$BAM3-Isample_id1,sample_id2,sample_id3-o$OUT_FILE-R$REGION_VCF-p20--UMItagNonecellSNP-S$BAM_list_file-Isample_list_file-o$OUT_FILE-R$REGION_VCF-p20--UMItagNoneSet filtering thresholds according to the downstream analysis. Please add--UMItagNoneif you bam file does not have UMIs, e.g., smart-seq and bulk
RNA-seq.List of candidate SNPsA quality list of candidate SNPs (ususally common SNPs) are important for mode 1
and mode 3. If a list of genotyped SNPs is available, it can be used to pile up.
Alternatively, for human, common SNPs in population that have been idenetified
from consortiums can also be very good candidates, e.g.,gnomADand1000_Genome_Project. For the latter, we have compiled a list of 7.4 million
common variants (AF>5%) with this bashscriptand stored in thisfolder.In case you want to lift over SNP positions in vcf file from one genome build
to another, see ourLiftOver_vcfwrap function.FAQ and releasesFor troubleshooting, please have a look ofFAQ.rst, and we welcome reporting
anyissue.All releases are included inpypi. Notes for each release are recorded inrelease.rst.