Giter Site home page Giter Site logo

pridepy's Introduction

pridepy: Python client for PRIDE Archive database

Python package PyPI version PyPI - Downloads

Python Client library for PRIDE Rest API

Installation

To install, simply use pip:

$ pip install --upgrade pridepy

Examples

Download all the raw files from a dataset(eg: PXD012353). Warning: Raw files are generally large in size, so it may take some time to download depending on the number of files and file sizes.

$ pridepy download-all-raw-files -a PXD012353 -o /Users/yourname/Downloads/foldername/

Download single file by name

$ pridepy download-files-by-name -a PXD022105 -o /Users/yourname/Downloads/foldername/ -f checksum.txt

Search projects with keywords and filters

$ pridepy search-projects-by-keywords-and-filters --keyword accession:PXD012353

Search files with filters

$ pridepy get-files-by-filter --filter fileCategory.value==RAW

Search protein-evidences with keywords and filters

$ pridepy search-protein-evidences --project_accession PXD012353

Search spectra-evidences with keywords and filters

$ pridepy search-spectra-evidences --usi "mzspec:PXD019317:sh_5282_HYK_101018_Mac_D_25mM.mzML:scan:10138:YAAMVTC[UNIMOD:4]MDEAVRNITWALKR/3"

Use below command to view list of commands available

$ python3 pridepy.py --help

  download-all-raw-files          
  download-files-by-name          
  get-files-by-filter             
  get-files-by-project-accession  
  get-projects                    
  get-projects-by-accession       
  get-reanalysis-projects-by-accession
  get-similar-projects-by-accession
  search-peptide-evidences        
  search-projects-by-keywords-and-filters
  search-protein-evidences       
  search-spectra-evidences        
  update-metadata                 

NOTE

Please make sure you are using Python3, not Python 2.7 version.

Citation

Selvakumar Kamatchinathan, Suresh Hewapathirana, Yasset Perez-Riverol. (2021, January 28). pridepy: python client for the PRIDE Archive database (Version v0.0.2). DOI

pridepy's People

Contributors

chakrabandla avatar selva439 avatar selvaebi avatar sureshhewabi avatar ypriverol avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

pridepy's Issues

Installation via pip

I noticed that the command given in the README 'pip install --upgrade pride-py' does not work for me, because pip cannot find a repository 'pride-py'. Using 'pip install --upgrade .' in the repository instead works as it picks up the information from the setup.py.

Not sure if there is something wrong on my end, or if you would like to change the README.

Thanks for your work!

New functionalitities for the library

@selvaebi :

These are a set of funcionalities we should implement:

  • Search capabilitites. We need to increase the search using https://www.ebi.ac.uk/pride/ws/archive/v2/search/projects we need to implement filters, sorting etc.
  • We should provide the functionality for the proteinevidences enpoind: https://www.ebi.ac.uk/pride/ws/archive/v2/proteinevidences?pageSize=100
  • We should provide the functionalitiy to retrieve the spectra: https://www.ebi.ac.uk/pride/ws/archive/v2/spectra

We need a data model that users can use to retrieve all the data from the API and all the endpoints.

search-spectra-evidences returns 404

Attempting to use the search-spectra-evidences command results in the following error message

File "<frozen runpy>", line 198, in _run_module_as_main File "<frozen runpy>", line 88, in _run_code File "C:\Python311\Scripts\pridepy.exe\__main__.py", line 7, in <module> File "C:\Python311\Lib\site-packages\click\core.py", line 1157, in __call__ return self.main(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Python311\Lib\site-packages\click\core.py", line 1078, in main rv = self.invoke(ctx) ^^^^^^^^^^^^^^^^ File "C:\Python311\Lib\site-packages\click\core.py", line 1688, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Python311\Lib\site-packages\click\core.py", line 1434, in invoke return ctx.invoke(self.callback, **ctx.params) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Python311\Lib\site-packages\click\core.py", line 783, in invoke return __callback(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Python311\Lib\site-packages\pridepy.py", line 254, in search_spectra_evidences print(spectra.spectra_evidences(usi, project_accession, assay_accession, peptide_sequence, modified_sequence, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Python311\Lib\site-packages\spectra\spectra.py", line 57, in spectra_evidences response = Util.get_api_call(request_url, headers) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Python311\Lib\site-packages\ratelimit\decorators.py", line 113, in wrapper return func(*args, **kargs) ^^^^^^^^^^^^^^^^^^^^ File "C:\Python311\Lib\site-packages\ratelimit\decorators.py", line 80, in wrapper return func(*args, **kargs) ^^^^^^^^^^^^^^^^^^^^ File "C:\Python311\Lib\site-packages\util\api_handling.py", line 26, in get_api_call raise Exception('PRIDE API response: {}'.format(response.status_code)) Exception: PRIDE API response: 404

Error running the package build locally

@selvaebi I have built the package locally in my machine and try to run pridepy -h here the error:

(pridepy) proteomicsdevmbpr1:pridepy yperez$ pridepy -h 
Traceback (most recent call last):
  File "/Users/yperez/local-apps/miniconda3/envs/pridepy/bin/pridepy", line 33, in <module>
    sys.exit(load_entry_point('pridepy==0.0.2', 'console_scripts', 'pridepy')())
  File "/Users/yperez/local-apps/miniconda3/envs/pridepy/bin/pridepy", line 25, in importlib_load_entry_point
    return next(matches).load()
  File "/Users/yperez/local-apps/miniconda3/envs/pridepy/lib/python3.8/importlib/metadata.py", line 77, in load
    module = import_module(match.group('module'))
  File "/Users/yperez/local-apps/miniconda3/envs/pridepy/lib/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 655, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 618, in _load_backward_compatible
  File "<frozen zipimport>", line 259, in load_module
  File "/Users/yperez/local-apps/miniconda3/envs/pridepy/lib/python3.8/site-packages/pridepy-0.0.2-py3.8.egg/pridepy.py", line 10, in <module>
ModuleNotFoundError: No module named 'peptide'

Example in README broken

I successfully installed pridepy and can run python3 pridepy it displays the help text.
When I run the example given in the README python3 pridepy.py download -a PXD012353 -o . I am getting the following error message:

File "pridepy.py", line 63, in <module>
    main()
  File "/home/sgessulat/repos/pride-py/venv/lib/python3.7/site-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
File "/home/sgessulat/repos/pride-py/venv/lib/python3.7/site-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
File "/home/sgessulat/repos/pride-py/venv/lib/python3.7/site-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
File "pridepy.py", line 33, in download
    raw_files.download_raw_files_from_ftp(accession, output_folder)
File "/home/sgessulat/repos/pride-py/venv/lib/python3.7/site-packages/files/raw.py", line 53, in download_raw_files_from_ftp
    urllib.request.urlretrieve(ftp_filepath, output_folder + new_file_path)
File "/home/sgessulat/.pyenv/versions/3.7.3/lib/python3.7/urllib/request.py", line 247, in urlretrieve
    with contextlib.closing(urlopen(url, data)) as fp:
File "/home/sgessulat/.pyenv/versions/3.7.3/lib/python3.7/urllib/request.py", line 222, in urlopen
    return opener.open(url, data, timeout)
File "/home/sgessulat/.pyenv/versions/3.7.3/lib/python3.7/urllib/request.py", line 525, in open
    response = self._open(req, data)
File "/home/sgessulat/.pyenv/versions/3.7.3/lib/python3.7/urllib/request.py", line 548, in _open
    'unknown_open', req)
File "/home/sgessulat/.pyenv/versions/3.7.3/lib/python3.7/urllib/request.py", line 503, in _call_chain
    result = func(*args)
File "/home/sgessulat/.pyenv/versions/3.7.3/lib/python3.7/urllib/request.py", line 1387, in unknown_open
    raise URLError('unknown url type: %s' % type)
urllib.error.URLError: <urlopen error unknown url type: [email protected]>

Do I need to adapt anything from the example above?
I tried different output path's already, because that's the only thing that is different from the given example.
It seems that the issue is related to the email address: [email protected]

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.