Skip to content

sampleReads4collapsing samples random rows for unique barcodes (RG entries with a single row) #410

@tstohn

Description

@tstohn

Dear zUMI Team,

Thanks for the great pipeline. I unfortunately do not have the time to investigate it in detail, feel free to delete this issue if you think I made a wrong observation.
It is admittedly a tiny thing which has no implications in a real world example but I wanted to mention it in case you want to have a look at it: i think that following code samples a random row of the data table for unique barcodes (unique RG entries). If an RG-entry has several rows sample(.I , targetN) correctly samples from the row number of those RG entries, however, if an RG entry has a single row .I seems to refer to ALL rows of the data table (i worked under your provided conda environment). Those cells are most likely anyways filtered out, since no ones is interested in cell with a single read. I just stumbled upon it when working with some tiny test scenarios comparing zUMI to other pipelines:

rcl[ unlist(rcl[ ,exn:=.N,by=RG
][ , targetN:=exn # use binomial to break down to exon sampling
][ n> nmax, targetN:=rbinom(1,nmax,mean(exn)/mean(n) ), by=RG
][targetN>exn, targetN:=exn][is.na(targetN),targetN :=0
][ ,list(list(sample(.I , targetN))),by = RG]$V1) ]

All the best!
Tim

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions