broadinstitute / CellBender

CellBender is a software package for eliminating technical artifacts from high-throughput single-cell RNA sequencing (scRNA-seq) data.
https://cellbender.rtfd.io
BSD 3-Clause "New" or "Revised" License
295 stars 54 forks source link

Python API? #142

Open cnk113 opened 2 years ago

cnk113 commented 2 years ago

Hello,

I was wondering if it was possible to get a Python API for CellBender's remove background?

Best, Chang

sjfleming commented 2 years ago

Interesting question. It would be possible, but it would certainly involve some work.

Can I ask why you would want that?

Are you thinking of using it more interactively, in a jupyter notebook or something?

cnk113 commented 2 years ago

Yeah interactive would be great, but also to be potentially used in another pipeline would be another benefit.

sjfleming commented 2 years ago

You could try calling the command line tool from python, as in something like this

from subprocess import run

cellbender_args = ['--input', '<FILENAME>',
                   '--output', '<NAME>',
                   '--cuda', 
                   ...]

run(['cellbender', 'remove-background'] + cellbender_args)
cnk113 commented 2 years ago

Ah I think there would be quite a bottlenecking if I had to save my adata file and then reopen the output.