dylkot / cNMF

Code and example data for running Consensus Non-negative Matrix Factorization on single-cell RNA-Seq data
MIT License
243 stars 57 forks source link

TPM Flag #47

Closed carversh closed 1 year ago

carversh commented 1 year ago

Hi, how do you run the TPM flag? I tried running it the following ways and got an error (would you mind specifying this in the tutorial?):


cnmf prepare --output-dir ./ --name cNMF_initial -c exp.tsv -k 10 15 20 25 30 35 --n-iter 500 --seed 14 --numgenes 2000 --tpm TPM --total-workers 40

cnmf prepare --output-dir ./ --name cNMF_initial -c exp.tsv -k 10 15 20 25 30 35 --n-iter 500 --seed 14 --numgenes 2000 --tpm TPM --total-workers 40
carversh commented 1 year ago

Figured out that instead of putting in a counts file with -c, you put that file in as the TPM after the --tpm flag. Thanks!

dylkot commented 1 year ago

Yep, it allows you to input your own normalized data file rather than using the default TPM calculation. This is useful if you want to use e.g. TP10K rather than TPM or have some other per-cell normalization you'd like to do.

AteeqMKhaliq commented 1 year ago

-c ex Hi Can you please share the TPM command, I am using the following command and its throwing error

cnmf prepare --output-dir ./ --name cNMF_epi --tpm TPM tpm_counts.tsv -k 5 6 7 8 9 10 11 --n-iter 500 --seed 14 --numgenes 2000


Traceback (most recent call last):
  File "/Users/akhaliq/miniconda3/envs/cnmf_env/bin/cnmf", line 8, in <module>
    sys.exit(main())
  File "/Users/akhaliq/miniconda3/envs/cnmf_env/lib/python3.7/site-packages/cnmf/cnmf.py", line 1029, in main
    num_highvar_genes=args.numgenes, genes_file=args.genes_file, init=args.init)
  File "/Users/akhaliq/miniconda3/envs/cnmf_env/lib/python3.7/site-packages/cnmf/cnmf.py", line 297, in prepare
    if counts_fn.endswith('.h5ad'):
carversh commented 1 year ago

I believe in your case it would be see below. This is the only thing that worked for me. It's unintuitive to have to flag your matrix as counts and tpm because it's not a counts matrix, but this is the only version that ran for me -- it's not super clear on the github how to do this!:

cnmf prepare --output-dir ./ --name cNMF_epi -c tpm_counts.tsv -k 5 6 7 8 9 10 11 --n-iter 500 --seed 14 --numgenes 2000 --tpm tpm_counts.tsv