Git Lab CI for docker build enabled! You can enable it using .gitlab-ci.yml in your project. Check file template at https://gitlab.bio.di.uminho.pt/snippets/5

Commit 28a0c8eb authored by Davide Lagoa's avatar Davide Lagoa

database queries integration to website

parent a56634d7
......@@ -3,5 +3,6 @@ RUN mkdir /configs
COPY ./configs /configs
COPY ./code /home
WORKDIR /workdir
RUN pip install neo4j-driver==1.3.1
EXPOSE 80
CMD ["python", "/home/workersManager.py"]
......@@ -10,6 +10,7 @@ import logging
import re
import time
import requests
from transyt_request import database_retriever_by_id
CONFIGURATIONS = FilesUtilities.read_conf_file('/configs/docker_config.conf')
......@@ -29,7 +30,6 @@ logger = logging.getLogger(__name__)
logger.addHandler(handler)
logger.setLevel(logging.DEBUG)
logger.info("Docker configurations: " + str(CONFIGURATIONS))
logger.info('Starting server')
......@@ -46,6 +46,7 @@ last_submission_ID = 0
print('SERVER WORKING')
@app.after_request
def after_request(response):
response.headers["Cache-Control"] = "no-cache, no-store, must-revalidate, public, max-age=0"
......@@ -53,6 +54,7 @@ def after_request(response):
response.headers["Pragma"] = "no-cache"
return response
@app.route("/")
def index():
logger.info('Welcome page rendering...')
......@@ -93,20 +95,6 @@ def submitMerlinPlugin(taxonomyId):
return run(files, taxonomyId, True)
@app.route("/reaction/<reactionId>", methods=["GET"])
def getReactionInfo(reactionId):
pattern = re.compile("^TR\d{6}")
patternFound = bool(pattern.match(reactionId))
if patternFound:
return jsonify({"Result": "Success",
"Purpose": "Future page for transyt reaction " + reactionId}), 200
else:
logger.info('Bad request to get reaction. Request done: ' + reactionId)
return jsonify({"Result": "Bad request, page does not exist!"}), 400
def run(files, taxonomyId, isRest):
logger.debug('New submission in progress...')
......@@ -266,8 +254,9 @@ def display_msg(submissionID, isRest):
def download(submissionID):
logger.debug("Request to download submission " + submissionID + " results")
timestr = time.strftime("%Y%m%d_%H%M%S")
return send_file(RESULTS_PATH + submissionID + "/results" + timestr + ".zip", as_attachment=True,
attachment_filename='results.zip')
return send_file(RESULTS_PATH + submissionID + "/results.zip", as_attachment=True,
attachment_filename='results' + timestr + '.zip')
@app.route("/debug/logs/<level>")
def logsRetriever(level):
......@@ -287,7 +276,7 @@ def logsRetriever(level):
os.makedirs(saveFilesPath)
#implement service here when running
# implement service here when running
if level == 'manager':
logger.info("Collecting manager logs.")
......@@ -340,6 +329,52 @@ def getWorkersLogs(savePath):
logger.debug("Worker " + host + " not alive!")
@app.route('/reactions/<reactionId>')
def reactions(reactionId):
pattern = re.compile("^T[A-Z]\d{7}")
patternFound = bool(pattern.match(reactionId))
if patternFound:
results_dict = result_parser(reactionId)
if results_dict:
return render_template("record.html", subId=reactionId, dictt=results_dict), 200
return render_template("noresutls.html", subId=reactionId), 200
@app.template_filter('enumerate_items')
def enumerate_items(*args, **kwargs):
return enumerate(*args, **kwargs)
def result_parser(id):
databases, tc_systems, reactionID, metaID, reaction, metabolites = database_retriever_by_id(id)
if not metabolites:
return None
tc_systems2 = {}
for tc in tc_systems:
tc_elements = tc.split('@')
if tc_elements[0] in tc_systems2:
tc_systems2[tc_elements[0]].append(tc_elements[1])
else:
tc_systems2[tc_elements[0]] = [tc_elements[1]]
res_dict = {'databases': databases,
'tc_systems': tc_systems2,
'reactionID': reactionID,
'metaID': metaID,
'reaction': reaction,
'metabolites': metabolites}
return res_dict
def countEntriesBelow(l, id):
id = int(id)
res = 0
......
from neo4j.v1 import GraphDatabase
class neo4jPythonDriver:
###### CONSTRUCTOR ######
def __init__(self, uri, user, password):
self.__uri = uri
self.__user = user
self.__password = password
self.__driver = self.__initDriver()
def __initDriver(self):
return GraphDatabase.driver(self.__getUri(), auth=(self.__getUser(), self.__getPassword()))
def initSession(self):
return self.__driver.session()
def __getUri(self):
return self.__uri
def __getUser(self):
return self.__user
def __getPassword(self):
return self.__password
def __getDriver(self):
return self.__driver
def __setUri(self, value):
self.__uri = value
def __setUser(self, value):
self.__user = value
def __setPassword(self, value):
self.__password = value
def __setDriver(self, value):
self.__driver = value
#aspect-content {
margin: 10px 10px 0px 10px;
font-family: 'Oxygen';
}
.tab-element {
position: relative;
width: 90%;
margin: 0 auto 10px;
border-radius: 4px;
background-color: #ffffff;
box-shadow: 3px -1px 5px 3px #bdc3c7;
opacity: 1;
transition: box-shadow .2s, opacity .4s;
}
.tab-element:hover {
box-shadow: 0 4px 10px 0 rgba(0, 0, 0, .11);
}
.inner-tab-element {
position: relative;
width: 100%;
border-radius: 4px;
background-color: #34495e;
box-shadow: 3px -1px 5px 3px #bdc3c7;
opacity: 1;
transition: box-shadow .2s, opacity .4s;
}
.inner-tab-element:hover {
box-shadow: 0 4px 10px 0 rgba(0, 0, 0, .11);
}
.outer-input {
display: none;
}
.inner-input {
display: none;
}
.outer-input:checked ~ .outer-label-content + .dropdown-content-outer-wrapper {
max-height: 8000px;
}
.outer-input:checked ~ .outer-label-content:after {
transform: rotate(0);
}
.inner-input:checked ~ .outer-label-content + .dropdown-content-outer-wrapper {
max-height: 8000px;
}
.inner-input:checked ~ .outer-label-content:after {
transform: rotate(0);
}
.outer-input:checked ~ .inner-label-content + .dropdown-content-outer-wrapper {
max-height: 8000px;
}
.outer-input:checked ~ .inner-label-content:after {
transform: rotate(0);
}
.inner-input:checked ~ .inner-label-content + .dropdown-content-outer-wrapper {
max-height: 8000px;
}
.inner-input:checked ~ .inner-label-content:after {
transform: rotate(0);
}
.outer-label {
position: absolute;
top: 0;
left: 0;
height: 100%;
max-height: 50px;
width: 100%;
margin: 0;
padding: 0;
font-size: 0;
z-index: 1;
cursor: pointer;
}
.inner-label {
position: absolute;
top: 0;
left: 0;
height: 100%;
max-height: 50px;
width: 100%;
margin: 0;
padding: 0;
font-size: 0;
z-index: 1;
cursor: pointer;
}
.outer-label-content {
position: relative;
display: block;
height: 50px;
margin: 0;
padding: 0;
font-size: 0;
white-space: nowrap;
cursor: pointer;
}
.outer-label-content:before {
content: '';
display: inline-block;
vertical-align: middle;
height: 100%;
}
.outer-label-content:after {
content: '';
display: inline-block;
vertical-align: middle;
position: absolute;
width: 24px;
height: 100%;
right: 30px;
background-image: url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0Ij4KICAgIDxnIGZpbGw9Im5vbmUiIGZpbGwtcnVsZT0iZXZlbm9kZCI+CiAgICAgICAgPHBhdGggZD0iTTI0IDI0SDBWMGgyNHoiIG9wYWNpdHk9Ii44NyIvPgogICAgICAgIDxwYXRoIGZpbGw9IiNBOUFDQUYiIGZpbGwtcnVsZT0ibm9uemVybyIgZD0iTTE1Ljg4IDE1LjI5TDEyIDExLjQxbC0zLjg4IDMuODhhLjk5Ni45OTYgMCAxIDEtMS40MS0xLjQxbDQuNTktNC41OWEuOTk2Ljk5NiAwIDAgMSAxLjQxIDBsNC41OSA0LjU5Yy4zOS4zOS4zOSAxLjAyIDAgMS40MS0uMzkuMzgtMS4wMy4zOS0xLjQyIDB6Ii8+CiAgICA8L2c+Cjwvc3ZnPgo=');
background-repeat: no-repeat;
background-position: center;
transform: rotate(180deg);
}
.outer-label-content + .dropdown-content-outer-wrapper {
max-height: 0;
overflow: hidden;
transition: max-height .3s;
}
.outer-label-content > div {
display: inline-block;
vertical-align: middle;
}
.inner-label-content {
position: relative;
display: block;
height: 50px;
margin: 0;
padding: 0;
font-size: 0;
white-space: nowrap;
cursor: pointer;
}
.inner-label-content:before {
content: '';
display: inline-block;
vertical-align: middle;
height: 100%;
}
.inner-label-content:after {
content: '';
display: inline-block;
vertical-align: middle;
position: absolute;
width: 24px;
height: 100%;
right: 30px;
background-image: url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0Ij4KICAgIDxnIGZpbGw9Im5vbmUiIGZpbGwtcnVsZT0iZXZlbm9kZCI+CiAgICAgICAgPHBhdGggZD0iTTI0IDI0SDBWMGgyNHoiIG9wYWNpdHk9Ii44NyIvPgogICAgICAgIDxwYXRoIGZpbGw9IiNBOUFDQUYiIGZpbGwtcnVsZT0ibm9uemVybyIgZD0iTTE1Ljg4IDE1LjI5TDEyIDExLjQxbC0zLjg4IDMuODhhLjk5Ni45OTYgMCAxIDEtMS40MS0xLjQxbDQuNTktNC41OWEuOTk2Ljk5NiAwIDAgMSAxLjQxIDBsNC41OSA0LjU5Yy4zOS4zOS4zOSAxLjAyIDAgMS40MS0uMzkuMzgtMS4wMy4zOS0xLjQyIDB6Ii8+CiAgICA8L2c+Cjwvc3ZnPgo=');
background-repeat: no-repeat;
background-position: center;
transform: rotate(180deg);
}
.inner-label-content + .dropdown-content-outer-wrapper {
max-height: 0;
overflow: hidden;
transition: max-height .3s;
}
.inner-label-content > div {
display: inline-block;
vertical-align: middle;
}
.aspect-info {
width: 100%;
white-space: nowrap;
font-size: 0;
}
.aspect-info:before {
content: '';
display: inline-block;
vertical-align: middle;
}
.aspect-name {
display: inline-block;
width: 33%;
max-height: 22px;
color: #000000;
text-align: left;
vertical-align: middle;
font-size: 16px;
margin: 0 0 0 20px;
}
.aspect-name > p {
display: inline-block;
font-size: 16px;
}
.aspect-name > a {
display: inline-block;
}
.dropdown-content-outer-wrapper {
background-color: #ecf0f1;
font-size: 0;
text-align: justify;
}
.inner-tab-element-wrapper {
padding: 10px 10px 10px 10px;
}
.inner-inner-tab-element-wrapper {
padding: 10px 10px 10px 10px;
display: flex;
flex-wrap: wrap;
}
.inner-inner-tab-element-wrapper > div {
display: inline-block;
width: 100%;
height: 100%;
flex: 0 0 20%
}
.inner-inner-tab-element-wrapper > div > div {
width: 100%;
height: 100%;
padding: 10px 10px 10px 10px;
background-color: #ecf0f1;
text-align: left;
}
.content {
position: relative;
width: 100%;
font-size: 13px;
color: #2c3e50;
}
.external-links-button {
display: inline-block;
background: none;
padding: 10px;
margin: 10px;
cursor:pointer;
border: 2px solid #2c3e50;
border-radius: 10px;
}
.external-links-button:hover {
display: inline-block;
background: #2c3e50;
transition: 0.5s;
}
.external-links-button >p {
margin: 0;
color: #2c3e50;
}
.external-links-button:hover >p {
margin: 0;
color: #ffffff;
transition: 0.5s;
}
.inner-external-links-title {
padding-bottom: 15px;
}
.inner-external-links-title >a {
font-size: 16px;
color: #2980b9;
}
.inner-external-links-title:hover >a {
text-decoration: underline;
cursor: pointer;
color: #95a5a6;
}
.inner-external-links {
display: inline-block;
background: none;
padding: 10px;
margin: 10px;
border: 1px solid #95a5a6;
border-radius: 10px;
width: 90%;
}
.inner-external-links >div{
vertical-align: middle;
display: flex;
flex-wrap: wrap;
margin-left: 5%;
width: 80%;
}
.inner-external-links >div >div {
flex: 0 0 33%;
vertical-align: middle;
}
.par-inner-external-links {
vertical-align: middle;
margin: 10px;
font-size: 14px;
color: #95a5a6;
display: inline-block;
}
.external-links-button-close {
padding:10px 0 10px 50%;
margin: 0;
cursor: pointer;
align-content: center;
}
......@@ -2,7 +2,6 @@
.center {
margin: auto;
width: 60%;
border: 3px solid #000066;
padding: 10px;
word-wrap: break-word;
font-family: 'Oxygen';
......@@ -22,6 +21,14 @@
font-size: 20px;
}
.center h4 {
color: black;
font-family: 'Oxygen';
font-size: 18px;
}
.center p {
......@@ -35,3 +42,47 @@
font-family: 'Oxygen';
}
.center-download {
margin: auto;
width: 90%;
padding: 20px;
word-wrap: break-word;
font-family: 'Oxygen';
}
.center-download h1 {
color: black;
font-family: 'Oxygen';
font-size: 28px;
}
.center-download h3 {
color: black;
font-family: 'Oxygen';
font-size: 20px;
}
.center-download h4 {
color: black;
font-family: 'Oxygen';
font-size: 18px;
}
.center-download p {
color: black;
font-family: 'Oxygen';
}
.center-download li {
color: black;
font-family: 'Oxygen';
}
.footer{
text-align: center;
font-family: Oxygen;
padding: 40px 10% 40px 10%;
display: flex;
flex-wrap: wrap;
max-width: 100%;
height: 150px;
}
.footer a {
max-height: 100%;
max-width: 100%;
}
.footer img {
max-height: 80%;
max-width: 80%;
}
.footer table {
border: 0;
width: 100%;
max-width: 100%;
}
.footer th {
border: 0;
text-align: center;
width: 25%;
}
\ No newline at end of file
.search_bar {
display: -ms-flexbox;
display: flex;
-ms-flex-pack: center;
justify-content: center;
-ms-flex-align: center;
align-items: center;
font-family: 'Oxygen';
max-width: 450px;
}
.search_bar form {
width: 100%;
max-width: 450px;
margin-bottom: 0;
}
.search_bar form .inner-form {
background: #fff;
display: -ms-flexbox;
display: flex;
width: 100%;
-ms-flex-pack: justify;
justify-content: space-between;
-ms-flex-align: center;
align-items: center;
box-shadow: 20px 8px 20px 8px rgba(0, 0, 0, 0.15);
}
.search_bar form .inner-form .input-field {
height: 60px;
}
.search_bar form .inner-form .input-field input {
height: 100%;
background: transparent;
border: 0;
display: block;
width: 100%;
padding: 10px 10px;
font-size: 16px;
color: #555;
}
.search_bar form .inner-form .input-field input[type=file] {
display: none;
}
.search_bar form .inner-form .input-field input[type=submit] {
display: none;
}
.search_bar form .inner-form .input-field input.placeholder {
color: #888;
font-size: 16px;
}
.search_bar form .inner-form .input-field input:-moz-placeholder {
color: #888;
font-size: 16px;
}
.search_bar form .inner-form .input-field input::-webkit-input-placeholder {
color: #888;
font-size: 16px;
}
.search_bar form .inner-form .input-field input:hover, .search_bar form .inner-form .input-field input:focus {
box-shadow: none;
outline: 0;
border-color: #fff;
}
.search_bar form .inner-form .input-field.first-wrap {
-ms-flex-positive: 1;
flex-grow: 1;
}
.search_bar form .inner-form .input-field.second-wrap {
-ms-flex-positive: 1;
flex-grow: 1;
}
.search_bar form .inner-form .input-field.second-wrap.custom-file-upload {
padding: 18px;
color: gray;
background-color: #ffffff;
cursor: pointer;
font-weight: lighter;
font-size: 18px;
}
.search_bar form .inner-form .input-field.third-wrap {
-ms-flex-positive: 1;
flex-grow: 1;
}
.search_bar form .inner-form .input-field.third-wrap.custom-file-upload {
padding: 18px;
color: gray;
background-color: #ffffff;
cursor: pointer;
font-weight: lighter;
font-size: 18px;
}
.search_bar form .inner-form .input-field.fourth-wrap {
-ms-flex-positive: 1;
flex-grow: 1;
}
.search_bar form .inner-form .input-field.fourth-wrap.custom-file-upload {
padding: 14px;
background-color: #27ae60;
color: #ffffff;
font-weight: bold;
font-size: 22px;
cursor: pointer;
.submit-form {
display: -ms-flexbox;
display: flex;
-ms-flex-pack: center;
justify-content: center;
-ms-flex-align: center;
align-items: center;
font-family: 'Oxygen';
max-width: 450px;
}
.submit-form form {
width: 100%;
max-width: 450px;
margin-bottom: 0;
}
.submit-form form .inner-form {
background: #fff;
display: -ms-flexbox;
display: flex;
width: 100%;
-ms-flex-pack: justify;
justify-content: space-between;
-ms-flex-align: center;
align-items: center;
box-shadow: 20px 8px 20px 8px rgba(0, 0, 0, 0.15);
}
.submit-form .inner-form {
background: #fff;
display: -ms-flexbox;
display: flex;
width: 100%;
-ms-flex-pack: justify;
justify-content: space-between;
-ms-flex-align: center;
align-items: center;
box-shadow: 20px 8px 20px 8px rgba(0, 0, 0, 0.15);
}
.submit-form form .inner-form .input-field {
height: 60px;
}
.submit-form form .inner-form .input-field input {
height: 100%;
background: transparent;
border: 0;
display: block;
width: 100%;
padding: 10px 10px;
font-size: 16px;
color: #555;
}
.submit-form .inner-form .input-field button {
height: 100%;
background: transparent;
border: 0;
display: block;
width: 100%;
padding: 10px 10px;
font-size: 16px;
color: #555;
}
.submit-form .inner-form .input-field button[type=button] {
display: none;
}
.submit-form form .inner-form .input-field input[type=file] {
display: none;
}
.submit-form form .inner-form .input-field input[type=submit] {
display: none;
}
.submit-form form .inner-form .input-field input.placeholder {
color: #888;
font-size: 16px;
}
.submit-form form .inner-form .input-field input:-moz-placeholder {
color: #888;
font-size: 16px;
}
.submit-form form .inner-form .input-field input::-webkit-input-placeholder {
color: #888;
font-size: 16px;
}
.submit-form form .inner-form .input-field input:hover, .submit-form form .inner-form .input-field input:focus {
box-shadow: none;
outline: 0;
border-color: #fff;
}
.submit-form .inner-form .input-field button:hover, .submit-form .inner-form .input-field button:focus {
box-shadow: none;
outline: 0;
border-color: #fff;
}
.submit-form form .inner-form .input-field.first-wrap {
-ms-flex-positive: 1;
flex-grow: 1;
}
.submit-form form .inner-form .input-field.second-wrap {
-ms-flex-positive: 1;
flex-grow: 1;
}
.submit-form form .inner-form .input-field.second-wrap.custom-file-upload {
padding: 18px;
color: gray;
background-color: #ffffff;
cursor: pointer;
font-weight: lighter;
font-size: 18px;
}
.submit-form form .inner-form .input-field.third-wrap {
-ms-flex-positive: 1;
flex-grow: 1;
}
.submit-form form .inner-form .input-field.third-wrap.custom-file-upload {
padding: 18px;
color: gray;
background-color: #ffffff;
cursor: pointer;
font-weight: lighter;
font-size: 18px;
}
.submit-form form .inner-form .input-field.fourth-wrap {
-ms-flex-positive: 1;
flex-grow: 1;
}
.submit-form form .inner-form .input-field.fourth-wrap.custom-file-upload {
padding: 14px;
background-color: #27ae60;
color: #ffffff;
font-weight: bold;
font-size: 22px;
cursor: pointer;
}
.submit-form .inner-form .input-field.fourth-wrap {
-ms-flex-positive: 1;
flex-grow: 1;
}
.submit-form .inner-form .input-field.fourth-wrap.custom-button {
padding: 14px;
background-color: #27ae60;
color: #ffffff;
font-weight: bold;
font-size: 22px;
cursor: pointer;
}
.submit-form .inner-form .input-field.fourth-wrap.custom-button {
padding: 14px;
background-color: #27ae60;
color: #ffffff;
font-weight: bold;
font-size: 22px;
cursor: pointer;
}
\ No newline at end of file
code/static/images/EENG.jpg

61.8 KB | W: | H:

code/static/images/EENG.jpg

7.21 KB | W: | H:

code/static/images/EENG.jpg
code/static/images/EENG.jpg
code/static/images/EENG.jpg
code/static/images/EENG.jpg
  • 2-up
  • Swipe
  • Onion skin
code/static/images/biodata_elixir.png

16.2 KB | W: | H:

code/static/images/biodata_elixir.png

22.9 KB | W: | H:

code/static/images/biodata_elixir.png
code/static/images/biodata_elixir.png
code/static/images/biodata_elixir.png
code/static/images/biodata_elixir.png
  • 2-up
  • Swipe
  • Onion skin
code/static/images/ceb1.png

132 KB | W: | H:

code/static/images/ceb1.png

11.9 KB | W: | H:

code/static/images/ceb1.png
code/static/images/ceb1.png
code/static/images/ceb1.png
code/static/images/ceb1.png
  • 2-up
  • Swipe
  • Onion skin
function showSubmit(event) {
document.getElementById( 'to-retrieve' ).style.display = 'none';
document.getElementById( 'to-submit' ).style.display = 'inline-block';
}
function showRetrieve(event) {
document.getElementById( 'to-submit' ).style.display = 'none';
document.getElementById( 'to-retrieve' ).style.display = 'inline-block';
}
function showExternal(event) {
document.getElementById( 'external-links' ).style.display = 'inline-block';
document.getElementById( 'external-links' ).style.padding = '25px';
document.getElementById( 'external-links' ).style.textAlign = 'left';
document.getElementById( 'external-links' ).style.width = '100%';
document.getElementById( 'external-links' ).style.boxShadow = '20px 8px 20px 8px rgba(0, 0, 0, 0.15)';
}
function closeExternal(event) {
document.getElementById( 'external-links' ).style.display = 'none';
}
function toggleTCsystems() {
if(document.getElementById('external-links').style.display == "none") { // if is menuBox displayed, hide it
document.getElementById('aspect-content').style.display = "none";
document.getElementById('external-links').style.display = "block";
}
else {
document.getElementById('external-links').style.display = "none";
}
}
function toggleMetabolites() {
if(document.getElementById('aspect-content').style.display == "none") { // if is menuBox displayed, hide it
document.getElementById('external-links').style.display = "none";
document.getElementById('aspect-content').style.width = "100%";
document.getElementById('aspect-content').style.display = "inline-block";
}
else {
document.getElementById('aspect-content').style.display = "none";
}
}
function toggleMenu2(id) {
if(document.getElementById(id).style.display == "none") { // if is menuBox displayed, hide it
document.getElementById(id).style.display = "block";
document.getElementById(id).style.padding = '10px';
document.getElementById(id).style.textAlign = 'left';
document.getElementById(id).style.width = '100%';
}
else {
document.getElementById(id).style.display = "none";
}
}
\ No newline at end of file
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>TranSyT</title>
<link rel="stylesheet" href="{{ url_for('static', filename='css/center.css') }}">
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap-theme.min.css">
<link href="//fonts.googleapis.com/css?family=Oxygen&subset=latin,latin-ext" rel="stylesheet" type="text/css">
<link rel="stylesheet" href="{{ url_for('static', filename='css/downloadButton.css') }}">
<body style="background: #fefcfe">
<div class="center" align="center" style="border: 0">
<h1><b>TranSyT </b></h1>
<br>
<br>
<img src="{{ url_for('static', filename = 'images/transportProtein.gif') }}" alt="Transport Protein">
<br>
<br>
<h3><b>The process is now concluded</b></h3>
<br>
<p>The result of submission {{subId}} is available for download</p>
<br>
<p>If you are having trouble downloading the results, please clean the cache of your browser and try again</p>
<p>If the problems persists, please try again with a different browser</p>
<br>
<a href="{{url_for('download', submissionID = subId)}}">
<button class="downloadBtn">Download</button>
</a>
<br>
<br>
<br>
<a href="{{url_for('index')}}"><b>Click here to perform another submission</b></a>
<br>
<br>
<br>
<br>
<br>
</div>
<div style="text-align: center; color: black; font-family: Oxygen">
<a href="{{url_for('index')}}"><b>TranSyT 2019</b></a>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<a href="https://www.eng.uminho.pt/en" target="_blank"> <img border="0" alt="School of Engineering" src="{{ url_for('static', filename = 'images/EENG.jpg') }}" width="90" height="60"></a>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<a href="https://www.ceb.uminho.pt/" target="_blank"> <img border="0" alt="Centre of Biological Engineering" src="{{ url_for('static', filename = 'images/ceb1.png') }}" width="130" height="105"></a>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<a href="https://www.elixir-portugal.org/" target="_blank"> <img border="0" alt="BioData" src="{{ url_for('static', filename = 'images/biodata_elixir.png') }}" width="235" height="30"></a>
<br>
<br>
</div>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>TranSyT</title>
<link rel="stylesheet" href="{{ url_for('static', filename='css/center.css') }}">
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap-theme.min.css">
<link href="//fonts.googleapis.com/css?family=Oxygen&subset=latin,latin-ext" rel="stylesheet" type="text/css">
<link rel="stylesheet" href="{{ url_for('static', filename='css/downloadButton.css') }}">
<body style="background: #fefcfe">
<div class="center" align="center" style="border: 0">
<h1><b>TranSyT </b></h1>
<br>
<br>
<img src="{{ url_for('static', filename = 'images/transportProtein.gif') }}" alt="Transport Protein">
<br>
<br>
<h3><b>The process is now concluded</b></h3>
<br>
<p>The result of submission {{subId}} is available for download</p>
<br>
<p>If you are having trouble downloading the results, please clean the cache of your browser and try again</p>
<p>If the problems persists, please try again with a different browser</p>
<br>
<a href="{{url_for('download', submissionID = subId)}}">
<button class="downloadBtn">Download</button>
</a>
<br>
<br>
<br>
<a href="{{url_for('index')}}"><b>Click here to perform another submission</b></a>
<br>
<br>
<br>
<br>
<br>
</div>
<div style="text-align: center; color: black; font-family: Oxygen">
<a href="{{url_for('index')}}"><b>TranSyT 2019</b></a>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<a href="https://www.eng.uminho.pt/en" target="_blank"> <img border="0" alt="School of Engineering" src="{{ url_for('static', filename = 'images/EENG.jpg') }}" width="90" height="60"></a>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<a href="https://www.ceb.uminho.pt/" target="_blank"> <img border="0" alt="Centre of Biological Engineering" src="{{ url_for('static', filename = 'images/ceb1.png') }}" width="130" height="105"></a>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<a href="https://www.elixir-portugal.org/" target="_blank"> <img border="0" alt="BioData" src="{{ url_for('static', filename = 'images/biodata_elixir.png') }}" width="235" height="30"></a>
<br>
<br>
</div>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>TranSyT</title>
<link rel="stylesheet" href="{{ url_for('static', filename='css/center.css') }}">
<link rel="stylesheet" href="{{ url_for('static', filename='css/submit.css') }}">
<link rel="stylesheet" href="{{ url_for('static', filename='css/footer.css') }}">
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap-theme.min.css">
<link href="//fonts.googleapis.com/css?family=Oxygen&subset=latin,latin-ext" rel="stylesheet" type="text/css">
</head>
<body>
<div class="center" align="center" style="border: 0">
<br>
<br>
<h1><b>TranSyT</b></h1>
<br>
<br>
<img src="{{ url_for('static', filename = 'images/transportProtein.gif') }}" alt="Biocoiso" height="325px">
<br>
<br>
<h1>The page that you were looking for doesn't exist</h1>
<br>
<br>
<h4>There are no results for your query: {{ subId }} </h4>
<br>
<br>
<a href="{{url_for('index')}}"><b>Click here to get back to the home page</b></a>
<br>
<br>
<script src="../static/js/show_filename.js"></script>
<script src="../static/js/to_show.js"></script>
</div>
<div class="footer">
<table>
<tr>
<th><a href="{{url_for('index')}}">TranSyT 2019</a> <br>
by <a href="https://www.ceb.uminho.pt/People/Profile/davidelagoa" target="_blank">Davide Lagoa</a> and
<a href="https://www.ceb.uminho.pt/People/Profile/odias" target="_blank">Oscar Dias</a>
</th>
<th><a href="https://www.eng.uminho.pt/en" target="_blank"> <img border="0" alt="School of Engineering" src="{{ url_for('static', filename = 'images/EENG.jpg') }}"></a></th>
<th><a href="https://www.ceb.uminho.pt/" target="_blank"> <img border="0" alt="Centre of Biological Engineering" src="{{ url_for('static', filename = 'images/ceb1.png') }}"></a></th>
<th><a href="https://www.elixir-portugal.org/" target="_blank"> <img border="0" alt="BioData" src="{{ url_for('static', filename = 'images/biodata_elixir.png') }}"></a></th>
</tr>
</table>
</div>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>TranSyT</title>
<link rel="stylesheet" href="{{ url_for('static', filename='css/center.css') }}">
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap-theme.min.css">
<link rel="stylesheet" href="{{ url_for('static', filename='css/header.css') }}">
<link href="//fonts.googleapis.com/css?family=Oxygen&subset=latin,latin-ext" rel="stylesheet" type="text/css">
<link rel="stylesheet" href="{{ url_for('static', filename='css/nav.css') }}">
<link rel="stylesheet" href="{{ url_for('static', filename='css/downloadButton.css') }}">
<link rel="stylesheet" href="{{ url_for('static', filename='css/accordion_results.css') }}">
<link rel="stylesheet" href="{{ url_for('static', filename='css/footer.css') }}">
<link rel="stylesheet" href="{{ url_for('static', filename='css/center.css') }}">
<link rel="stylesheet" href="{{ url_for('static', filename='css/submit.css') }}">
<link rel="stylesheet" href="{{ url_for('static', filename='css/footer.css') }}">
<body style="background: #fefcfe">
<div class="center-download" align="center">
<h1><b>TranSyT</b></h1>
<br>
<br>
<div style="width: 100%; text-align: left; border: 2px solid #2c3e50; border-radius: 10px; padding: 25px">
<h4>
TranSyT identifier:
</h4>
<br>
<p>{{subId}}</p>
<br>
<br>
<h4>
Meta identifier:
</h4>
<br>
<p>{{ dictt['metaID'] }}</p>
<br>
<br>
<h4>
Reaction:
</h4>
<br>
<p>
{% if ' $<<>>$' in dictt['reaction'] %}
{{ dictt['reaction'].split('$<<>>$')[0] }}
<a target="_blank" style="padding-left: 5px; padding-right: 5px"><img border="0" src="{{ url_for('static', filename = 'images/reversible_arrow.png') }}" width="28" height="28"></a>
{{ dictt['reaction'].split('$<<>>$')[1] }}
{% else %}
{{ dictt['reaction'].split('$>>$')[0] }}
<a target="_blank" style="padding-left: 5px; padding-right: 5px"><img border="0" src="{{ url_for('static', filename = 'images/right_arrow.png') }}" width="28" height="28"></a>
{{ dictt['reaction'].split('$>>$')[1] }}
{% endif %}
</p>
<br>
<br>
<div style="display: flex; flex-wrap: wrap; width: 50%">
<div style="flex: 0 0 33%">
<label class="external-links-button">
<button style="display: none" onclick="toggleTCsystems()" type="button"></button>
<p>TC systems</p>
</label>
</div>
<div style="flex: 0 0 33%">
<label class="external-links-button">
<button style="display: none" onclick="toggleMetabolites()" type="button"></button>
<p>Metabolites</p>
</label>
</div>
</div>
<br>
<br>
<div id="external-links" style="display: none">
{% for i , system in dictt['tc_systems'] | enumerate_items %}
<div class="inner-external-links">
<div class="inner-external-links-title">
<a target="_blank" href="http://www.tcdb.org/search/result.php?tc={{system}}"><b>{{system}}</b></a>
</div>
{% for system2 in dictt['tc_systems'][system] %}
<div>
<div>
<p class="par-inner-external-links">{{ system2 }}</p>
</div>
<div>
<a target="_blank"
href="http://www.tcdb.org/search/result.php?acc={{system2}}&tc={{system}}">
<img border="0" src="{{ url_for('static', filename = 'images/tcdb_logo.png') }}"
width="170" height="38">
</a>
</div>
<div>
<a target="_blank" href="https://www.uniprot.org/uniprot/{{system2}}">
<img border="0" src="{{ url_for('static', filename = 'images/uniprot_logo2.png') }}"
width="56" height="32">
</a>
</div>
</div>
{% endfor %}
</div>
{% endfor %}
<br>
<label class="external-links-button-close">
<button style="display: none" onclick="closeExternal()" type="button"></button>
<img border="0" src="{{ url_for('static', filename = 'images/close_icon.png') }}" width="32" height="32">
</label>
</div>
<div id="aspect-content" style="display: none">
{% for db, val in dictt['databases'].items() %}
{% if val %}
<div class="tab-element ">
<input id="{{ db }}" type="checkbox" class="outer-input" name="aspect">
<label for="{{ db }}" class="outer-label"></label>
<div class="outer-label-content">
<div class="aspect-info">
<div class="aspect-name"> {{ db }}
</div>
<div class="aspect-name">
</div>
<div class="aspect-name">
</div>
</div>
</div>
<div class="dropdown-content-outer-wrapper">
{% for role in ['Reactants', 'Products'] %}
<div class="inner-tab-element-wrapper">
<div class="inner-tab-element ">
<input id="{{ db+role }}" type="checkbox" class="inner-input" name="aspect">
<label for="{{ db+role }}" class="inner-label"></label>
<div class="inner-label-content">
<div class="aspect-info">
<div class="aspect-name" style="color: #ffffff"> {{role}}
</div>
</div>
</div>
<div class="dropdown-content-outer-wrapper">
<div class="inner-inner-tab-element-wrapper" style="padding: 10px 10px 0px 10px">
<div>
<div style="padding: 10px 10px 0px 10px">
<div class="content" style="height: 20px">
<span><b>Identifier</b></span>
<br>
</div>
</div>
</div>
<div>
<div style="padding: 10px 10px 0px 10px">
<div class="content" style="height: 20px">
<span><b>Name</b></span>
<br>
</div>
</div>
</div>
<div>
<div style="padding: 10px 10px 0px 10px">
<div class="content" style="height: 20px">
<span><b>Stoichiometry</b></span>
<br>
</div>
</div>
</div>
<div>
<div style="padding: 10px 10px 0px 10px">
<div class="content" style="height: 20px">
<span><b>Aliases</b></span>
<br>
</div>
</div>
</div>
<div>
<div style="padding: 10px 10px 0px 10px">
<div class="content" style="height: 20px">
<span><b>Formula</b></span>
<br>
</div>
</div>
</div>
</div>
{% for cpd in dictt['metabolites'][db + '_' + role.lower()[:-1]] %}
<div class="inner-inner-tab-element-wrapper">
<div>
<div>
<div class="content">
{% if db == 'MetaCyc' %}
<span><a href="https://metacyc.org/compound?orgid=META&id={{ cpd[5:] }}" target="_blank">{{ cpd }}</a></span>
{% elif db == 'KEGG' %}
<span><a href="https://identifiers.org/kegg.compound:{{ cpd }}" target="_blank">{{ cpd }}</a></span>
{% elif db == 'ModelSEED' %}
<span><a href="https://identifiers.org/seed.compound:{{ cpd }}" target="_blank">{{ cpd }}</a></span>
{% else %}
<span><a href="https://identifiers.org/bigg.metabolite:{{ cpd }}" target="_blank">{{ cpd }}</a></span>
{% endif %}
</div>
</div>
</div>
<div>
<div>
<div class="content">
<span>{{ dictt['metabolites'][db + '_' + role.lower()[:-1]][cpd]['name'] }}</span>
</div>
</div>
</div>
<div>
<div>
<div class="content">
<span>{{ dictt['metabolites'][db + '_' + role.lower()[:-1]][cpd]['stoichiometry'] }}</span>
</div>
</div>
</div>
<div>
<div>
<div class="content">
{% for alias in dictt['metabolites'][db + '_' + role.lower()[:-1]][cpd]['aliases'] %}
<span>{{ alias }}<br></span>
{% endfor %}
</div>
</div>
</div>
<div>
<div>
<div class="content">
<span>{{ dictt['metabolites'][db + '_' + role.lower()[:-1]][cpd]['formula'] }}</span>
</div>
</div>
</div>
</div>
{% endfor %}
</div>
</div>
</div>
{% endfor %}
</div>
</div>
{% else %}
{% endif %}
{% endfor %}
</div>
</div>
<br>
<br>
<a href="{{url_for('index')}}"><b>Click here to get back to the home page</b></a>
<br>
<br>
<br>
</div>
<script src="../static/js/to_show.js"></script>
<div class="footer">
<table>
<tr>
<th><a href="{{url_for('index')}}">TranSyT 2019</a> <br>
by <a href="https://www.ceb.uminho.pt/People/Profile/davidelagoa" target="_blank">Davide Lagoa</a> and
<a href="https://www.ceb.uminho.pt/People/Profile/odias" target="_blank">Oscar Dias</a>
</th>
<th><a href="https://www.eng.uminho.pt/en" target="_blank"> <img border="0" alt="School of Engineering" src="{{ url_for('static', filename = 'images/EENG.jpg') }}"></a></th>
<th><a href="https://www.ceb.uminho.pt/" target="_blank"> <img border="0" alt="Centre of Biological Engineering" src="{{ url_for('static', filename = 'images/ceb1.png') }}"></a></th>
<th><a href="https://www.elixir-portugal.org/" target="_blank"> <img border="0" alt="BioData" src="{{ url_for('static', filename = 'images/biodata_elixir.png') }}"></a></th>
</tr>
</table>
</div>
</body>
</html>
from neo4jPythonDriver import neo4jPythonDriver
def database_retriever_by_id(id):
url = 'bolt://palsson.di.uminho.pt:7688'
user = 'neo4j'
password = 'password'
driver = neo4jPythonDriver(url, user, password)
session = driver.initSession()
query = "MATCH (r:Reaction)<-[:has_reaction]-(tc:TC_Number)<-[:has_tc]-(ua:Uniprot_Accession) WHERE r.ReactionID = \'" + id + "\' " \
"MATCH (r)-[rm]-(y) WHERE EXISTS((y)-[:has_name|:has_molecular_formula]-()) MATCH (y)-[]->(z) RETURN tc.TC_Number, ua, r, rm, y, z"
result = session.run(query)
session.close()
LABELS = ['MetaCyc', 'KEGG', 'ModelSEED', 'BiGG']
databases = {}
for label in LABELS:
databases[label] = False
metabolites = {}
tc_systems = []
reactionID = None
metaID = None
reaction = None
output = {}
for r in result:
entry = r[0] + '@' + r[1]['Accession_Number']
if entry not in tc_systems:
tc_systems.append(entry)
reactionID = r[2]['ReactionID']
metaID = r[2]['MetaID']
reaction = r[2]['Reaction']
relationshipType = r[3].type
metaboliteLabel = list(r[4].labels)[0]
alias = None
formula = None
if 'Molecular_formula' in list(r[5].labels)[0]:
formula = r[5]['Molecular_Formula']
elif 'Metabolite_Name' in list(r[5].labels)[0]:
alias = r[5]['Name']
for label in databases.keys():
if label in metaboliteLabel:
databases[label] = True
key = None
if 'reactant' in relationshipType:
key = label + '_' + 'reactant'
elif 'product' in relationshipType:
key = label + '_' + 'product'
if key is not None:
metabolite = {}
metaboliteId = r[4]['MetaboliteID']
metabolite['name'] = r[4]['Name']
#metabolite['id'] = r[4]['MetaboliteID']
metabolite['stoichiometry'] = r[3]['Stoichiometry']
metabolite['aliases'] = []
metabolite['formula'] = None
if key not in metabolites:
metabolites[key] = {}
#print("coiso" + str(metabolites[key]))
#for m in metabolites[key]:
# print(m)
if metaboliteId not in metabolites[key].keys():
metabolites[key][metaboliteId] = metabolite
if alias is not None and alias not in metabolites[key][metaboliteId]['aliases']:
metabolites[key][metaboliteId]['aliases'].append(alias)
if formula is not None and metabolites[key][metaboliteId]['formula'] is None:
metabolites[key][metaboliteId]['formula'] = formula
return databases, tc_systems, reactionID, metaID, reaction, metabolites
# id = 'TR3000069' #small case
# #id = 'TR0000067' #extreme case
# print()
# print("########################")
# print()
# print(databases)
# print(tc_systems)
# print(reactionID)
# print(metaID)
# print(reaction)
# print(metabolites)
# for key in metabolites:
# print(key + " " + str(metabolites[key]))
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment