Skip to content

Commit 986e459

Browse files
authored
Merge pull request #13 from biocompute-objects/dev
Long overdue updates to main
2 parents e93c675 + 9852c25 commit 986e459

26 files changed

+1945
-30
lines changed

.gitignore

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
cwl_run/*
2-
.DS_Store
3-
tests/notes.txt
4-
error.log
2+
*.DS_Store
3+
error.log
4+
.bco_env/
5+
home
6+
.python-version
7+
.vscode/

README.md

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,31 @@ This is a Command Line Tool that allows for the manipulation of [BioCompute Obje
77

88
Run the Git Clone command in the location you would like the repostory:
99

10-
1. `cd path/to/my/github/repositories`
10+
1. Choose location for repository
1111

12-
2. `git clone https://github.com/HadleyKing/bco-tool.git`
12+
cd path/to/my/github/repositories
1313

14-
Add the main bco-tool program to your path
14+
2. Clone repo
1515

16-
4. `cd bco-tool`
16+
git clone https://github.com/biocompute-objects/bcotool.git
1717

18-
5. `pip install -r requirements.txt`
18+
### To add the main bco-tool program to your path
1919

20-
6. `cp bco-tool/bco_runner.py /usr/local/bin/bco`
20+
4. Enter directory
21+
22+
cd bcotool
23+
24+
5. Create and/or activate a [python virtual environment](https://virtualenv.pypa.io/en/latest/user_guide.html):
25+
26+
virtualenv [path_to_environment]
27+
28+
5. Install requirements in the virtual environment
29+
30+
pip install -r requirements.txt
31+
32+
6. Copy the exicutable program file to the user local bin:
33+
34+
cp bco-tool/bco_runner.py /usr/local/bin/bco
2135

2236

2337
## Supported modes

bco-tool/library/__init__.py

Whitespace-only changes.
File renamed without changes.

bcotool/__init__.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
"""
2+
bco app and stuff
3+
"""
4+
5+
from .bcoutils import *
6+
from .validate import *

bcotool/apitest.py

Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
#!/usr/bin/env python3
2+
# -*- coding: utf-8 -*-
3+
4+
#bcotool
5+
6+
import requests
7+
import json
8+
9+
import bcoutils
10+
11+
#______________________________________________________________________________#
12+
def update_bco():
13+
"""
14+
15+
"""
16+
bco = '/Users/hadleyking/GitHub/hadleyking/bcotool/data_tests/cwl-blastn-homologs.json'
17+
18+
headers = {'Content-type': 'application/json; charset=UTF-8'}
19+
bco_dict = bcoutils.load_bco(bco)
20+
21+
creator = {
22+
'POST_create_new_object':[
23+
{
24+
'object_id': 'https://beta.portal.aws.biochemistry.gwu.edu/BCO_31/1.0',
25+
'table': 'bco_publish',
26+
'schema': 'IEEE',
27+
'contents': bco_dict,
28+
'state': 'PUBLISHED'
29+
}
30+
]
31+
}
32+
creator = json.dumps(creator)
33+
34+
r = requests.post(
35+
'https://beta.portal.aws.biochemistry.gwu.edu/bco/objects/create/',
36+
data = creator, verify=False, headers=headers)
37+
38+
return (r.text)
39+
#______________________________________________________________________________#
40+
def publish_bco():
41+
"""
42+
43+
"""
44+
bco = '/Users/hadleyking/GitHub/hadleyking/bcotool/data_tests/cwl-blastn-homologs.json'
45+
46+
headers = {'Content-type': 'application/json; charset=UTF-8'}
47+
bco_dict = bcoutils.load_bco(bco)
48+
49+
creator = {
50+
'POST_create_new_object':[
51+
{
52+
'table': 'bco_publish',
53+
'schema': 'IEEE',
54+
'contents': bco_dict,
55+
'state': 'PUBLISHED'
56+
}
57+
]
58+
}
59+
creator = json.dumps(creator)
60+
61+
r = requests.post(
62+
'https://beta.portal.aws.biochemistry.gwu.edu/bco/objects/create/',
63+
data = creator, verify=False, headers=headers)
64+
65+
return (r.text
66+
)
67+
68+
#______________________________________________________________________________#
69+
def read_bco():
70+
"""
71+
72+
"""
73+
74+
headers = {'Content-type': 'application/json; charset=UTF-8'}
75+
76+
req_list = [
77+
('bco_draft', 'https://beta.portal.aws.biochemistry.gwu.edu/BCO_DRAFT_706f97bdcafa4cd89056fbbfc9d5d325'),
78+
('bco_publish', 'https://beta.portal.aws.biochemistry.gwu.edu/BCO_3/1.0')
79+
]
80+
81+
req_dict = {}
82+
req_dict['POST_read_object'] = []
83+
84+
for i in req_list:
85+
print(i[0])
86+
req_dict['POST_read_object'].append(
87+
{
88+
'table': i[0],
89+
'object_id': i[1]
90+
}
91+
)
92+
# reader = {
93+
# 'POST_read_object':[
94+
# {
95+
# 'table': 'bco_draft',
96+
# 'object_id': 'https://beta.portal.aws.biochemistry.gwu.edu/BCO_DRAFT_706f97bdcafa4cd89056fbbfc9d5d325'
97+
# },
98+
# {
99+
# 'table': 'bco_publish',
100+
# 'object_id': 'https://beta.portal.aws.biochemistry.gwu.edu/BCO_3/1.0'
101+
# }
102+
# ]
103+
# }
104+
print(req_dict)
105+
106+
107+
read = json.dumps(req_dict)
108+
109+
r = requests.post(
110+
'https://beta.portal.aws.biochemistry.gwu.edu/bco/objects/read/',
111+
data = read, verify=False, headers=headers)
112+
113+
return (r.text)
114+
115+
#______________________________________________________________________________#
116+
def main():
117+
# resp = read_bco()
118+
resp = publish_bco()
119+
resp = update_bco()
120+
print(resp)
121+
#______________________________________________________________________________#
122+
if __name__ == "__main__":
123+
main()

0 commit comments

Comments
 (0)