Skip to content

Commit

Permalink
Merge pull request #17 from PRIDE-Archive/ascpS3AndGlobus
Browse files Browse the repository at this point in the history
Ascp s3 and globus
  • Loading branch information
ypriverol authored Sep 26, 2024
2 parents a361024 + e027199 commit 7a6ab64
Show file tree
Hide file tree
Showing 55 changed files with 921 additions and 318 deletions.
64 changes: 64 additions & 0 deletions .github/workflows/conda-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: Conda Build and Test

on:
push:
branches:
- master
pull_request:
branches:
- master

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Set up Miniconda
uses: conda-incubator/setup-miniconda@v2
with:
auto-update-conda: true
python-version: 3.8
channels: conda-forge,defaults,bioconda

- name: Create conda environment
run: conda env create -f environment.yml

- name: Install mamba, boa and conda-build
run: |
source $CONDA/etc/profile.d/conda.sh
conda activate pridepy
conda install conda-forge::mamba
conda install conda-forge::boa
mamba install conda-build anaconda-client
shell: bash -l {0}

- name: Activate conda environment and build package
run: |
source $CONDA/etc/profile.d/conda.sh
conda activate pridepy
conda mambabuild recipe
shell: bash -l {0}

- name: Install the built package
run: |
source $CONDA/etc/profile.d/conda.sh
conda activate pridepy
mamba install --use-local pridepy
shell: bash -l {0}

- name: Output package info
run: |
source $CONDA/etc/profile.d/conda.sh
conda activate pridepy
conda list
shell: bash -l {0}

- name: Test the installed package
run: |
conda activate pridepy
pridepy --help
shell: bash -l {0}
18 changes: 12 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
[![PyPI version](https://badge.fury.io/py/pridepy.svg)](https://badge.fury.io/py/pridepy)
![PyPI - Downloads](https://img.shields.io/pypi/dm/pridepy)

Python Client library for PRIDE Rest API
Python Client library for PRIDE Rest API

# Installation
To install, simply use `pip`:
Expand All @@ -13,21 +13,28 @@ To install, simply use `pip`:
$ pip install --upgrade pridepy
```

# Examples
# Examples

Download all the raw files from a dataset(eg: PXD012353).
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.
-p in download specifies protocol , Available protocols nows are ftp, aspera, s3 and globus. Default is ftp.

```python
$ pridepy download-all-raw-files -a PXD012353 -o /Users/yourname/Downloads/foldername/
$ pridepy download-all-raw-files -a PXD012353 -o /Users/yourname/Downloads/foldername/ -p aspera
```

Download single file by name

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

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

Please note : Currently we use globus urls ( when -p globus is used) via https not globus protocol.

Search projects with keywords and filters

```python
Expand Down Expand Up @@ -67,7 +74,6 @@ $ python3 pridepy.py --help
search-peptide-evidences
search-projects-by-keywords-and-filters
search-protein-evidences
search-spectra-evidences
update-metadata

```
Expand Down
27 changes: 27 additions & 0 deletions aspera/etc/aspera-license
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4NCjxsaWNl
bnNlIHZlcnNpb249IjEiPg0KICA8IS0tIFZvaWQgaWYgbW9kaWZpZWQgLS0+
DQogIDxwcm9kdWN0X2lkPjY8L3Byb2R1Y3RfaWQ+DQogIDxjdXN0b21lcl9p
ZD4xPC9jdXN0b21lcl9pZD4NCiAgPGxpY2Vuc2VfaWQ+MTwvbGljZW5zZV9p
ZD4NCiAgPGFjY291bnRzPjA8L2FjY291bnRzPg0KICA8dW5pcXVlX2NvbmN1
cnJlbnRfbG9naW5zPjA8L3VuaXF1ZV9jb25jdXJyZW50X2xvZ2lucz4NCiAg
PG1heGltdW1fYmFuZHdpZHRoPnVubGltaXRlZDwvbWF4aW11bV9iYW5kd2lk
dGg+DQogIDxleHBpcmF0aW9uX2RhdGU+bm9uZTwvZXhw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XEvbg0K
UmhVY20zTVEwMFN3YUJnSk1JdGF1c3Y5UWl4MWJtRmtHQU4xNGJGdGt3PT0N
Cg==
15 changes: 15 additions & 0 deletions aspera/etc/aspera.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version='1.0' encoding='UTF-8'?>
<CONF version="2">

<central_server>
<port>40001</port>
<address>127.0.0.1</address>
</central_server>

<default>
</default>

<aaa>
</aaa>

</CONF>
12 changes: 12 additions & 0 deletions aspera/key/asperaweb_id_dsa.openssh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
-----BEGIN DSA PRIVATE KEY-----
MIIBuwIBAAKBgQDkKQHD6m4yIxgjsey6Pny46acZXERsJHy54p/BqXIyYkVOAkEp
KgvT3qTTNmykWWw4ovOP1+Di1c/2FpYcllcTphkWcS8lA7j012mUEecXavXjPPG0
i3t5vtB8xLy33kQ3e9v9/Lwh0xcRfua0d5UfFwopBIAXvJAr3B6raps8+QIVALws
yeqsx3EolCaCVXJf+61ceJppAoGAPoPtEP4yzHG2XtcxCfXab4u9zE6wPz4ePJt0
UTn3fUvnQmJT7i0KVCRr3g2H2OZMWF12y0jUq8QBuZ2so3CHee7W1VmAdbN7Fxc+
cyV9nE6zURqAaPyt2bE+rgM1pP6LQUYxgD3xKdv1ZG+kDIDEf6U3onjcKbmA6ckx
T6GavoACgYEAobapDv5p2foH+cG5K07sIFD9r0RD7uKJnlqjYAXzFc8U76wXKgu6
WXup2ac0Co+RnZp7Hsa9G+E+iJ6poI9pOR08XTdPly4yDULNST4PwlfrbSFT9FVh
zkWfpOvAUc8fkQAhZqv/PE6VhFQ8w03Z8GpqXx7b3NvBR+EfIx368KoCFEyfl0vH
Ta7g6mGwIMXrdTQQ8fZs
-----END DSA PRIVATE KEY-----
Binary file added aspera/linux-32/ascmd
Binary file not shown.
Binary file added aspera/linux-32/ascp
Binary file not shown.
Binary file added aspera/linux-32/ascp4
Binary file not shown.
Binary file added aspera/linux-32/aspshell
Binary file not shown.
Binary file added aspera/linux-32/astokengen
Binary file not shown.
Binary file added aspera/linux-32/faspstream
Binary file not shown.
Binary file added aspera/linux-64/ascmd
Binary file not shown.
Binary file added aspera/linux-64/ascp
Binary file not shown.
Binary file added aspera/linux-64/ascp4
Binary file not shown.
Binary file added aspera/linux-64/aspshell
Binary file not shown.
Binary file added aspera/linux-64/astokengen
Binary file not shown.
Binary file added aspera/linux-64/faspstream
Binary file not shown.
Binary file added aspera/mac-intel/ascmd
Binary file not shown.
Binary file added aspera/mac-intel/ascp
Binary file not shown.
Binary file added aspera/mac-intel/aspshell
Binary file not shown.
Binary file added aspera/mac-intel/astokengen
Binary file not shown.
Binary file added aspera/windows-32/ascmd.exe
Binary file not shown.
Binary file added aspera/windows-32/ascp.exe
Binary file not shown.
Binary file added aspera/windows-32/ascp4.exe
Binary file not shown.
Binary file added aspera/windows-32/aspshell.exe
Binary file not shown.
Binary file added aspera/windows-32/astokengen.exe
Binary file not shown.
Binary file added aspera/windows-32/fasp3.dll
Binary file not shown.
Binary file added aspera/windows-32/faspstream.exe
Binary file not shown.
Binary file added aspera/windows-32/libeay32.dll
Binary file not shown.
Binary file added aspera/windows-32/msvcp100.dll
Binary file not shown.
Binary file added aspera/windows-32/msvcr100.dll
Binary file not shown.
Binary file added aspera/windows-32/ssleay32.dll
Binary file not shown.
Binary file added aspera/windows-64/ascp.exe
Binary file not shown.
Binary file added aspera/windows-64/ascp4.exe
Binary file not shown.
Binary file added aspera/windows-64/fasp3.dll
Binary file not shown.
Binary file added aspera/windows-64/faspstream.exe
Binary file not shown.
Binary file added aspera/windows-64/libeay32.dll
Binary file not shown.
Binary file added aspera/windows-64/msvcp100.dll
Binary file not shown.
Binary file added aspera/windows-64/msvcr100.dll
Binary file not shown.
Binary file added aspera/windows-64/ssleay32.dll
Binary file not shown.
18 changes: 14 additions & 4 deletions authentication/authentication.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,14 @@ def get_token(self, username, password):

# get token to access the api
url = self.base_url + "getAAPToken"
headers = {'Content-type': 'application/json', 'Accept': 'text/plain'}
credentials = "{\"Credentials\":{\"username\":\"" + username + "\", \"password\":\"" + password + "\"}}"
headers = {"Content-type": "application/json", "Accept": "text/plain"}
credentials = (
'{"Credentials":{"username":"'
+ username
+ '", "password":"'
+ password
+ '"}}'
)

response = requests.post(url, data=credentials, headers=headers)

Expand All @@ -44,8 +50,12 @@ def validate_token(self, token):
:return: Return True if the token is valid and not expired: Otherwise returns False
"""
url = self.base_url + "token-validation"
headers = {'Authorization': 'Bearer ' + token}
headers = {"Authorization": "Bearer " + token}

response = requests.post(url, headers=headers)

return response.ok and response.status_code == 200 and response.text == 'Token Valid'
return (
response.ok
and response.status_code == 200
and response.text == "Token Valid"
)
15 changes: 15 additions & 0 deletions environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# environment.yml
name: pridepy
channels:
- bioconda
- conda-forge
dependencies:
- requests~=2.31.0
- ratelimit~=2.2.1
- click~=8.1.7
- pytest~=8.0.2
- setuptools
- plotly~=5.22.0
- boto3~=1.34.61
- botocore~=1.34.74
- tqdm
Loading

0 comments on commit 7a6ab64

Please sign in to comment.