From ab42aa32bea2171136f33b59e2f2de26b98153ed Mon Sep 17 00:00:00 2001 From: Alhanouf-Altuwayjiri <112920623+Alhanouf-Altuwayjiri@users.noreply.github.com> Date: Sun, 11 Sep 2022 21:02:55 -0400 Subject: [PATCH 1/3] Create #Tool type call.py Call biotool type code --- data_tests/#Tool type call.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 data_tests/#Tool type call.py diff --git a/data_tests/#Tool type call.py b/data_tests/#Tool type call.py new file mode 100644 index 0000000..4e0a5dc --- /dev/null +++ b/data_tests/#Tool type call.py @@ -0,0 +1,14 @@ +#Tool type call +#the needed package to use JSON +import requests +# ask the user for tool name +inp=input("Tool Name?") +#use the templet http and add the tool name to it +x="https://bio.tools/api/t/?biotoolsID=%22%22&format=json" +y=x[:39]+inp+x[39:] +#reterive all the information about The input tool name and store them in the result +result=requests.get((y)) +# change it from JSON to Python Dictionary +dic=result.json() +#print the tool type for the used tool name +print(dic['list'][0]['toolType']) \ No newline at end of file From 5c82514307ddf76a66d74c27d2602d357ed9b85c Mon Sep 17 00:00:00 2001 From: Alhanouf-Altuwayjiri <112920623+Alhanouf-Altuwayjiri@users.noreply.github.com> Date: Mon, 19 Sep 2022 11:33:49 -0400 Subject: [PATCH 2/3] Update #Tool type call.py --- data_tests/#Tool type call.py | 29 ++++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/data_tests/#Tool type call.py b/data_tests/#Tool type call.py index 4e0a5dc..e6b9b7f 100644 --- a/data_tests/#Tool type call.py +++ b/data_tests/#Tool type call.py @@ -1,14 +1,29 @@ -#Tool type call +# Alhanouf Altuwayjiri #the needed package to use JSON import requests # ask the user for tool name -inp=input("Tool Name?") +def ToolType(inp): #use the templet http and add the tool name to it -x="https://bio.tools/api/t/?biotoolsID=%22%22&format=json" -y=x[:39]+inp+x[39:] + x="https://bio.tools/api/t/?format=json&q=&sort=score" + + LINK=x[:39]+inp+x[39:] + #reterive all the information about The input tool name and store them in the result -result=requests.get((y)) + result=requests.get((LINK)) # change it from JSON to Python Dictionary -dic=result.json() + dic=result.json() #print the tool type for the used tool name -print(dic['list'][0]['toolType']) \ No newline at end of file + + typet=[] + for i,key in enumerate(dic['list']): + x=(dic['list'][i]['function'][0]['operation']) + for r,key in enumerate(x): + y=(dic['list'][i]['function'][0]['operation'][r]['term']) + typet.append(y) + + h=(set(typet)) + final=typet + for i in h: + final.remove(i) + + return set(final) \ No newline at end of file From 02542e593650f4ddc69c0d591b8e0f69c03e54cf Mon Sep 17 00:00:00 2001 From: Alhanouf-Altuwayjiri <112920623+Alhanouf-Altuwayjiri@users.noreply.github.com> Date: Fri, 14 Oct 2022 13:38:44 -0400 Subject: [PATCH 3/3] Create import requests.py --- bcotool/import requests.py | 56 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 bcotool/import requests.py diff --git a/bcotool/import requests.py b/bcotool/import requests.py new file mode 100644 index 0000000..0e42c00 --- /dev/null +++ b/bcotool/import requests.py @@ -0,0 +1,56 @@ +import requests + +def tooltype2(x,y): # function that will return the tool type from ELIXIR databases + + l="https://bio.tools/api/t/?biotoolsID=%22%22&format=json" # The http used to reterive info + + LINK = l[:39]+x+l[39:] # add the input to the http link + LINK2 = l[:39]+y+l[39:] + + + result = requests.get((LINK)) #reterive all the information about The input tool name and store them in the result + result2 = requests.get((LINK2)) + + dic=result.json() # change it from JSON to Python Dictionary + dic2=result2.json() + + if dic['count']>1: # if there is more than one tool with the same name + typet = [] + for i,key in enumerate(dic['list']): + x = (dic['list'][i]['function'][0]['operation']) + for r,key in enumerate(x): + y = (dic['list'][i]['function'][0]['operation'][r]['term']) + typet.append(y) + + h = (set(typet)) + final = typet + for i in h: # go over the two tools and find the similarity + final.remove(i) + else: # if only one tool has the same name + typet = [] + for r,key in enumerate(dic['list'][0]['function'][0]['operation']): + y = (dic['list'][0]['function'][0]['operation'][r]['term']) + typet.append(y) + final = typet + if dic2['count']>1: + typet = [] + for i,key in enumerate(dic2['list']): + x = (dic2['list'][i]['function'][0]['operation']) + for r,key in enumerate(x): + y = (dic2['list'][i]['function'][0]['operation'][r]['term']) + typet.append(y) + + h = (set(typet)) + final2 = typet + for i in h: + final2.remove(i) + else: + typet = [] + for r,key in enumerate(dic2['list'][0]['function'][0]['operation']): + y = (dic2['list'][0]['function'][0]['operation'][r]['term']) + typet.append(y) + final2 = typet + res = [x for x in final + final2 if x in final + and x in final2] # go over the two tools and find the similarity + + return set(res)