phac-nml / staramr

Scans genome contigs against the ResFinder, PlasmidFinder, and PointFinder databases.
Apache License 2.0
111 stars 25 forks source link

AttributeError: type object 'object' has no attribute 'dtype' #206

Open siupenyau opened 5 months ago

siupenyau commented 5 months ago

Hi, When I ran staramr search for AMR and plasmid detection for my contigs, I received the following error message:

Input command: staramr search -o /OUTPUT-PATH/staramr/ /INPUT-PATH/contigs.fa 2024-01-09 10:56:37,924 INFO: No --pointfinder-organism specified. Will not search the PointFinder databases 2024-01-09 10:56:37,924 INFO: No --plasmidfinder-database-type specified. Will search the entire PlasmidFinder database 2024-01-09 10:56:37,925 INFO: --output-dir set. All files will be output to [/OUTPUT-PATH/staramr/] 2024-01-09 10:56:37,925 INFO: Will exclude ResFinder/PointFinder genes listed in [/home/User/anaconda3/envs/staramr/lib/python3.7/site-packages/staramr/databases/exclude/data/genes_to_exclude.tsv]. Use --no-exclude-genes to disable 2024-01-09 10:56:38,041 INFO: Making BLAST databases for input files 2024-01-09 10:58:08,675 INFO: Scheduling blasts for contigs.fa 2024-01-09 10:59:39,424 INFO: Note: NumExpr detected 64 cores but "NUMEXPR_MAX_THREADS" not set, so enforcing safe limit of 8. 2024-01-09 10:59:39,425 INFO: NumExpr defaulting to 8 threads. 2024-01-09 10:59:39,833 ERROR: type object 'object' has no attribute 'dtype' Traceback (most recent call last): File "/home/User/anaconda3/envs/staramr/bin/staramr", line 68, in args.run_command(args) File "/home/User/anaconda3/envs/staramr/lib/python3.7/site-packages/staramr/subcommand/Search.py", line 426, in run ignore_invalid_files=args.ignore_valid_files) File "/home/User/anaconda3/envs/staramr/lib/python3.7/site-packages/staramr/subcommand/Search.py", line 256, in _generate_results report_all_blast, ignore_invalid_files) File "/home/User/anaconda3/envs/staramr/lib/python3.7/site-packages/staramr/detection/AMRDetection.py", line 131, in run_amr_detection self._pointfinder_dataframe, self._plasmidfinder_dataframe) File "/home/User/anaconda3/envs/staramr/lib/python3.7/site-packages/staramr/detection/AMRDetectionResistance.py", line 70, in _create_amr_summary return amr_detection_summary.create_summary(self._include_negative_results) File "/home/User/anaconda3/envs/staramr/lib/python3.7/site-packages/staramr/results/AMRDetectionSummary.py", line 135, in create_summary resistance_frame = self._include_negatives(resistance_frame) File "/home/User/anaconda3/envs/staramr/lib/python3.7/site-packages/staramr/results/AMRDetectionSummary.py", line 58, in _include_negatives columns=('Isolate ID', 'Gene')).set_index('Isolate ID') File "/home/User/anaconda3/envs/staramr/lib/python3.7/site-packages/pandas/core/frame.py", line 466, in init mgr = init_dict({}, index, columns, dtype=dtype) File "/home/User/anaconda3/envs/staramr/lib/python3.7/site-packages/pandas/core/internals/construction.py", line 242, in init_dict val = construct_1d_arraylike_from_scalar(np.nan, len(index), nan_dtype) File "/home/User/anaconda3/envs/staramr/lib/python3.7/site-packages/pandas/core/dtypes/cast.py", line 1221, in construct_1d_arraylike_from_scalar dtype = dtype.dtype AttributeError: type object 'object' has no attribute 'dtype'

I installed pandas == 0.25.3. I successfully generated the set of ndb, nhr ......ntf, and nto files with the command: makeblastdb -in /INPUT-PATH/contigs.fa -dbtype nucl -parse_seqids. Did I miss anything? Thank you for your help in advance.

apetkau commented 5 months ago

Hello @siupenyau. Is there a reason why you are using pandas 0.25.3? I think the issue is you are using too old of a version of pandas.

siupenyau commented 5 months ago

Hi @apetkau ,

Thank you for the reply. I installed Staramr in conda. During the trial run, I received an error message: KeyError: 'Predicted Phenotype. Then I following the suggestion: https://github.com/phac-nml/irida/issues/686#issuecomment-625844117.

Finally, I got this error message during the re-run.

Also, I found that it took a bit long (2-3 minutes) for Making BLAST databases for input files and Scheduling blasts for contigs.fa, is that normal? Thank you for assistance in advance.

apetkau commented 5 months ago

Ah, okay. Thanks for the additional details.

What is the full stack trace of the original error? Which version of staramr are you using (run staramr --version)?

The suggestion in that issue is for a very old version of staramr and no longer works. There may be another issue you've encountered that is unrelated.

As for time taken to build blast databases and schedule blasts, this is variable depending on how large the files are and how many files you are processing.

siupenyau commented 4 months ago

Sorry for the late reply. The installed version is 0.5.1.

It was installed by default.