MannLabs / alphapeptdeep

Deep learning framework for proteomics
Apache License 2.0
105 stars 20 forks source link

error using gui: 'PredictFastaSpecLib' object has no attribute 'from_fasta' #51

Closed pulintz-um closed 2 years ago

pulintz-um commented 2 years ago

Hello, I'm getting the following error when trying to generate a library from a fasta input file via the GUI version of the tool:

AttributeError: 'PredictFastaSpecLib' object has no attribute 'from_fasta'

Here's the full trace:

2022-07-29 13:44:55.893 Uncaught app exception
Traceback (most recent call last):
  File "/home/ubuntu/miniconda3/envs/peptdeep/lib/python3.8/site-packages/streamlit/scriptrunner/script_runner.py", line 557, in _run_script
    exec(code, module.__dict__)
  File "/home/ubuntu/miniconda3/envs/peptdeep/lib/python3.8/site-packages/peptdeep/webui/main_ui.py", line 48, in <module>
    sidebar[menu]()
  File "/home/ubuntu/miniconda3/envs/peptdeep/lib/python3.8/site-packages/peptdeep/webui/library_ui.py", line 198, in show
    generate_library()
  File "/home/ubuntu/miniconda3/envs/peptdeep/lib/python3.8/site-packages/peptdeep/pipeline_api.py", line 252, in generate_library
    raise e
  File "/home/ubuntu/miniconda3/envs/peptdeep/lib/python3.8/site-packages/peptdeep/pipeline_api.py", line 219, in generate_library
    lib_maker.make_library(lib_settings['input']['paths'])
  File "/home/ubuntu/miniconda3/envs/peptdeep/lib/python3.8/site-packages/peptdeep/spec_lib/library_factory.py", line 67, in make_library
    self._input(_input)
  File "/home/ubuntu/miniconda3/envs/peptdeep/lib/python3.8/site-packages/peptdeep/spec_lib/library_factory.py", line 181, in _input
    self.spec_lib.from_fasta(fasta)
AttributeError: 'PredictFastaSpecLib' object has no attribute 'from_fasta'

I'm getting the same error on a MacOS install as well as linux.

Am I missing something simple in the use of the tool? Thanks!

jalew188 commented 2 years ago

Hi @pulintz-um , I modified the API as 'get_peptides_from_fasta()' but we forgot to update the GUI. Did you use alphapeptdeep via the installer or pip or github code? We have a quick fix on github.

For installer or pip, we will test the code more and update this evening or tomorrow.

Thanks.

Best, Feng

jalew188 commented 2 years ago

@pulintz-um Now it should work in all of the installers and pip and github main branch.

pulintz-um commented 2 years ago

Thanks very much @jalew188!

I had installed via pip, but also tried cloning from github. Looks like updating via pip does get version 0.1.4 with the change. (Note, on MacOS I needed to comment out line 152 of the peptdeep/utils.py file logging.info(f"cpu frequency - {psutil.cpu_freq().current:.2f} Mhz") since that command seems broken on my M1 Mac. This isn't a problem on linux).

However, when I launch the gui (peptdeep gui), I'm seeing the message "No module named 'alphapept'". Is that an issue? The gui looks normal, and the library tool seems to launch after inputting a fasta file, but I'm unclear if it's just hanging or not: I'm not seeing anything in the output folder as of 30 minutes. I'm trying to run against the SwissProt fasta database (https://ftp.uniprot.org/pub/databases/uniprot/current_release/knowledgebase/complete/uniprot_sprot.fasta.gz).

Here's the cli output:

(peptdeep) ubuntu@ip-172-31-21-24:~$ peptdeep gui
alphapept or RawFileReader is not installed
No module named 'alphapept'

     ____             __  ____                
    / __ \___  ____  / /_/ __ \___  ___  ____ 
   / /_/ / _ \/ __ \/ __/ / / / _ \/ _ \/ __ \
  / ____/  __/ /_/ / /_/ /_/ /  __/  __/ /_/ /
 /_/    \___/ .___/\__/_____/\___/\___/ .___/ 
           /_/                       /_/      
....................................................
.                      0.1.4                       .
.       https://github.com/MannLabs/peptdeep       .
.                    Apache 2.0                    .
....................................................

Starting PeptDeep Web Server ...

  You can now view your Streamlit app in your browser.

  Network URL: http://172.31.21.24:8077
  External URL: http://34.201.91.102:8077

2022-07-29 17:06:54> Platform information:
2022-07-29 17:06:54> system        - Linux
2022-07-29 17:06:54> release       - 5.4.0-1081-aws
2022-07-29 17:06:54> version       - #88~18.04.1-Ubuntu SMP Thu Jun 23 16:29:17 UTC 2022
2022-07-29 17:06:54> machine       - x86_64
2022-07-29 17:06:54> processor     - x86_64
2022-07-29 17:06:54> cpu count     - 16
2022-07-29 17:06:54> cpu frequency - 2300.10 Mhz
2022-07-29 17:06:54> ram           - 61.5/62.8 Gb (available/total)
2022-07-29 17:06:54> 
2022-07-29 17:06:54> Python information:
2022-07-29 17:06:54> alphabase    - 0.1.2
2022-07-29 17:06:54> biopython    - 1.79
2022-07-29 17:06:54> click        - 8.1.3
2022-07-29 17:06:54> lxml         - 4.9.1
2022-07-29 17:06:54> matplotlib   - 3.5.2
2022-07-29 17:06:54> numba        - 0.56.0
2022-07-29 17:06:54> numpy        - 1.22.4
2022-07-29 17:06:54> pandas       - 1.4.3
2022-07-29 17:06:54> peptdeep     - 0.1.4
2022-07-29 17:06:54> psutil       - 5.9.1
2022-07-29 17:06:54> python       - 3.8.13
2022-07-29 17:06:54> regex        - 2022.7.25
2022-07-29 17:06:54> scikit-learn - 1.1.1
2022-07-29 17:06:54> seaborn      - 0.11.2
2022-07-29 17:06:54> statsmodels  - 0.13.2
2022-07-29 17:06:54> streamlit    - 1.11.1
2022-07-29 17:06:54> torch        - 1.12.0
2022-07-29 17:06:54> tqdm         - 4.64.0
2022-07-29 17:06:54> transformers - 4.21.0
2022-07-29 17:06:54> 
2022-07-29 17:06:57> Generating the library...
pulintz-um commented 2 years ago

Update: 0.1.4 appears to be working on a small test fasta file of 86 proteins.

2022-07-29 19:53:25> Generating the library...
2022-07-29 19:53:27> Calculating precursor isotope distributions ...
100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 29/29 [00:03<00:00,  7.62it/s]
  Stopping...
2022-07-29 19:53:33> Predicting RT/IM/MS2 ...
2022-07-29 19:53:33> Using multiprocessing ...
2022-07-29 19:53:33> Predicting rt,mobility,ms2 ...
  0%|                                                                                                                                                                   | 0/29 [00:00<?, ?it/s

So this particular issue appears to be resolved. Thanks again for the help.

jalew188 commented 2 years ago

Yes, if you don't have GPU version of pytorch, predicting takes nearly two or more hours...

jalew188 commented 2 years ago

I had installed via pip, but also tried cloning from github. Looks like updating via pip does get version 0.1.4 with the change. (Note, on MacOS I needed to comment out line 152 of the peptdeep/utils.py file logging.info(f"cpu frequency - {psutil.cpu_freq().current:.2f} Mhz") since that command seems broken on my M1 Mac. This isn't a problem on linux

I don't have M1 to test, so cannot fix this. M1 is not currently supported as we need to test the M1 version of pytorch.

For 'no alphapept' issue, it is OK. We call alphapept to load the raw data.

pulintz-um commented 2 years ago

Confirmed the tool is working on a GPU-aware instance. Nice!

2022-08-01 14:51:57> Generating the library...
2022-08-01 14:51:59> Calculating precursor isotope distributions ...
100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████| 29/29 [00:05<00:00,  5.09it/s]
2022-08-01 14:52:07> Predicting RT/IM/MS2 ...
2022-08-01 14:52:07> Predicting RT ...
100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████| 29/29 [00:06<00:00,  4.23it/s]
2022-08-01 14:52:14> Predicting mobility ...
100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████| 29/29 [00:07<00:00,  3.83it/s]
2022-08-01 14:52:24> Predicting MS2 ...
100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████| 29/29 [00:10<00:00,  2.69it/s]
2022-08-01 14:52:35> End Predicting RT/IM/MS2
2022-08-01 14:52:35> Saving HDF library to /home/ubuntu/peptdeep_library/predict.speclib.hdf ...
2022-08-01 14:52:39> Library generated!!
jalew188 commented 2 years ago

Nice! Thank you for your testing:)