Commit 16970bf4 authored by Liis Kolberg's avatar Liis Kolberg
Browse files

licence

parent 007f70a1
###
# funcexplorer_public Copyright (C) 2018 University of Tartu
# Released under: The GNU General Public License v3.0
# Authors: Liis Kolberg, Ivan Kuzmin, Priit Adler, Jaak Vilo, Hedi Peterson
###
from flask import Flask, request
import os
import sys
......
###
# funcexplorer_public Copyright (C) 2018 University of Tartu
# Released under: The GNU General Public License v3.0
# Authors: Liis Kolberg, Ivan Kuzmin, Priit Adler, Jaak Vilo, Hedi Peterson
###
import netCDF4
import numpy as np
import pandas as pd
......
###
# funcexplorer_public Copyright (C) 2018 University of Tartu
# Released under: The GNU General Public License v3.0
# Authors: Liis Kolberg, Ivan Kuzmin, Priit Adler, Jaak Vilo, Hedi Peterson
###
# Functions for RNA seq upload etc
import numpy as np
......@@ -32,4 +38,4 @@ def transformRNAseq(counts, c = 1, method = "no_norm"):
# counts.normed = pd.DataFrame(counts.normed, columns=counts.columns.values, index=counts.index.values)
else:
counts.normed = np.matrix(counts)
return counts.normed
\ No newline at end of file
return counts.normed
#!/usr/bin/python
###
# funcexplorer_public Copyright (C) 2018 University of Tartu
# Released under: The GNU General Public License v3.0
# Authors: Liis Kolberg, Ivan Kuzmin, Priit Adler, Jaak Vilo, Hedi Peterson
###
# Preprocessing data for vishic app
import netCDF4
......
#!/anaconda_ete/bin/python
###
# funcexplorer_public Copyright (C) 2018 University of Tartu
# Released under: The GNU General Public License v3.0
# Authors: Liis Kolberg, Ivan Kuzmin, Priit Adler, Jaak Vilo, Hedi Peterson
###
# Preprocessing data for vishic app
......
/*
funcexplorer_public Copyright (C) 2018 University of Tartu
Released under: The GNU General Public License v3.0
Authors: Liis Kolberg, Ivan Kuzmin, Priit Adler, Jaak Vilo, Hedi Peterson
*/
if (!d3) {
throw "d3 wasn't included!";
}
......
/*
funcexplorer_public Copyright (C) 2018 University of Tartu
Released under: The GNU General Public License v3.0
Authors: Liis Kolberg, Ivan Kuzmin, Priit Adler, Jaak Vilo, Hedi Peterson
*/
/*
http://bl.ocks.org/kueda/1036776
......@@ -6,33 +12,6 @@
Also includes a radial dendrogram visualization (branch lengths not scaled)
along with some helper methods for building angled-branch trees.
Copyright (c) 2013, Ken-ichi Ueda
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer. Redistributions in binary
form must reproduce the above copyright notice, this list of conditions and
the following disclaimer in the documentation and/or other materials
provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
DOCUEMENTATION
l
d3.phylogram.build(selector, nodes, options)
Creates a phylogram.
Arguments:
......
###
# funcexplorer_public Copyright (C) 2018 University of Tartu
# Released under: The GNU General Public License v3.0
# Authors: Liis Kolberg, Ivan Kuzmin, Priit Adler, Jaak Vilo, Hedi Peterson
###
# tree2json.py
......
###
# funcexplorer_public Copyright (C) 2018 University of Tartu
# Released under: The GNU General Public License v3.0
# Authors: Liis Kolberg, Ivan Kuzmin, Priit Adler, Jaak Vilo, Hedi Peterson
###
# analysis.py
from cutting import find_dense, find_sparse
......
###
# funcexplorer_public Copyright (C) 2018 University of Tartu
# Released under: The GNU General Public License v3.0
# Authors: Liis Kolberg, Ivan Kuzmin, Priit Adler, Jaak Vilo, Hedi Peterson
###
# cutting.py
# Functions to find the dense and sparse clusters based on strategy
......
###
# funcexplorer_public Copyright (C) 2018 University of Tartu
# Released under: The GNU General Public License v3.0
# Authors: Liis Kolberg, Ivan Kuzmin, Priit Adler, Jaak Vilo, Hedi Peterson
###
# scores.py
# Functions to calculate and add the scores to the (prefiltered) tree
# Main function: add_scores(tree, strategy)
......
# vishic.py
###
# funcexplorer_public Copyright (C) 2018 University of Tartu
# Released under: The GNU General Public License v3.0
# Authors: Liis Kolberg, Ivan Kuzmin, Priit Adler, Jaak Vilo, Hedi Peterson
###
from ete3 import Tree
from analysis import vishic_analysis
......
###
# funcexplorer_public Copyright (C) 2018 University of Tartu
# Released under: The GNU General Public License v3.0
# Authors: Liis Kolberg, Ivan Kuzmin, Priit Adler, Jaak Vilo, Hedi Peterson
###
import os
import sys
from os.path import basename
......@@ -255,7 +261,8 @@ def main():
cur.execute("SELECT DISTINCT gp_version FROM input;")
gp_versions = [i[0] for i in cur.fetchall()]
gp_versions.sort(reverse=True)
badmessage = "Dear user, we are under development at the moment and therefore the processes are not stable.\nIn case of suggestions and questions please contact liis.kolberg@gmail.com."
badmessage = False
#badmessage = "Dear user, we are under development at the moment and therefore the processes are not stable.\nIn case of suggestions and questions please contact liis.kolberg@gmail.com."
return render_template("homepage.html", colors=COLORS, ds_data=res, gp_versions=gp_versions, badmessage=badmessage, organisms=dict(ORGANISMS))
......@@ -275,7 +282,7 @@ def user_main(hash):
badmessage = "Dear user, we encountered some problems while trying to process Your data.\nPlease contact liis.kolberg@gmail.com"
else:
badmessage = False
badmessage = "Dear user, we are under development at the moment and therefore the processes are not stable.\nIn case of suggestions and questions please contact liis.kolberg@gmail.com."
#badmessage = "Dear user, we are under development at the moment and therefore the processes are not stable.\nIn case of suggestions and questions please contact liis.kolberg@gmail.com."
cur.execute(
"""SELECT DISTINCT ds_id, ds_name, organism, sample_count, created_at FROM dataset WHERE ds_id IN (SELECT ds_id FROM input WHERE email_hash='%s');""" % (hash,))
ds_data = defaultdict(list)
......@@ -690,8 +697,14 @@ def search_terms_in_nodes():
@app.route('/funcexplorer/_create_short', methods=['POST'])
def create_shortlink():
user = app.config['DATABASES']['cache']['USER']
dbname = app.config['DATABASES']['cache']['DBNAME']
host = app.config['DATABASES']['cache']['HOST']
conn_string = "host='%s' dbname='%s' user='%s'" % (host, dbname, user)
cache_conn = psycopg2.connect(conn_string)
long_url = request.form['long_url']
short_url = create_short(long_url, HASHTABLE_NAME)
short_url = create_short(long_url, HASHTABLE_NAME, cache_conn)
return json.dumps({"short_url": short_url})
......@@ -700,8 +713,21 @@ def create_shortlink():
@app.route('/funcexplorer/link/<short>')
def redirect_shortlink(short):
# get the long url from hashtable
hashtable = pickle.load(open(HASHTABLE_NAME, "rb"))
long_url = hashtable.get(short, "https://biit.cs.ut.ee/funcexplorer/")
user = app.config['DATABASES']['cache']['USER']
dbname = app.config['DATABASES']['cache']['DBNAME']
host = app.config['DATABASES']['cache']['HOST']
conn_string = "host='%s' dbname='%s' user='%s'" % (host, dbname, user)
cache_conn = psycopg2.connect(conn_string)
cursor = cache_conn.cursor()
sql = """SELECT long_url FROM shortlinks WHERE short_url='%s';""" % (short,)
cursor.execute(sql)
long_url = cursor.fetchall()
if not long_url:
long_url = "https://biit.cs.ut.ee/funcexplorer/"
else:
long_url = long_url[0][0]
cache_conn.close()
return redirect(long_url)
# Import data table from main summary
......
###
# funcexplorer_public Copyright (C) 2018 University of Tartu
# Released under: The GNU General Public License v3.0
# Authors: Liis Kolberg, Ivan Kuzmin, Priit Adler, Jaak Vilo, Hedi Peterson
###
# From R package WGCNA, moduleEigengenes
# expr, clusters, nPC = 1, align = "along average", scale=T
......@@ -45,4 +51,4 @@ def eigengenes(expressions, clusters, node2labels, scale=True):
if corAve < 0:
pc1 = -pc1
res[cl] = list(pc1)
return res
\ No newline at end of file
return res
###
# funcexplorer_public Copyright (C) 2018 University of Tartu
# Released under: The GNU General Public License v3.0
# Authors: Liis Kolberg, Ivan Kuzmin, Priit Adler, Jaak Vilo, Hedi Peterson
###
import random
# pip install pillow
from PIL import Image, ImageFont, ImageDraw, ImageFilter
......
###
# funcexplorer_public Copyright (C) 2018 University of Tartu
# Released under: The GNU General Public License v3.0
# Authors: Liis Kolberg, Ivan Kuzmin, Priit Adler, Jaak Vilo, Hedi Peterson
###
# Functions for cleaning the uploaded data before processing
from __future__ import division
......
###
# funcexplorer_public Copyright (C) 2018 University of Tartu
# Released under: The GNU General Public License v3.0
# Authors: Liis Kolberg, Ivan Kuzmin, Priit Adler, Jaak Vilo, Hedi Peterson
###
# helper functions for getting the data from cached db
import pandas as pd
......
###
# funcexplorer_public Copyright (C) 2018 University of Tartu
# Released under: The GNU General Public License v3.0
# Authors: Liis Kolberg, Ivan Kuzmin, Priit Adler, Jaak Vilo, Hedi Peterson
###
# removes any files in static/tmp/ older than 3 days
import os, time
......
###
# funcexplorer_public Copyright (C) 2018 University of Tartu
# Released under: The GNU General Public License v3.0
# Authors: Liis Kolberg, Ivan Kuzmin, Priit Adler, Jaak Vilo, Hedi Peterson
###
# Create annotation wordcloud
import numpy as np
......@@ -15,4 +21,4 @@ def create_wordcloud(annotations, top_n=10, term_length = False):
k: [{"t_id": x.t_id, "text": x.descr, "full_text": x.descr, "size": -np.log10(x.pval), "t_type": x.t_type, "pval": x.pval} for x in v.head(top_n).itertuples()] for k, v in
dense_nodes.groupby("node_id")}
# returns frequency list of dictionaries for every dense node
return cloud_data, best_score
\ No newline at end of file
return cloud_data, best_score
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