Isabella136 / AmrPlusPlus_SNP

GNU General Public License v3.0
1 stars 1 forks source link

Issue with using "-t" flag #30

Closed EnriqueDoster closed 11 months ago

EnriqueDoster commented 11 months ago

Hello!

A few weeks ago, we changed the AMR++ code to also pass the "threads" variable with the "-t" flag, into the command for calling the SNP_Verification.py script. I didn't notice at first, but it seems like the SNP_Verification.py script cannot parse the "-t" flag. This command fails:

python3 SNP_Verification.py -c config.ini -t 4 -a true -i S1_test.bam -o S1_test.AMR_SNPs --count_matrix AMR_analytic_matrix.csv
ERROR - this is the list of arguments recognized by the program:
        -a: amrplusplus; is either 'true' or 'false'
        -c: config file; if this argument is used, must be the first listed
        -h: help
        -i: BAM input file
        -l: license disclaimer
        -o: main output folder
        -r: conditions for redistribution
        -t: threads for multiprocessing

        --mt_and_wt:            true by default, used in case of insertion leading to presence of both mt and wt; if true, mark as resistant; if false, mark as susceptible
        --detailed_output:      false by default, determines whether a more detailed output will be given; can be either 'false', 'all', or include a list of accessions seperated by commas
        --count_matrix:         count matrix that will be updated if amrplusplus is true
        --count_matrix_final:   the file where the updated count matrix will be found if amrplusplus is true

But, when I run it without the flag it works fine:

python3 SNP_Verification.py -c config.ini -a true -i S1_test.bam -o S1_test.AMR_SNPs --count_matrix AMR_analytic_matrix.csv

Do you think this is something we can fix on your end, or should AMR++ modify the config file if we want to use a different number of threads?

Thank you! Enrique

Isabella136 commented 11 months ago

The newest commit should have fixed the problem. Let me know if there is something else

EnriqueDoster commented 11 months ago

Thanks for the quick response! I tried the latest commit and got the following error:

Traceback (most recent call last):
  File "/scratch/user/enriquedoster/test_AMR/AMRplusplus/work/8a/4c2a648a404c41aa74a4d41e757234/SNP_Verification.py", line 349, in <module>
    main()
  File "/scratch/user/enriquedoster/test_AMR/AMRplusplus/work/8a/4c2a648a404c41aa74a4d41e757234/SNP_Verification.py", line 338, in main
    config, argList = parse_config()
  File "/scratch/user/enriquedoster/test_AMR/AMRplusplus/work/8a/4c2a648a404c41aa74a4d41e757234/SNP_Verification.py", line 123, in parse_config
    config['SETTINGS']['THREADS'] = int(arg)
  File "/scratch/user/enriquedoster/conda_envs/AMR++_env/lib/python3.9/configparser.py", line 1261, in __setitem__
    self._parser._validate_value_types(option=key, value=value)
  File "/scratch/user/enriquedoster/conda_envs/AMR++_env/lib/python3.9/configparser.py", line 1188, in _validate_value_types
    raise TypeError("option values must be strings")
TypeError: option values must be strings

I tried it with these two commands and got the same error.

python3 SNP_Verification.py -c config.ini -a true -t 4 -i S1_test.bam -o S1_test.AMR_SNPs --count_matrix AMR_analytic_matrix.csv

# And with quotes
python3 SNP_Verification.py -c config.ini -a true -t "4" -i S1_test.bam -o S1_test.AMR_SNPs --count_matrix AMR_analytic_matrix.csv
Isabella136 commented 11 months ago

Let me know if the newest commit still causes the same problems

EnriqueDoster commented 11 months ago

Beautiful, that fixed it. Thanks again!