-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
all the pages miRBase integration nupack image requesting
- Loading branch information
Showing
11 changed files
with
98,535 additions
and
49 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import requests | ||
|
||
with open("mature.fa", 'wb') as f: | ||
f.write(requests.get("https://mirbase.org/download/mature.fa").content) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import requests | ||
|
||
def getSVG(struc): | ||
postURL = "https://old.nupack.org/design/update_input_preview" | ||
postURL2 = "https://old.nupack.org/design/draw_multi_preview" | ||
input = struc | ||
|
||
payload = { | ||
"structure": input, | ||
"preview_token": "cL7VXwyBgh", | ||
"material": "rna" | ||
} | ||
|
||
print(payload) | ||
|
||
req = requests.post(postURL, data=payload) | ||
|
||
if req.status_code == 200: | ||
|
||
print("req1 success!") | ||
tagval = req.text.split("$('multi_tag').value = ")[1].split('"')[1] | ||
|
||
req2 = requests.post(postURL2, data={"tagval": tagval}) | ||
|
||
if req2.status_code == 200: | ||
|
||
print("req2 success!!") | ||
getURL = "https://old.nupack.org/" + req2.text.split("src=")[-1].split("/></td></tr>")[0][1:-12] | ||
print(getURL) | ||
|
||
req3 = requests.get(getURL) | ||
|
||
if req3.status_code == 200: | ||
|
||
print("req3 success!!!") | ||
|
||
with open("structure.png", "wb") as output: | ||
output.write(req3.content) | ||
|
||
# with open("structureSVG.svg", "r") as output: | ||
# output = open("structureSVG.svg", "r") | ||
# fileLen = len(open("structureSVG.svg", "r").readlines()) | ||
# lines = open("structureSVG.svg", "r").readlines() | ||
|
||
# svgKeySpan = list(range(fileLen-78, fileLen-2)) | ||
# # to remove the label on the side of svg, delete all code from "<g id="axes2">" UP TO AND INCLUDING THE SECOND TO LAST "</g>", 76 lines | ||
|
||
# with open("structureSVG.svg", "w") as output: | ||
# for i, line in enumerate(lines): | ||
# if i not in svgKeySpan: | ||
# output.write(line) |
Oops, something went wrong.