Skip to content

Commit

Permalink
added a buch of stuff:
Browse files Browse the repository at this point in the history
all the pages
miRBase integration
nupack image requesting
  • Loading branch information
Rishbong committed Aug 21, 2023
1 parent 9ce1ff1 commit 67c4230
Show file tree
Hide file tree
Showing 11 changed files with 98,535 additions and 49 deletions.
243 changes: 206 additions & 37 deletions app.py

Large diffs are not rendered by default.

Binary file modified complex.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions getMiRBase.py
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)
51 changes: 51 additions & 0 deletions getSVG.py
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)
Loading

0 comments on commit 67c4230

Please sign in to comment.