jodyphelan / TBProfiler

Profiling tool for Mycobacterium tuberculosis to detect ressistance and strain type from WGS data
GNU General Public License v3.0
102 stars 42 forks source link

fa2spoligotype() got an unexpected keyword argument 'kmer_counter' #316

Closed juliofdiaz closed 2 months ago

juliofdiaz commented 7 months ago

Hello,

I am trying to use Spolpred2, which I gather is implemented in tb-profiler, but I run into an error when the input is a fasta file

$ tb-profiler spoligotype --fasta $AMR_PRJS/assemblies/mtuberculosis/production/fasta/DRR290121.fasta 
[11:34:05] INFO     Using ref file: /well/aanensen/users/afk289/conda/skylake/envs/tbprofiler/share/tbprofiler//tbdb.fasta                                  db.py:594
           INFO     Using gff file: /well/aanensen/users/afk289/conda/skylake/envs/tbprofiler/share/tbprofiler//tbdb.gff                                    db.py:594
           INFO     Using bed file: /well/aanensen/users/afk289/conda/skylake/envs/tbprofiler/share/tbprofiler//tbdb.bed                                    db.py:594
           INFO     Using version file: /well/aanensen/users/afk289/conda/skylake/envs/tbprofiler/share/tbprofiler//tbdb.version.json                       db.py:594
           INFO     Using json_db file: /well/aanensen/users/afk289/conda/skylake/envs/tbprofiler/share/tbprofiler//tbdb.dr.json                            db.py:594
           INFO     Using variables file: /well/aanensen/users/afk289/conda/skylake/envs/tbprofiler/share/tbprofiler//tbdb.variables.json                   db.py:594
           INFO     Using spoligotype_spacers file:                                                                                                         db.py:594
                    /well/aanensen/users/afk289/conda/skylake/envs/tbprofiler/share/tbprofiler//tbdb.spoligotype_spacers.txt                                         
           INFO     Using spoligotype_annotations file:                                                                                                     db.py:594
                    /well/aanensen/users/afk289/conda/skylake/envs/tbprofiler/share/tbprofiler//tbdb.spoligotype_list.csv                                            
           INFO     Using bedmask file: /well/aanensen/users/afk289/conda/skylake/envs/tbprofiler/share/tbprofiler//tbdb.mask.bed                           db.py:594
           INFO     Using barcode file: /well/aanensen/users/afk289/conda/skylake/envs/tbprofiler/share/tbprofiler//tbdb.barcode.bed                        db.py:594
Traceback (most recent call last):
  File "/well/aanensen/users/afk289/conda/skylake/envs/tbprofiler/bin/tb-profiler", line 562, in <module>
    args.func(args)
  File "/well/aanensen/users/afk289/conda/skylake/envs/tbprofiler/bin/tb-profiler", line 244, in main_spoligotype
    "spoligotype":tbp.spoligotype(args),
  File "/well/aanensen/users/afk289/conda/skylake/envs/tbprofiler/lib/python3.10/site-packages/tbprofiler/spoligotyping.py", line 11, in spoligotype
    result = fa2spoligotype(args.fasta,args.files_prefix,args.conf,threads=args.threads,max_mem=args.ram,kmer_counter=args.kmer_counter)
TypeError: fa2spoligotype() got an unexpected keyword argument 'kmer_counter'
Cleaning up after failed run
           ERROR                                                                                                                                       tb-profiler:58

                    ################################# ERROR #######################################                                                                  

                    This run has failed. Please check all arguments and make sure all input files                                                                    
                    exist. If no solution is found, please open up an issue at                                                                                       
                    https://github.com/jodyphelan/TBProfiler/issues/new and paste or attach the                                                                      
                    contents of the error log (tbprofiler.errlog.txt)                                                                                                

                    ###############################################################################   

When I look at this definition of fa2spoligotype , I can see that it doesn't need the kmer_counter argument. On the other hand the function spoligotype does feed the kmer_counter argument.

I installed tb-profiler with conda as described, and I am attaching the tbprofiler.errlog.txt:

# tb-profiler error report

* OS: linux
* Program version: 5.0.1
* Database version: {'name': 'tbdb', 'commit': 'c2fb9a2', 'Author': 'jodyphelan <jody.phelan@lshtm.ac.uk>', 'Date': 'Tue Oct 4 11:40:15 2022 +0100'}
* Program call:

{'logging': 'INFO', 'read1': None, 'read2': None, 'bam': None, 'fasta': '/well/aanensen/projects/amr-landscape/assemblies/mtuberculosis/production/fasta/DRR290121.fasta', 'prefix': 'tbprofiler', 'txt': False, 'csv': False, 'docx': False, 'text_template': None, 'kmer_counter': 'kmc', 'platform': 'illumina', 'db': 'tbdb', 'external_db': None, 'dir': '/gpfs3/users/aanensen/afk289', 'no_clean': False, 'threads': 1, 'ram': 2, 'temp': '.', 'func': <function main_spoligotype at 0x7fbdea69fc70>, 'software_name': 'tbprofiler', 'tmp_prefix': '721855c7-7052-4409-a8fb-ca67ff24a299', 'files_prefix': '/gpfs3/users/aanensen/afk289/721855c7-7052-4409-a8fb-ca67ff24a299', 'conf': {'snpEff_db': 'Mycobacterium_tuberculosis_h37rv', 'drugs': ['rifampicin', 'isoniazid', 'ethambutol', 'pyrazinamide', 'streptomycin', 'fluoroquinolones', 'moxifloxacin', 'ofloxacin', 'levofloxacin', 'ciprofloxacin', 'aminoglycosides', 'amikacin', 'capreomycin', 'kanamycin', 'cycloserine', 'ethionamide', 'clofazimine', 'para-aminosalicylic_acid', 'delamanid', 'bedaquiline', 'linezolid'], 'amplicon': False, 'files': {'ref': 'tbdb.fasta', 'gff': 'tbdb.gff', 'bed': 'tbdb.bed', 'version': 'tbdb.version.json', 'json_db': 'tbdb.dr.json', 'variables': 'tbdb.variables.json', 'spoligotype_spacers': 'tbdb.spoligotype_spacers.txt', 'spoligotype_annotations': 'tbdb.spoligotype_list.csv', 'bedmask': 'tbdb.mask.bed', 'barcode': 'tbdb.barcode.bed'}, 'ref': '/well/aanensen/users/afk289/conda/skylake/envs/tbprofiler/share/tbprofiler//tbdb.fasta', 'gff': '/well/aanensen/users/afk289/conda/skylake/envs/tbprofiler/share/tbprofiler//tbdb.gff', 'bed': '/well/aanensen/users/afk289/conda/skylake/envs/tbprofiler/share/tbprofiler//tbdb.bed', 'version': {'name': 'tbdb', 'commit': 'c2fb9a2', 'Author': 'jodyphelan <jody.phelan@lshtm.ac.uk>', 'Date': 'Tue Oct 4 11:40:15 2022 +0100'}, 'variables': {'snpEff_db': 'Mycobacterium_tuberculosis_h37rv', 'drugs': ['rifampicin', 'isoniazid', 'ethambutol', 'pyrazinamide', 'streptomycin', 'fluoroquinolones', 'moxifloxacin', 'ofloxacin', 'levofloxacin', 'ciprofloxacin', 'aminoglycosides', 'amikacin', 'capreomycin', 'kanamycin', 'cycloserine', 'ethionamide', 'clofazimine', 'para-aminosalicylic_acid', 'delamanid', 'bedaquiline', 'linezolid'], 'amplicon': False, 'files': {'ref': 'tbdb.fasta', 'gff': 'tbdb.gff', 'bed': 'tbdb.bed', 'version': 'tbdb.version.json', 'json_db': 'tbdb.dr.json', 'variables': 'tbdb.variables.json', 'spoligotype_spacers': 'tbdb.spoligotype_spacers.txt', 'spoligotype_annotations': 'tbdb.spoligotype_list.csv', 'bedmask': 'tbdb.mask.bed', 'barcode': 'tbdb.barcode.bed'}}, 'spoligotype_spacers': '/well/aanensen/users/afk289/conda/skylake/envs/tbprofiler/share/tbprofiler//tbdb.spoligotype_spacers.txt', 'spoligotype_annotations': '/well/aanensen/users/afk289/conda/skylake/envs/tbprofiler/share/tbprofiler//tbdb.spoligotype_list.csv', 'bedmask': '/well/aanensen/users/afk289/conda/skylake/envs/tbprofiler/share/tbprofiler//tbdb.mask.bed', 'barcode': '/well/aanensen/users/afk289/conda/skylake/envs/tbprofiler/share/tbprofiler//tbdb.barcode.bed'}}

## Traceback:

  File "/well/aanensen/users/afk289/conda/skylake/envs/tbprofiler/bin/tb-profiler", line 562, in <module>
    args.func(args)
  File "/well/aanensen/users/afk289/conda/skylake/envs/tbprofiler/bin/tb-profiler", line 244, in main_spoligotype
    "spoligotype":tbp.spoligotype(args),
  File "/well/aanensen/users/afk289/conda/skylake/envs/tbprofiler/lib/python3.10/site-packages/tbprofiler/spoligotyping.py", line 11, in spoligotype
    result = fa2spoligotype(args.fasta,args.files_prefix,args.conf,threads=args.threads,max_mem=args.ram,kmer_counter=args.kmer_counter)

## Value:

fa2spoligotype() got an unexpected keyword argument 'kmer_counter'

Thanks for your help!

jodyphelan commented 7 months ago

Hi @juliofdiaz

Looks like you found a bug. I'll get that fixed asap!

jodyphelan commented 2 months ago

Closing this now as the issue should be fixed