Skip to content

Commit e7234fd

Browse files
authored
Merge pull request #31 from pepkit/pephub_updates
Pephub updates
2 parents 187a378 + 561d455 commit e7234fd

File tree

10 files changed

+1697
-35
lines changed

10 files changed

+1697
-35
lines changed

Diff for: autodoc.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -99,4 +99,4 @@
9999
with open(out, "w") as stream:
100100
stream.write(md_result)
101101
else:
102-
print("Skipping jupyter notebooks")
102+
print("Skipping jupyter notebooks")

Diff for: docs/pephub/developer/pephubclient/changelog.md

+24-5
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,32 @@
22

33
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html) and [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) format.
44

5-
## [0.3.0] - 2024-XX-XX
5+
## [0.4.2] - 2024-04-16
6+
### Updated
7+
- View creation, by adding description and no_fail flag
8+
9+
10+
## [0.4.1] - 2024-03-07
11+
### Fixed
12+
- Expired token error handling ([#17](https://github.com/pepkit/pephubclient/issues/17))
13+
14+
## [0.4.0] - 2024-02-12
615
### Added
7-
- Added param parent dir where peps should be saved
8-
- Added zip option to save_pep function
16+
- a parameter that points to where peps should be saved ([#32](https://github.com/pepkit/pephubclient/issues/32))
17+
- pep zipping option to `save_pep` function ([#34](https://github.com/pepkit/pephubclient/issues/34))
18+
- API for samples ([#29](https://github.com/pepkit/pephubclient/issues/29))
19+
- API for projects ([#28](https://github.com/pepkit/pephubclient/issues/28))
920

10-
### Changed
11-
- Transferred save_pep function to helpers
21+
### Updated
22+
- Transferred `save_pep` function to helpers
23+
24+
## [0.3.0] - 2024-01-17
25+
### Added
26+
- customization of the base PEPhub URL ([#22](https://github.com/pepkit/pephubclient/issues/22))
27+
28+
### Updated
29+
- Updated PEPhub API URL
30+
- Increased the required pydantic version to >2.5.0
1231

1332
## [0.2.2] - 2024-01-17
1433
### Added
+116
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
<!-- markdownlint-disable -->
2+
3+
4+
# <kbd>module</kbd> `pephubclient.modules.sample`
5+
6+
7+
8+
9+
**Global Variables**
10+
---------------
11+
- **PEPHUB_SAMPLE_URL**
12+
13+
14+
---
15+
16+
17+
## <kbd>class</kbd> `PEPHubSample`
18+
Class for managing samples in PEPhub and provides methods for getting, creating, updating and removing samples. This class is not related to peppy.Sample class.
19+
20+
21+
### <kbd>method</kbd> `__init__`
22+
23+
```python
24+
__init__(jwt_data: str = None)
25+
```
26+
27+
28+
- :param jwt_data: jwt token for authorization
29+
30+
31+
32+
33+
---
34+
35+
36+
### <kbd>method</kbd> `create`
37+
38+
```python
39+
create(
40+
namespace: str,
41+
name: str,
42+
tag: str,
43+
sample_name: str,
44+
sample_dict: dict,
45+
overwrite: bool = False
46+
) → None
47+
```
48+
49+
Create sample in project in PEPhub.
50+
51+
52+
- :param namespace: namespace of project
53+
- :param name: name of project
54+
- :param tag: tag of project
55+
- :param sample_dict: sample dict
56+
- :param sample_name: sample name
57+
- :param overwrite: overwrite sample if it exists :return: None
58+
59+
---
60+
61+
62+
### <kbd>method</kbd> `get`
63+
64+
```python
65+
get(namespace: str, name: str, tag: str, sample_name: str = None) → dict
66+
```
67+
68+
Get sample from project in PEPhub.
69+
70+
71+
- :param namespace: namespace of project
72+
- :param name: name of project
73+
- :param tag: tag of project
74+
- :param sample_name: sample name :return: Sample object
75+
76+
---
77+
78+
79+
### <kbd>method</kbd> `remove`
80+
81+
```python
82+
remove(namespace: str, name: str, tag: str, sample_name: str)
83+
```
84+
85+
Remove sample from project in PEPhub.
86+
87+
88+
- :param namespace: namespace of project
89+
- :param name: name of project
90+
- :param tag: tag of project
91+
- :param sample_name: sample name :return: None
92+
93+
---
94+
95+
96+
### <kbd>method</kbd> `update`
97+
98+
```python
99+
update(namespace: str, name: str, tag: str, sample_name: str, sample_dict: dict)
100+
```
101+
102+
Update sample in project in PEPhub.
103+
104+
105+
- :param namespace: namespace of project
106+
- :param name: name of project
107+
- :param tag: tag of project
108+
- :param sample_name: sample name
109+
- :param sample_dict: sample dict, that contain elements to update, or :return: None
110+
111+
112+
113+
114+
---
115+
116+
_This file was automatically generated via [lazydocs](https://github.com/ml-tooling/lazydocs)._

Diff for: docs/pephub/developer/pephubclient/phc_usage.md

+189
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,189 @@
1+
<!-- markdownlint-disable -->
2+
3+
4+
# <kbd>module</kbd> `pephubclient.pephubclient`
5+
6+
---
7+
8+
9+
## <kbd>class</kbd> `PEPHubClient`
10+
11+
12+
---
13+
14+
#### <kbd>property</kbd> sample
15+
16+
view represents the PHCSample class which contains all samples API
17+
18+
19+
---
20+
21+
#### <kbd>property</kbd> view
22+
23+
view represents the PHCView class which contains all views API
24+
25+
26+
27+
---
28+
29+
### <kbd>method</kbd> `find_project`
30+
31+
```python
32+
find_project(
33+
namespace: str,
34+
query_string: str = '',
35+
limit: int = 100,
36+
offset: int = 0,
37+
filter_by: Literal['submission_date', 'last_update_date'] = None,
38+
start_date: str = None,
39+
end_date: str = None
40+
) → SearchReturnModel
41+
```
42+
43+
Find project in specific namespace and return list of PEP annotation
44+
45+
- :param namespace: Namespace where to search for projects
46+
- :param query_string: Search query
47+
- :param limit: Return limit
48+
- :param offset: Return offset
49+
- :param filter_by: Use filter date. Option: [submission_date, last_update_date]
50+
- :param start_date: filter beginning date
51+
- :param end_date: filter end date (if none today's date is used) :return:
52+
53+
---
54+
55+
56+
### <kbd>method</kbd> `load_project`
57+
58+
```python
59+
load_project(
60+
project_registry_path: str,
61+
query_param: Optional[dict] = None
62+
) → Project
63+
```
64+
65+
Load peppy project from PEPhub in peppy.Project object
66+
67+
68+
- :param project_registry_path: registry path of the project
69+
70+
- :param query_param: query parameters used in get request :return Project: peppy project.
71+
72+
---
73+
74+
75+
### <kbd>method</kbd> `load_raw_pep`
76+
77+
```python
78+
load_raw_pep(registry_path: str, query_param: Optional[dict] = None) → dict
79+
```
80+
81+
Request PEPhub and return the requested project as peppy.Project object.
82+
83+
84+
- :param registry_path: Project namespace, eg. "geo/GSE124224:tag"
85+
- :param query_param: Optional variables to be passed to PEPhub :return: Raw project in dict.
86+
87+
---
88+
89+
90+
### <kbd>method</kbd> `login`
91+
92+
```python
93+
login() → NoReturn
94+
```
95+
96+
Log in to PEPhub
97+
98+
---
99+
100+
101+
### <kbd>method</kbd> `logout`
102+
103+
```python
104+
logout() → NoReturn
105+
```
106+
107+
Log out from PEPhub
108+
109+
---
110+
111+
112+
### <kbd>method</kbd> `pull`
113+
114+
```python
115+
pull(
116+
project_registry_path: str,
117+
force: Optional[bool] = False,
118+
zip: Optional[bool] = False,
119+
output: Optional[str] = None
120+
) → None
121+
```
122+
123+
Download project locally
124+
125+
126+
- :param str project_registry_path: Project registry path in PEPhub (e.g. databio/base:default)
127+
- :param bool force: if project exists, overwrite it.
128+
- :param bool zip: if True, save project as zip file
129+
- :param str output: path where project will be saved :return: None
130+
131+
---
132+
133+
134+
### <kbd>method</kbd> `push`
135+
136+
```python
137+
push(
138+
cfg: str,
139+
namespace: str,
140+
name: Optional[str] = None,
141+
tag: Optional[str] = None,
142+
is_private: Optional[bool] = False,
143+
force: Optional[bool] = False
144+
) → None
145+
```
146+
147+
Push (upload/update) project to Pephub using config/csv path
148+
149+
150+
- :param str cfg: Project config file (YAML) or sample table (CSV/TSV) with one row per sample to constitute project
151+
- :param str namespace: namespace
152+
- :param str name: project name
153+
- :param str tag: project tag
154+
- :param bool is_private: Specifies whether project should be private [Default= False]
155+
- :param bool force: Force push to the database. Use it to update, or upload project. [Default= False] :return: None
156+
157+
---
158+
159+
160+
### <kbd>method</kbd> `upload`
161+
162+
```python
163+
upload(
164+
project: Project,
165+
namespace: str,
166+
name: str = None,
167+
tag: str = None,
168+
is_private: bool = False,
169+
force: bool = True
170+
) → None
171+
```
172+
173+
Upload peppy project to the PEPhub.
174+
175+
176+
- :param peppy.Project project: Project object that has to be uploaded to the DB
177+
- :param namespace: namespace
178+
- :param name: project name
179+
- :param tag: project tag
180+
- :param force: Force push to the database. Use it to update, or upload project.
181+
- :param is_private: Make project private
182+
- :param force: overwrite project if it exists :return: None
183+
184+
185+
186+
187+
---
188+
189+
_This file was automatically generated via [lazydocs](https://github.com/ml-tooling/lazydocs)._

0 commit comments

Comments
 (0)