immunogenomics / starCAT

Implements *CellAnnotator (aka *CAT/starCAT), annotating scRNA-Seq with predefined gene expression programs
MIT License
12 stars 2 forks source link

TypeError: unsupported operand type(s) for +: 'NoneType' and 'str' #3

Closed JiahuaQu closed 3 months ago

JiahuaQu commented 3 months ago

Hi, thank you for the new program. When I was trying it in Linux system within a conda env, I got the error first: File "/home/.conda/envs/starCAT_env/lib/python3.9/site-packages/starcat/starcat.py", line 417, in save_results self.usage_norm.to_csv(os.path.join(output_dir, name+'.rf_usage_normalized.txt'), sep='\t') TypeError: unsupported operand type(s) for +: 'NoneType' and 'str'. Then I revised the line of script manually to be name, '.rf_usage_normalized.txt'). Although the program progressed a little, I had another similar error: File "/home/.conda/envs/starCAT_env/lib/python3.9/genericpath.py", line 152, in _check_arg_types raise TypeError(f'{funcname}() argument must be str, bytes, or ' TypeError: join() argument must be str, bytes, or os.PathLike object, not 'NoneType'

I also tried to install another version of python (3.7) which was tested by you, but it didn't work either.

Hope to get your help to figure it out. Thank you.

michelle-curtis commented 3 months ago

Hi, thanks for your post! Could you provide the full set of commands you are running, and the full error traces?

JiahuaQu commented 3 months ago

Thank you for your quick response. My commands: module load mamba/1.4.2 mamba create -n starCAT_env ipython python=3.9 mamba activate starCAT_env
pip install starcatpy mamba install seaborn scikit-learn pip install scanpy mamba install requests mamba deactivate

module load conda3/202210 source activate starCAT_env (or python=3.7) ref="TCAT.V1" counts_fn="01-make_mtx/matrix.mtx.gz" ouput_name="starCAT-CARneg" output_dir="02-run_starCAT" if [ ! -d "${output_dir}" ]; then mkdir "${output_dir}" fi starcat --reference $ref --counts ${counts_fn} --output-dir ${output_dir} --name ${output_name}

The full errors are: run_229421947.error.txt run_229422374.error.txt run_229423857.error.txt run_229435631.error.txt

michelle-curtis commented 3 months ago

Thank you! I think it might be a typo when assigning the variable output_name. Can you try changing ouput_name="starCAT-CARneg" to output_name="starCAT-CARneg", and see if that solves the issue, when running the original code?

JiahuaQu commented 3 months ago

Thank you. I will revise it and have another try. In addition, I tried to run the program with the reference database or tsv file downloaded in a prior try, but the program returned an error, starcat: error: unrecognized arguments: --score_path or starcat: error: unrecognized arguments: --cachedir?

michelle-curtis commented 3 months ago

The arguments score_path and cachedir actually aren't supported when running starcat via command line. You can find a list of possible command line arguments in the README.md. The argument to specify a scores.yml file via command line is --scores, so an example command would look like this: starcat --reference "TCAT.V1" --counts {counts_fn} --output-dir {output_dir} --name {outuput_name} --scores {score_path}

Also, please note that including a scores file is optional. If you are using the default TCAT.V1 reference, you can just specify its name --reference "TCAT.V1", and both the reference and scores paths can be inferred from this. In this case, the reference and scores file will be downloaded to a cache location in your working directory, i.e './cache'.

Hope this helps!

JiahuaQu commented 3 months ago

Thank you very much. I ran the program successfully and will delve into the results.

michelle-curtis commented 3 months ago

Ok great!