pySCTransform icon indicating copy to clipboard operation
pySCTransform copied to clipboard

How to get corrected counts

Open ahmetrifaioglu opened this issue 3 years ago • 5 comments

Dear @saketkc,

I would like to first thank you for providing SCTransform in python. I was wondering what is the proper way of getting corrected counts to perform further analysis? Is it correct to create AnnData object as below considering that I called the vst function with current_count=True?

corrected_counts = vst_out["corrected_counts"].T
var_names_corrected = vst_out['model_parameters_fit'].index
    
 adata_transformed = AnnData(corrected_counts, 
                                dict(obs_names=adata.obs_names),
                                dict(var_names=var_names_corrected))

Best

ahmetrifaioglu avatar Nov 08 '21 10:11 ahmetrifaioglu

Hi @ahmetrifaioglu, this looks correct. Let me know if you run into any issues.

saketkc avatar Nov 08 '21 20:11 saketkc

@saketkc Thank you for the quick response. OK, I will try it and let you know if have any issues.

ahmetrifaioglu avatar Nov 09 '21 13:11 ahmetrifaioglu

Hi @saketkc,

Thank you so much for your effort to make sctransform available in python! I have a question on corrected_counts. After I run vst, it shows none in corrected_counts What I did:

data_out= vst(
    data.X.T,
    gene_names=data.var_names.tolist(),
    cell_names=data.obs_names.tolist(),
    method="glmgp",)

But I used normalized counts instead of raw counts. Appreciate any suggestion.

Very best,

onionpork avatar May 06 '22 21:05 onionpork

Hello @saketkc,

Is the above-corrected counts similar to the data slot from sctransform in R or is it similar to the counts slot?

Thank you for adding sctransform to Python.

Sayyam-Shah avatar Aug 20 '22 20:08 Sayyam-Shah

Hi @saketkc,

Thank you so much for your effort to make sctransform available in python! I have a question on corrected_counts. After I run vst, it shows none in corrected_counts What I did:

data_out= vst(
    data.X.T,
    gene_names=data.var_names.tolist(),
    cell_names=data.obs_names.tolist(),
    method="glmgp",)

But I used normalized counts instead of raw counts. Appreciate any suggestion.

Very best,

From

https://github.com/saketkc/pySCTransform/blob/d14af48c8c1bbceb132964df202e35b7b38cc3e6/pysctransform/pysctransform.py#L755-L759

You have to set correct_counts=True to let the code actually retrieves corrected counts, otherwise it will always return None.

Prunoideae avatar Mar 20 '24 05:03 Prunoideae