pySCTransform
pySCTransform copied to clipboard
How to get corrected counts
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
Hi @ahmetrifaioglu, this looks correct. Let me know if you run into any issues.
@saketkc Thank you for the quick response. OK, I will try it and let you know if have any issues.
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,
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.
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
.