AlexsLemonade / scpca-nf

scpca-nf is the Nextflow workflow for processing Single-cell Pediatric Cancer Atlas Portal data
BSD 3-Clause "New" or "Revised" License
12 stars 2 forks source link

Skip CellAssign if only 1 cell #743

Closed allyhawkins closed 4 months ago

allyhawkins commented 4 months ago

Closes #731

Here I'm making sure we skip trying to run CellAssign if a processed object only has 1 cell. The problem is that we can't convert an object with 1 cell to an AnnData object, so then there's no AnnData object to use as input to CellAssign.

To handle this I added a check for the number of cells in the SCE object in sce_to_anndata.R. If < 2 cells, then the script just quits and doesn't do any conversions. This means no .h5ad file gets created. If that's the case then we skip running the predict_cellassign.py script and just make an empty predictions file to output from the process. Then when annotations get added to the SCE object, if the predictions file is empty, all cells get annotated with Not run. This is the same value we use when CellAssign isn't run because of too few cells.

While testing, I ran into small errors in the QC report that I also fixed here. Moving the miQC lines was something we had done on main, but seemed to be missing from development.