Package: demuxalot
DemuxalotReliable and efficient idenfitication of genotypes for individual cells
in RNA sequencing that refines the knowledge about genotypes from the data.Demuxalot is fast and optimized to work with lots of genotypes.Preprintis available at biorxiv.BackgroundDuring single-cell RNA-sequencing (scRnaSeq) we pool cells from different donors and process them together.Pro: all cells come through the same pipeline, so preparation/biological variation effects are cancelled out from analysis automatically.
Also experiments are much cheaper!Con: we don't know cell origin, everything is mixed!Demuxalot solves the con:
it guesses genotype of each cell by matching reads coming from cell against genotypes.
This is calleddemuxltiplexing.Herophilus uses scRnaSeq to study cells in organoids with multiple genetic backgrounds at scale.ComparisonsDemuxalot shows high reliability, data efficiency and speed.
Below is a benchmark on PMBC data with 32 donors frompreprintKnown genotypes and refined genotypes: the tale of two scenariosTypical approach to get genotype-specific mutations arewhole-genome sequencing (expensive, very good)you have information about all (ok, >90%) the genotype, and it is unlikely that you need to refine itso you just go straight to demultiplexingdemuxlet solves this caseBead arrays (aka SNP arrays aka DNA microarrays) are super cheap and practically more relevantyou get information about 50k to 650k most common SNPs, and that's only a small fraction, but you also pay very littlethis case is covered bydemuxalot(this package)Illumina's videoabout this technologyWhy is it worth refining genotypes?SNP array provides up to ~650k (as of 2021) positions in the genome.
Around 20-30% of them would be specific for a genotype (i.e. deviate from majority).Each genotype has around 10 times more SNV (single nucleotide variations)
that are not captured by array. Some of this missing SNPs are very valuable for demultiplexingWhat's special power of demuxalot?much better handling of multiple reads coming from the same UMI (i.e. same transcript)demuxalotefficiently combines information from multiple reads with same UMI and cross-checks itdefault settings are CellRanger-specific (that is - optimized for 10X pipeline). Cellranger's and STAR's flags in BAM break some common conventions,
but we can still efficiently use them (by using filtering callbacks)ability to refine genotypes. without failing and divergingVireo is a tool that was created with similar purposes. But it either diverges or does not learn better genotypesoptimized variant calling. It's also faster thandemuxletdue to multiprocessingthis is not a command-line tool, and not meant to bewrite python code, this gives full control and flexibility of demultiplexingInstallationPackage is pip-installable. Requires python >= 3.6pipinstalldemuxalotDeveloper installation:gitclonehttps://github.com/herophilus/demuxalotcddemuxalot&&pipinstall-e.Here are some common scenarios and how they are implemented in demuxalot.
Also visitexamples/folderRunning (simple scenario)Only using provided genotypesfromdemuxalotimportDemultiplexer,BarcodeHandler,ProbabilisticGenotypes,count_snps# Loading genotypesgenotypes=ProbabilisticGenotypes(genotype_names=['Donor1','Donor2','Donor3'])genotypes.add_vcf('path/to/genotypes.vcf')# Loading barcodesbarcode_handler=BarcodeHandler.from_file('path/to/barcodes.csv')snps=count_snps(bamfile_location='path/to/sorted_alignments.bam',chromosome2positions=genotypes.get_chromosome2positions(),barcode_handler=barcode_handler,)# returns two dataframes with likelihoods and posterior probabilitieslikelihoods,posterior_probabilities=Demultiplexer.predict_posteriors(snps,genotypes=genotypes,barcode_handler=barcode_handler,)Running (complex scenario)Refinement of known genotypes is shown in a notebook, seeexamples/Saving/loading genotypes# You can always export learnt genotypes to be used laterrefined_genotypes.save_betas('learnt_genotypes.parquet')refined_genotypes=ProbabilisticGenotypes(genotype_names=<listwhichgenotypestoloadhere>)refined_genotypes.add_prior_betas('learnt_genotypes.parquet')Re-saving VCF genotypes with betas (optional, recommended)Generally makes sense to export VCF to internal format only when you plan to load it many times.
Loading of internal format ismuchfaster than parsing/validating VCF.genotypes=ProbabilisticGenotypes(genotype_names=['Donor1','Donor2','Donor3'])genotypes.add_vcf('path/to/genotypes.vcf')genotypes.save_betas('learnt_genotypes.parquet')