Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trackhubs #6

Open
wants to merge 25 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 23 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
a696333
added basic outline of track hub
alanfwilliams Jun 8, 2018
a9d8de6
started basic template and fitted inital parameters to template (wip)
alanfwilliams Jun 8, 2018
1c1cccd
continued development of trackhub setup
alanfwilliams Jun 9, 2018
b8b68fa
continued development of trackhub setup pt. 3
alanfwilliams Jun 11, 2018
d0fc429
improved build setup to allow better debugging of trackhub code
alanfwilliams Jun 12, 2018
7ed618b
added sort functionality to bed file creation
alanfwilliams Jun 14, 2018
3365033
rearranged sort functionality and removed not needed bed files
alanfwilliams Jun 17, 2018
5eaeeac
added db entry and details page
alanfwilliams Jun 21, 2018
57f2a09
added list view and fixed link formatting
alanfwilliams Jun 21, 2018
1eb8869
template improvements, file retrieval (for UCSC) built (needs header …
alanfwilliams Jun 24, 2018
94cbfd0
added makedetails and bigwigs creation
alanfwilliams Jul 2, 2018
7023137
revert to breaks for bed file, fixed remove typo, added color
alanfwilliams Jul 2, 2018
f111e20
trackhub db retrivals now uses get(), make_details return empty dicts…
alanfwilliams Jul 8, 2018
5d9a8cd
added back fetchChromSizes (will be removed later)
alanfwilliams Jul 8, 2018
7fef29f
replaced fetchChromSizes with resident chrom size file
alanfwilliams Jul 9, 2018
fd9379c
forgot to remove copy command for fetchChromSizes
alanfwilliams Jul 9, 2018
ceca034
added back tabs for commented code
alanfwilliams Jul 11, 2018
70d497c
moved sorting and chromosome handling code to file upload process, al…
alanfwilliams Jul 16, 2018
f123322
added cleanup functionality, made sure that only the generated bigbed…
alanfwilliams Jul 16, 2018
7b3ba38
added underscore to filename
alanfwilliams Jul 19, 2018
5d882fc
added multiwig functionality and clarified use of camelCase
alanfwilliams Jul 23, 2018
db51109
added zero line
alanfwilliams Jul 28, 2018
9587c0a
added url to trackhub detail page, fixed line lengths, added spaces f…
alanfwilliams Jul 28, 2018
e438227
shortened links and removed unnecessary <form>, added clarifying comm…
alanfwilliams Aug 11, 2018
e60b66b
adjusted trackDb output code to make more readable
alanfwilliams Aug 13, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions INSTALL.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,23 @@ 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
mkdir kent
cd kent
if [ uname != "Darwin" ]; then
rsync -a -P rsync://hgdownload.soe.ucsc.edu/genome/admin/exe/linux.x86_64/bedToBigBed ./
rsync -a -P rsync://hgdownload.soe.ucsc.edu/genome/admin/exe/linux.x86_64/bedGraphToBigWig ./
else
rsync -a -P rsync://hgdownload.soe.ucsc.edu/genome/admin/exe/macOSX.x86_64/bedToBigBed ./
rsync -a -P rsync://hgdownload.soe.ucsc.edu/genome/admin/exe/macOSX.x86_64/bedGraphToBigWig ./
fi
sudo cp bedToBigBed /usr/local/bin/
sudo cp bedGraphToBigWig /usr/local/bin/

# for an apache web server
sudo apt-get install apache2 libapache2-mod-wsgi
cd /var/www
Expand Down
4 changes: 4 additions & 0 deletions plotter/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ 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_init/{user}/')
config.add_route('trackhub_details', '/trackhub_details/{short_name}/')
config.add_route('trackhub_file', '/trackhub/{short_name}/*file')
config.add_route('trackhub_list', '/trackhub_list/{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)
Expand Down
14 changes: 14 additions & 0 deletions plotter/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -855,6 +855,20 @@ def process(self):
# print time.time()-before, "seconds elapsed"


class Trackhub(Resource):
keys = ("short_name",)

def make_details(self):
return {}


class UserTrackhubs(Resource):
keys = ("trackhubs",)

def make_details(self):
return []


class Models(Resource):
keys = ("name", "chr")

Expand Down
42 changes: 42 additions & 0 deletions plotter/templates/export_table.pt
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<table class="home">
<tr>
<th>db</th>
<th>Uploaded by</th>
<th>on</th>
<th>Probes</th>
<th>Copy#</th>
<th>Bkpt</th>
<th colspan="2" >Annotations</th>
<th colspan="3" >Segmentation</th>
<th colspan="2" >Breakpoints</th>
<th colspan="1" >Links</th>
</tr>

<tr tal:repeat="p profiles" tal:switch="p.ready">
<td class="left" tal:condition="p.ready">
<input type="checkbox" name="profile" value="${p.name}">
${p.name}
</input>
</td>
<td tal:condition="p.ready == False">
${p.name}
</td>
<td>${p.db}</td>
<td tal:condition="str(user) == p.uploader">
you [<a href="/delete_profile/${p.name}/">Delete</a>]
</td>
<td tal:condition="str(user) != p.uploader">
${p.uploader}
</td>
<td class="mono">${p.uploaded_on.strftime("%d-%b-%Y")}</td>
<td>${p.share}</td>
<td class="numeric">${p.probes}</td>
<td tal:condition="p.ready" class="numeric">
<div tal:condition="p.copies">${p.copies}</div>
</td>
<td tal:condition="p.ready" class="numeric">
<div tal:condition="p.breakpoints">${p.breakpoints}</div>
</td>
</tr>
</table>

9 changes: 9 additions & 0 deletions plotter/templates/profile_table.pt
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,18 @@ 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. </p>

<form method="get" action="/trackhub_list/${user}/">
<button type="submit">View Your Track Hubs</button>
</form>

<form method="get" action="/trackhub_init/${user}/">
<button type="submit">Create Track Hub</button>
Copy link
Owner

@tdhock tdhock Aug 10, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry for not mentioning this earlier but it is usually a bad idea to use a form if there are no fields/data to submit, as is the case above. in this case you could just use a standard link, a href instead, right?

and actualy i would suggest changing the URL scheme from /trackhub_*/${user}/ to simply /trackhub_*/ because anyways the user variable is stored in the session info

</form>

<form action="/view_profiles/" method="post"
enctype="multipart/form-data">


<table class="home">
<tr>
<th><input type="submit" value="Plot checked" /></th>
Expand Down
35 changes: 35 additions & 0 deletions plotter/templates/trackhub_details.pt
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@

<metal:main use-macro="load: base.pt">
<title metal:fill-slot="title">
SegAnnDB: Trackhub Details
</title>

<div metal:fill-slot="content">

<p>
<br/>
Trackhub data for ${short_name}
</p>
<br/>
<p>
Description: ${long_name}
</p>
<br/>
<p>
URL: <a href="${url}">${url}</a>
<br/>
Paste this into UCSC's My Hub page to view your trackhub.
</p>
<br/>
<p>
Profiles:
<br/>
<div tal:repeat="p profiles">
<td>
<a href="/profile/${p}/">${p}</a>
</td>
</div>
<br/>
<p>Return to <a href="/">home</a>.</p>
</div>
</metal:main>
26 changes: 26 additions & 0 deletions plotter/templates/trackhub_export.pt
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@

<metal:main use-macro="load: base.pt">
<title metal:fill-slot="title">>
SegAnnDB: Export Trackhub
</title>

<div metal:fill-slot="content">
<p>Please fill out the profile data.</p>
<form enctype="multipart/form-data" method="post">
<p><label for="id_short_label">Short Label:</label>
<input type="text" name="short_label" id="id_short_label" />
<label for="id_long_label">Long Label:</label>
<input type="text" name="long_label" id="id_long_label" />
<label for="id_db">DB</label>
<input type="text" name="db" id="id_db" />

</p>
<metal:main use-macro="load: export_table.pt"/>
<input id="submit_button" type="submit"
value="Create Track Hub" />
</form>

<p>Return to <a href="/">home</a>.</p>

</div>
</metal:main>
17 changes: 17 additions & 0 deletions plotter/templates/trackhub_list.pt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@


<title>
SegAnnDB: Trackhub List for ${user}
</title>


<p>
Trackhubs:
</p>
<p>
<div tal:repeat="t trackhubs">
<td>
<a href="${url}/trackhub_details/${t}/">${t}</a>
</td>
</div>
</p>
Loading