From a6963335a914fbf27fedabefd2d6519d687c7843 Mon Sep 17 00:00:00 2001
From: Alan Williams
Date: Thu, 7 Jun 2018 21:03:05 -0400
Subject: [PATCH 01/25] added basic outline of track hub
---
INSTALL.sh | 14 ++++++++++++++
plotter/views.py | 21 +++++++++++++++++++++
2 files changed, 35 insertions(+)
diff --git a/INSTALL.sh b/INSTALL.sh
index 46f1088..b8103a3 100755
--- a/INSTALL.sh
+++ b/INSTALL.sh
@@ -30,6 +30,20 @@ fi
sed -i 's#^FILE_PREFIX.*$#FILE_PREFIX = "/var/www"#' plotter/db.py
sudo python setup.py install
+if [ "$TRAVIS" = "true" ]; then
+ cd $TRAVIS_BUILD_DIR
+else
+ cd
+fi
+wget http://hgdownload.cse.ucsc.edu/admin/exe/userApps.src.tgz
+tar -xvzf userApps.src.tgz
+cd userApps
+make
+sudo cp bin/bedToBigBed /usr/local/bin/
+sudo cp bin/fetchChromSizes /usr/local/bin/
+cd ..
+sudo rm -r userApps
+
# for an apache web server
sudo apt-get install apache2 libapache2-mod-wsgi
cd /var/www
diff --git a/plotter/views.py b/plotter/views.py
index e1d1f4c..cf243b3 100644
--- a/plotter/views.py
+++ b/plotter/views.py
@@ -817,6 +817,27 @@ def export(request):
response = respond_bed_csv(md["what"], md["format"], pinfo, dicts)
return response
+#def export_bedgraph(userinput):
+ # get filename and db version
+# os.mkdir(trackhubfolder+profilename)
+# olddir = os.getcwd()
+# os.chdir(trackhubfolder+profilename)
+# hubtxt = open('hub.txt','w')
+# hubtxt.write('hub ' + userinput['hubname'] + '\nshortLabel ' + userinput['shortlabel'] + '\nlongLabel ' + userinput['longlabel'] + '\ngenomesFile genomes.txt\nemail ' + username
+# hubtxt.close()
+# genomestxt = open('genomes.txt','w')
+# genomestxt.write('genome ' + dbversion + '\ntrackDB ' + dbversion + '/trackDb.txt')
+# genomestxt.close()
+# os.mkdir(dbversion)
+# os.chdir(dbversion)
+# subprocess.call(['fetchChromSizes',dbversion,'>','chrom.sizes'])
+# for x in userinput['profilelist']:
+# subprocess.call(['bedToBigBed', path+filename, 'chrom.sizes', os.getcwd()+newfilename])
+# trackdbtxt = open('trackDb.txt','w')
+# for x in userinput['profilelist']:
+# trackdbtxt.write('track ' + x['name'] + '\nbigDataUrl ' + x['filename'] + '\nshortLabel ' + x['shortlabel'] + '\nlongLabel ' + x['longlabel'] + '\ntype bigBed\n\n\n')
+# trackdbtxt.close()
+# os.chdir(olddir)
def respond_bed_csv(table, fmt, hinfo, dicts):
response = Response(content_type="text/plain")
From a9d8de6e3551b3eaac09721244c517cc6d8d6d65 Mon Sep 17 00:00:00 2001
From: Alan Williams
Date: Thu, 7 Jun 2018 22:17:30 -0400
Subject: [PATCH 02/25] started basic template and fitted inital parameters to
template (wip)
---
plotter/__init__.py | 1 +
plotter/templates/trackhub_export.pt | 26 +++++++++++++++
plotter/views.py | 47 +++++++++++++++-------------
3 files changed, 53 insertions(+), 21 deletions(-)
create mode 100644 plotter/templates/trackhub_export.pt
diff --git a/plotter/__init__.py b/plotter/__init__.py
index 8c0d03f..eff6c65 100644
--- a/plotter/__init__.py
+++ b/plotter/__init__.py
@@ -29,6 +29,7 @@ def main(global_config, **settings):
config.add_route('add_region',
'/add_region/{name}/{chr}/{trackType}/{annotation}/{min}/{max}/')
config.add_route("export","/export/{user}/{name}/{what}/{format}/")
+ config.add_route('trackhub_export', '/trackhub_initial/{user}/{name}/{what}/')
name_regex = db.HEADER_PATTERNS["name"]
# config.add_route("secret","/secret/{name:%s}{suffix}"%name_regex)
config.add_route("secret","/secret/{profile_name}/{name:%s}{suffix}"%name_regex)
diff --git a/plotter/templates/trackhub_export.pt b/plotter/templates/trackhub_export.pt
new file mode 100644
index 0000000..bbb2a25
--- /dev/null
+++ b/plotter/templates/trackhub_export.pt
@@ -0,0 +1,26 @@
+
+
+
+ SegAnnDB: Export Trackhub
+
+
+
+
+
Please fill out the profile data.
+
+
+
Return to home.
+
+
+
+','chrom.sizes'])
-# for x in userinput['profilelist']:
-# subprocess.call(['bedToBigBed', path+filename, 'chrom.sizes', os.getcwd()+newfilename])
-# trackdbtxt = open('trackDb.txt','w')
-# for x in userinput['profilelist']:
-# trackdbtxt.write('track ' + x['name'] + '\nbigDataUrl ' + x['filename'] + '\nshortLabel ' + x['shortlabel'] + '\nlongLabel ' + x['longlabel'] + '\ntype bigBed\n\n\n')
-# trackdbtxt.close()
-# os.chdir(olddir)
+# @view_config(route_name="trackhub_export",
+# request_method="POST",
+# renderer="templates/trackhub_export.pt")
+# @check_export
+# def export_trackhub(request):
+# # get filename and db version
+# md = request.matchdict
+# os.mkdir('trackhubs/'+md['what'])
+# olddir = os.getcwd()
+# os.chdir('trackhubs/'+md['what'])
+# hubtxt = open('hub.txt','w')
+# hubtxt.write('hub ' + md['what'] + '\nshortLabel ' + request.POST['short_label'] + '\nlongLabel ' + request.POST['long_label'] + '\ngenomesFile genomes.txt\nemail ' + md['user']
+# hubtxt.close()
+# genomestxt = open('genomes.txt','w')
+# genomestxt.write('genome ' + dbversion + '\ntrackDB ' + dbversion + '/trackDb.txt')
+# genomestxt.close()
+# os.mkdir(dbversion)
+# os.chdir(dbversion)
+# os.subprocess.call(['fetchChromSizes', dbversion,'>','chrom.sizes'])
+# for x in userinput['profilelist']:
+# os.subprocess.call(['bedToBigBed', path+filename, 'chrom.sizes', os.getcwd()+newfilename])
+# trackdbtxt = open('trackDb.txt','w')
+# for x in userinput['profilelist']:
+# trackdbtxt.write('track ' + x['name'] + '\nbigDataUrl ' + x['filename'] + '\nshortLabel ' + x['shortlabel'] + '\nlongLabel ' + x['longlabel'] + '\ntype bigBed\n\n\n')
+# trackdbtxt.close()
+# os.chdir(olddir)
def respond_bed_csv(table, fmt, hinfo, dicts):
response = Response(content_type="text/plain")
From 1c1cccdcd9026b0c47d88c4024f4f16dabc00804 Mon Sep 17 00:00:00 2001
From: Alan Williams
Date: Fri, 8 Jun 2018 21:39:21 -0400
Subject: [PATCH 03/25] continued development of trackhub setup
---
plotter/__init__.py | 2 +-
plotter/templates/export_table.pt | 42 +++++++++++++++++
plotter/templates/profile_table.pt | 5 ++
plotter/templates/trackhub_export.pt | 19 ++++----
plotter/views.py | 70 +++++++++++++++++-----------
5 files changed, 101 insertions(+), 37 deletions(-)
create mode 100644 plotter/templates/export_table.pt
diff --git a/plotter/__init__.py b/plotter/__init__.py
index eff6c65..153dbd0 100644
--- a/plotter/__init__.py
+++ b/plotter/__init__.py
@@ -29,7 +29,7 @@ def main(global_config, **settings):
config.add_route('add_region',
'/add_region/{name}/{chr}/{trackType}/{annotation}/{min}/{max}/')
config.add_route("export","/export/{user}/{name}/{what}/{format}/")
- config.add_route('trackhub_export', '/trackhub_initial/{user}/{name}/{what}/')
+ config.add_route('trackhub_export', '/trackhub_init/{user}/')
name_regex = db.HEADER_PATTERNS["name"]
# config.add_route("secret","/secret/{name:%s}{suffix}"%name_regex)
config.add_route("secret","/secret/{profile_name}/{name:%s}{suffix}"%name_regex)
diff --git a/plotter/templates/export_table.pt b/plotter/templates/export_table.pt
new file mode 100644
index 0000000..cc7b6ab
--- /dev/null
+++ b/plotter/templates/export_table.pt
@@ -0,0 +1,42 @@
+
+
diff --git a/plotter/templates/profile_table.pt b/plotter/templates/profile_table.pt
index e034d30..32e8d78 100644
--- a/plotter/templates/profile_table.pt
+++ b/plotter/templates/profile_table.pt
@@ -3,9 +3,14 @@ If the profile name link is not active for a recently-uploaded profile,
you need to wait a few minutes for the server to process the
data.
+
+