galaxy-commits
Threads by month
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
November 2010
- 1 participants
- 286 discussions
galaxy-dist commit 122aaabe2c7e: Workaround Issue 397 using 'if' in Cheetah template to avoid hidden parameters
by commits-noreply@bitbucket.org 20 Nov '10
by commits-noreply@bitbucket.org 20 Nov '10
20 Nov '10
# HG changeset patch -- Bitbucket.org
# Project galaxy-dist
# URL http://bitbucket.org/galaxy/galaxy-dist/overview
# User peterjc <p.j.a.cock(a)googlemail.com>
# Date 1286965628 -3600
# Node ID 122aaabe2c7eb48726f65233370926b838b6b444
# Parent 10d0ffe5b7e22b2d122945ab5b7fa951a18c6e4a
Workaround Issue 397 using 'if' in Cheetah template to avoid hidden parameters
--- a/tools/ncbi_blast_plus/ncbi_blastn_wrapper.xml
+++ b/tools/ncbi_blast_plus/ncbi_blastn_wrapper.xml
@@ -12,11 +12,12 @@ blastn
#end if
-task $blast_type
-evalue $evalue_cutoff
-$adv_opts.filter_query
-$adv_opts.strand
-out $output1
$out_format
-num_threads 8
+#if $adv_opts.adv_opts_selector=="advanced":
+$adv_opts.filter_query
+$adv_opts.strand
## Need int(str(...)) because $adv_opts.max_hits is an InputValueWrapper object not a string
## Note -max_target_seqs overrides -num_descriptions and -num_alignments
#if (str($adv_opts.max_hits) and int(str($adv_opts.max_hits)) > 0):
@@ -26,6 +27,8 @@ blastn
-word_size $adv_opts.word_size
#end if
$adv_opts.ungapped
+## End of advanced options:
+#end if
</command><inputs><param name="query" type="data" format="fasta" label="Nucleotide query sequence(s)"/>
@@ -78,13 +81,7 @@ blastn
<option value="basic" selected="True">Hide Advanced Options</option><option value="advanced">Show Advanced Options</option></param>
- <when value="basic">
- <param name="filter_query" type="hidden" value="" />
- <param name="strand" type="hidden" value="" />
- <param name="max_hits" type="hidden" value="" />
- <param name="word_size" type="hidden" value="" />
- <param name="ungapped" type="hidden" value="" />
- </when>
+ <when value="basic" /><when value="advanced"><!-- Could use a select (yes, no, other) where other allows setting 'level window linker' --><param name="filter_query" type="boolean" label="Filter out low complexity regions (with DUST)" truevalue="-dust yes" falsevalue="-dust no" checked="true" />
--- a/tools/ncbi_blast_plus/ncbi_blastp_wrapper.xml
+++ b/tools/ncbi_blast_plus/ncbi_blastp_wrapper.xml
@@ -12,11 +12,12 @@ blastp
#end if
-task $blast_type
-evalue $evalue_cutoff
-$adv_opts.filter_query
-$adv_opts.matrix
-out $output1
$out_format
-num_threads 8
+#if $adv_opts.adv_opts_selector=="advanced":
+$adv_opts.filter_query
+$adv_opts.matrix
## Need int(str(...)) because $adv_opts.max_hits is an InputValueWrapper object not a string
## Note -max_target_seqs overrides -num_descriptions and -num_alignments
#if (str($adv_opts.max_hits) and int(str($adv_opts.max_hits)) > 0):
@@ -27,6 +28,8 @@ blastp
#end if
##Ungapped disabled for now - see comments below
##$adv_opts.ungapped
+## End of advanced options:
+#end if
</command><inputs><param name="query" type="data" format="fasta" label="Protein query sequence(s)"/>
@@ -73,16 +76,7 @@ blastp
<option value="basic" selected="True">Hide Advanced Options</option><option value="advanced">Show Advanced Options</option></param>
- <when value="basic">
- <param name="filter_query" type="hidden" value="" />
- <param name="matrix" type="hidden" value="" />
- <param name="max_hits" type="hidden" value="" />
- <param name="word_size" type="hidden" value="" />
- <!--
- Ungapped disabled for now, see comments below
- <param name="ungapped" type="hidden" value="" />
- -->
- </when>
+ <when value="basic" /><when value="advanced"><!-- Could use a select (yes, no, other) where other allows setting 'window locut hicut' --><param name="filter_query" type="boolean" label="Filter out low complexity regions (with SEG)" truevalue="-seg yes" falsevalue="-seg no" checked="true" />
--- a/tools/ncbi_blast_plus/ncbi_tblastx_wrapper.xml
+++ b/tools/ncbi_blast_plus/ncbi_tblastx_wrapper.xml
@@ -11,12 +11,13 @@ tblastx
-subject "$db_opts.subject"
#end if
-evalue $evalue_cutoff
+-out $output1
+$out_format
+-num_threads 8
+#if $adv_opts.adv_opts_selector=="advanced":
$adv_opts.filter_query
$adv_opts.strand
$adv_opts.matrix
--out $output1
-$out_format
--num_threads 8
## Need int(str(...)) because $adv_opts.max_hits is an InputValueWrapper object not a string
## Note -max_target_seqs overrides -num_descriptions and -num_alignments
#if (str($adv_opts.max_hits) and int(str($adv_opts.max_hits)) > 0):
@@ -25,6 +26,8 @@ tblastx
#if (str($adv_opts.word_size) and int(str($adv_opts.word_size)) > 0):
-word_size $adv_opts.word_size
#end if
+## End of advanced options:
+#end if
</command><inputs><param name="query" type="data" format="fasta" label="Nucleotide query sequence(s)"/>
@@ -67,13 +70,7 @@ tblastx
<option value="basic" selected="True">Hide Advanced Options</option><option value="advanced">Show Advanced Options</option></param>
- <when value="basic">
- <param name="filter_query" type="hidden" value="" />
- <param name="strand" type="hidden" value="" />
- <param name="matrix" type="hidden" value="" />
- <param name="max_hits" type="hidden" value="" />
- <param name="word_size" type="hidden" value="" />
- </when>
+ <when value="basic" /><when value="advanced"><!-- Could use a select (yes, no, other) where other allows setting 'window locut hicut' --><param name="filter_query" type="boolean" label="Filter out low complexity regions (with SEG)" truevalue="-seg yes" falsevalue="-seg no" checked="true" />
--- a/tools/ncbi_blast_plus/ncbi_blastx_wrapper.xml
+++ b/tools/ncbi_blast_plus/ncbi_blastx_wrapper.xml
@@ -11,12 +11,13 @@ blastx
-subject "$db_opts.subject"
#end if
-evalue $evalue_cutoff
+-out $output1
+$out_format
+-num_threads 8
+#if $adv_opts.adv_opts_selector=="advanced":
$adv_opts.filter_query
$adv_opts.strand
$adv_opts.matrix
--out $output1
-$out_format
--num_threads 8
## Need int(str(...)) because $adv_opts.max_hits is an InputValueWrapper object not a string
## Note -max_target_seqs overrides -num_descriptions and -num_alignments
#if (str($adv_opts.max_hits) and int(str($adv_opts.max_hits)) > 0):
@@ -26,6 +27,8 @@ blastx
-word_size $adv_opts.word_size
#end if
$adv_opts.ungapped
+## End of advanced options:
+#end if
</command><inputs><param name="query" type="data" format="fasta" label="Nucleotide query sequence(s)"/>
@@ -68,14 +71,7 @@ blastx
<option value="basic" selected="True">Hide Advanced Options</option><option value="advanced">Show Advanced Options</option></param>
- <when value="basic">
- <param name="filter_query" type="hidden" value="" />
- <param name="strand" type="hidden" value="" />
- <param name="matrix" type="hidden" value="" />
- <param name="max_hits" type="hidden" value="" />
- <param name="word_size" type="hidden" value="" />
- <param name="ungapped" type="hidden" value="" />
- </when>
+ <when value="basic" /><when value="advanced"><!-- Could use a select (yes, no, other) where other allows setting 'window locut hicut' --><param name="filter_query" type="boolean" label="Filter out low complexity regions (with SEG)" truevalue="-seg yes" falsevalue="-seg no" checked="true" />
--- a/tools/ncbi_blast_plus/ncbi_tblastn_wrapper.xml
+++ b/tools/ncbi_blast_plus/ncbi_tblastn_wrapper.xml
@@ -11,11 +11,12 @@ tblastn
-subject "$db_opts.subject"
#end if
-evalue $evalue_cutoff
-$adv_opts.filter_query
-$adv_opts.matrix
-out $output1
$out_format
-num_threads 8
+#if $adv_opts.adv_opts_selector=="advanced":
+$adv_opts.filter_query
+$adv_opts.matrix
## Need int(str(...)) because $adv_opts.max_hits is an InputValueWrapper object not a string
## Note -max_target_seqs overrides -num_descriptions and -num_alignments
#if (str($adv_opts.max_hits) and int(str($adv_opts.max_hits)) > 0):
@@ -26,6 +27,8 @@ tblastn
#end if
##Ungapped disabled for now - see comments below
##$adv_opts.ungapped
+## End of advanced options:
+#end if
</command><inputs><param name="query" type="data" format="fasta" label="Protein query sequence(s)"/>
@@ -68,16 +71,7 @@ tblastn
<option value="basic" selected="True">Hide Advanced Options</option><option value="advanced">Show Advanced Options</option></param>
- <when value="basic">
- <param name="filter_query" type="hidden" value="" />
- <param name="matrix" type="hidden" value="" />
- <param name="max_hits" type="hidden" value="" />
- <param name="word_size" type="hidden" value="" />
- <!--
- Ungapped disabled for now, see comments below
- <param name="ungapped" type="hidden" value="" />
- -->
- </when>
+ <when value="basic" /><when value="advanced"><!-- Could use a select (yes, no, other) where other allows setting 'window locut hicut' --><param name="filter_query" type="boolean" label="Filter out low complexity regions (with SEG)" truevalue="-seg yes" falsevalue="-seg no" checked="true" />
1
0
galaxy-dist commit 082399b4681b: Remove broken blastn test
by commits-noreply@bitbucket.org 20 Nov '10
by commits-noreply@bitbucket.org 20 Nov '10
20 Nov '10
# HG changeset patch -- Bitbucket.org
# Project galaxy-dist
# URL http://bitbucket.org/galaxy/galaxy-dist/overview
# User peterjc <p.j.a.cock(a)googlemail.com>
# Date 1288001263 -3600
# Node ID 082399b4681b878d20a727150832ef30679b7e1c
# Parent 0f6ace5c397b000993db8e491a33e42423cdc807
Remove broken blastn test
--- a/tools/ncbi_blast_plus/ncbi_blastn_wrapper.xml
+++ b/tools/ncbi_blast_plus/ncbi_blastn_wrapper.xml
@@ -119,20 +119,6 @@ blastn
<requirement type="binary">blastn</requirement></requirements><tests>
- <test>
- <param name="input_query" value="megablast_wrapper_test1.fa" ftype="fasta"/>
- <!-- database needs to match the entry in the blastdb.loc file (first column), which includes the last update date if appropriate -->
- <param name="database" value="phiX" />
- <param name="blast_type" value="megablast" />
- <!--
- <param name="word_size" value="28" />
- <param name="iden_cutoff" value="99.0" />
- -->
- <param name="evalue_cutoff" value="10.0" />
- <param name="filter_query" value="yes" />
- <param name="out_format" value="6" />
- <output name="output1" file="megablast_wrapper_test1.out"/>
- </test></tests><help>
1
0
galaxy-dist commit f2383b761f4e: Make sure samples have associated target libraries befoe enabling ability to transfer datasets, use better naming convention for request history code and templates, eliminate the ability to submit a request unless it has samples.
by commits-noreply@bitbucket.org 20 Nov '10
by commits-noreply@bitbucket.org 20 Nov '10
20 Nov '10
# HG changeset patch -- Bitbucket.org
# Project galaxy-dist
# URL http://bitbucket.org/galaxy/galaxy-dist/overview
# User Greg Von Kuster <greg(a)bx.psu.edu>
# Date 1289507783 18000
# Node ID f2383b761f4e05442fd5ba6b1cde517732aa2c03
# Parent dfc848840870fa9936a69e62322446fcb940fb40
Make sure samples have associated target libraries befoe enabling ability to transfer datasets, use better naming convention for request history code and templates, eliminate the ability to submit a request unless it has samples.
--- a/templates/requests/common/view_sample_datasets.mako
+++ b/templates/requests/common/view_sample_datasets.mako
@@ -7,14 +7,14 @@
is_complete = sample.request.is_complete
is_submitted = sample.request.is_submitted
can_select_datasets = is_admin and ( is_complete or is_submitted )
- can_transfer_datasets = is_admin and sample.untransferred_dataset_files
+ can_transfer_datasets = is_admin and sample.untransferred_dataset_files and sample.library and sample.folder
%><br/><br/><ul class="manage-table-actions">
%if can_transfer_datasets:
- <li><a class="action-button" href="${h.url_for( controller='requests_admin', action='manage_datasets', cntrller=cntrller, sample_id=trans.security.encode_id( sample.id ) )}">Transfer datasets</a></li>
+ <li><a class="action-button" href="${h.url_for( controller='requests_admin', action='manage_datasets', cntrller=cntrller, sample_id=trans.security.encode_id( sample.id ) )}">Manage selected datasets</a></li>
%endif
<li><a class="action-button" href="${h.url_for( controller='requests_common', action='view_sample_datasets', cntrller=cntrller, sample_id=trans.security.encode_id( sample.id ), transfer_status=transfer_status )}">Refresh page</a></li><li><a class="action-button" id="sample-${sample.id}-popup" class="menubutton">Dataset Actions</a></li>
--- a/templates/requests/common/edit_samples.mako
+++ b/templates/requests/common/edit_samples.mako
@@ -47,7 +47,7 @@
%if can_edit_request:
<a class="action-button" href="${h.url_for( controller='requests_common', action='edit_basic_request_info', cntrller=cntrller, id=trans.security.encode_id( request.id ) )}">Edit this request</a>
%endif
- <a class="action-button" href="${h.url_for( controller='requests_common', action='request_events', cntrller=cntrller, id=trans.security.encode_id( request.id ) )}">View history</a>
+ <a class="action-button" href="${h.url_for( controller='requests_common', action='view_request_history', cntrller=cntrller, id=trans.security.encode_id( request.id ) )}">View history</a>
%if can_reject:
<a class="action-button" href="${h.url_for( controller='requests_admin', action='reject_request', cntrller=cntrller, id=trans.security.encode_id( request.id ) )}">Reject this request</a>
%endif
--- a/lib/galaxy/web/controllers/requests.py
+++ b/lib/galaxy/web/controllers/requests.py
@@ -57,9 +57,9 @@ class Requests( BaseController ):
action='undelete_request',
cntrller='requests',
**kwd ) )
- if operation == "request_events":
+ if operation == "view_request_history":
return trans.response.send_redirect( web.url_for( controller='requests_common',
- action='request_events',
+ action='view_request_history',
cntrller='requests',
**kwd ) )
--- a/lib/galaxy/web/controllers/requests_common.py
+++ b/lib/galaxy/web/controllers/requests_common.py
@@ -76,7 +76,7 @@ class RequestsGrid( grids.Grid ):
StateColumn( "State",
key='state',
filterable="advanced",
- link=( lambda item: iff( item.deleted, None, dict( operation="request_events", id=item.id ) ) )
+ link=( lambda item: iff( item.deleted, None, dict( operation="view_request_history", id=item.id ) ) )
)
]
columns.append( grids.MulticolFilterColumn( "Search",
@@ -579,8 +579,8 @@ class RequestsCommon( BaseController, Us
status=status,
message=message ) )
@web.expose
- @web.require_login( "sequencing request events" )
- def request_events( self, trans, cntrller, **kwd ):
+ @web.require_login( "sequencing request history" )
+ def view_request_history( self, trans, cntrller, **kwd ):
params = util.Params( kwd )
request_id = params.get( 'id', None )
try:
@@ -590,7 +590,7 @@ class RequestsCommon( BaseController, Us
events_list = []
for event in request.events:
events_list.append( ( event.state, time_ago( event.update_time ), event.comment ) )
- return trans.fill_template( '/requests/common/events.mako',
+ return trans.fill_template( '/requests/common/view_request_history.mako',
cntrller=cntrller,
events_list=events_list,
request=request )
--- a/templates/admin/requests/select_datasets_to_transfer.mako
+++ b/templates/admin/requests/select_datasets_to_transfer.mako
@@ -72,7 +72,7 @@
<%
is_admin = cntrller == 'requests_admin' and trans.user_is_admin()
- can_transfer_datasets = is_admin and sample.untransferred_dataset_files
+ can_transfer_datasets = is_admin and sample.untransferred_dataset_files and sample.library and sample.folder
%><br/><br/>
@@ -85,8 +85,15 @@
</ul>
%if not sample:
+ <br/><font color="red"><b><i>Select a sample before selecting datasets to transfer</i></b></font>
- <br/><br/>
+ <br/>
+%endif
+
+%if request.samples_without_library_destinations:
+ <br/>
+ <font color="red"><b><i>Select a target data library and folder for all samples before starting the sequence run</i></b></font>
+ <br/>
%endif
%if message:
--- a/lib/galaxy/web/controllers/requests_admin.py
+++ b/lib/galaxy/web/controllers/requests_admin.py
@@ -175,9 +175,9 @@ class RequestsAdmin( BaseController, Use
action='view_request',
cntrller='requests_admin',
**kwd ) )
- if operation == "request_events":
+ if operation == "view_request_history":
return trans.response.send_redirect( web.url_for( controller='requests_common',
- action='request_events',
+ action='view_request_history',
cntrller='requests_admin',
**kwd ) )
if operation == "reject":
--- a/test/base/twilltestcase.py
+++ b/test/base/twilltestcase.py
@@ -1517,7 +1517,7 @@ class TwillTestCase( unittest.TestCase )
for check_str in strings_not_displayed:
self.check_string_not_in_page( check_str )
def view_request_history( self, cntrller, request_id, strings_displayed=[], strings_not_displayed=[] ):
- self.visit_url( "%s/requests_common/request_events?cntrller=%s&id=%s" % ( self.url, cntrller, request_id ) )
+ self.visit_url( "%s/requests_common/view_request_history?cntrller=%s&id=%s" % ( self.url, cntrller, request_id ) )
for check_str in strings_displayed:
self.check_page_for_string( check_str )
for check_str in strings_not_displayed:
--- a/templates/requests/common/events.mako
+++ /dev/null
@@ -1,53 +0,0 @@
-<%inherit file="/base.mako"/>
-<%namespace file="/message.mako" import="render_msg" />
-
-<%
- is_admin = cntrller == 'requests_admin' and trans.user_is_admin()
- can_edit_request = ( is_admin and not request.is_complete ) or request.is_unsubmitted
- can_reject_request = is_admin and request.is_submitted
- can_add_samples = request.is_unsubmitted
-%>
-
-<br/><br/>
-<ul class="manage-table-actions">
- <li><a class="action-button" id="request-${request.id}-popup" class="menubutton">Request Actions</a></li>
- <div popupmenu="request-${request.id}-popup">
- <a class="action-button" href="${h.url_for( controller='requests_common', action='view_request', cntrller=cntrller, id=trans.security.encode_id( request.id ) )}">Browse this request</a>
- %if can_edit_request:
- <a class="action-button" href="${h.url_for( controller='requests_common', action='edit_basic_request_info', cntrller=cntrller, id=trans.security.encode_id( request.id ) )}">Edit this request</a>
- %endif
- %if can_add_samples:
- <a class="action-button" confirm="More samples cannot be added to this request once it is submitted. Click OK to submit." href="${h.url_for( controller='requests_common', action='submit_request', cntrller=cntrller, id=trans.security.encode_id( request.id ) )}">Submit this request</a>
- %endif
- %if can_reject_request:
- <a class="action-button" href="${h.url_for( controller='requests_admin', action='reject_request', cntrller=cntrller, id=trans.security.encode_id( request.id ) )}">Reject this request</a>
- %endif
- </div>
-</ul>
-
-%if message:
- ${render_msg( message, status )}
-%endif
-
-<h2>History of Sequencing Request "${request.name}"</h2>
-
-<div class="toolForm">
- <table class="grid">
- <thead>
- <tr>
- <th>State</th>
- <th>Last Update</th>
- <th>Comments</th>
- </tr>
- </thead>
- <tbody>
- %for state, updated, comments in events_list:
- <tr class="libraryRow libraryOrFolderRow" id="libraryRow">
- <td><b><a>${state}</a></b></td>
- <td><a>${updated}</a></td>
- <td><a>${comments}</a></td>
- </tr>
- %endfor
- </tbody>
- </table>
-</div>
--- a/templates/requests/common/edit_basic_request_info.mako
+++ b/templates/requests/common/edit_basic_request_info.mako
@@ -3,7 +3,13 @@
<%
is_admin = cntrller == 'requests_admin' and trans.user_is_admin()
- can_add_samples = request.is_unsubmitted
+ is_complete = request.is_complete
+ is_submitted = request.is_submitted
+ is_unsubmitted = request.is_unsubmitted
+ can_add_samples = is_unsubmitted
+ can_reject = is_admin and is_submitted
+ can_select_datasets = is_admin and ( is_complete or is_submitted )
+ can_submit_request = request.samples and is_unsubmitted
%><br/><br/>
@@ -11,12 +17,14 @@
<li><a class="action-button" id="request-${request.id}-popup" class="menubutton">Request Actions</a></li><div popupmenu="request-${request.id}-popup"><a class="action-button" href="${h.url_for( controller='requests_common', action='view_request', cntrller=cntrller, id=trans.security.encode_id( request.id ) )}">Browse this request</a>
- %if can_add_samples:
+ %if can_submit_request:
<a class="action-button" confirm="More samples cannot be added to this request once it is submitted. Click OK to submit." href="${h.url_for( controller='requests_common', action='submit_request', cntrller=cntrller, id=trans.security.encode_id( request.id ) )}">Submit this request</a>
%endif
- <a class="action-button" href="${h.url_for( controller='requests_common', action='request_events', cntrller=cntrller, id=trans.security.encode_id( request.id ) )}">View history</a>
- %if is_admin and request.is_submitted:
+ <a class="action-button" href="${h.url_for( controller='requests_common', action='view_request_history', cntrller=cntrller, id=trans.security.encode_id( request.id ) )}">View history</a>
+ %if can_reject:
<a class="action-button" href="${h.url_for( controller='requests_admin', action='reject_request', cntrller=cntrller, id=trans.security.encode_id( request.id ) )}">Reject this request</a>
+ %endif
+ %if can_select_datasets:
<a class="action-button" href="${h.url_for( controller='requests_admin', action='select_datasets_to_transfer', request_id=trans.security.encode_id( request.id ) )}">Select datasets to transfer</a>
%endif
</div>
--- a/templates/admin/requests/reject.mako
+++ b/templates/admin/requests/reject.mako
@@ -8,7 +8,7 @@
<h2>Reject Sequencing Request "${request.name}"</h2><ul class="manage-table-actions"><li>
- <a class="action-button" href="${h.url_for( controller='requests_common', action='request_events', cntrller=cntrller, id=trans.security.encode_id(request.id) )}">View history</a>
+ <a class="action-button" href="${h.url_for( controller='requests_common', action='view_request_history', cntrller=cntrller, id=trans.security.encode_id(request.id) )}">View history</a></li><li><a class="action-button" href="${h.url_for( controller='requests_common', action='view_request', cntrller=cntrller, id=trans.security.encode_id(request.id) )}">Browse this request</a>
--- a/templates/requests/common/view_request.mako
+++ b/templates/requests/common/view_request.mako
@@ -44,7 +44,7 @@
%if can_edit_request:
<a class="action-button" href="${h.url_for( controller='requests_common', action='edit_basic_request_info', cntrller=cntrller, id=trans.security.encode_id( request.id ) )}">Edit this request</a>
%endif
- <a class="action-button" href="${h.url_for( controller='requests_common', action='request_events', cntrller=cntrller, id=trans.security.encode_id( request.id ) )}">View history</a>
+ <a class="action-button" href="${h.url_for( controller='requests_common', action='view_request_history', cntrller=cntrller, id=trans.security.encode_id( request.id ) )}">View history</a>
%if can_reject:
<a class="action-button" href="${h.url_for( controller='requests_admin', action='reject_request', cntrller=cntrller, id=trans.security.encode_id( request.id ) )}">Reject this request</a>
%endif
@@ -52,8 +52,15 @@
</ul>
%if request.is_rejected:
+ <br/><font color="red"><b><i>Reason for rejection: </i></b></font><b>${request.last_comment}</b>
- <br/><br/>
+ <br/>
+%endif
+
+%if request.samples_without_library_destinations:
+ <br/>
+ <font color="red"><b><i>Select a target data library and folder for all samples before starting the sequence run</i></b></font>
+ <br/>
%endif
%if message:
@@ -94,7 +101,7 @@
<div class="form-row"><label>${field_label}:</label>
%if field_label == 'State':
- <a href="${h.url_for( controller='requests_common', action='request_events', cntrller=cntrller, id=trans.security.encode_id( request.id ) )}">${field_value}</a>
+ <a href="${h.url_for( controller='requests_common', action='view_request_history', cntrller=cntrller, id=trans.security.encode_id( request.id ) )}">${field_value}</a>
%else:
${field_value}
%endif
@@ -154,6 +161,11 @@
render_buttons = can_edit_samples
%>
${render_samples_grid( cntrller, request, displayable_sample_widgets=displayable_sample_widgets, action='view_request', editing_samples=False, encoded_selected_sample_ids=[], render_buttons=render_buttons, grid_header=grid_header )}
+ ## Render the other grids
+ <% trans.sa_session.refresh( request.type.sample_form ) %>
+ %for grid_index, grid_name in enumerate( request.type.sample_form.layout ):
+ ${render_request_type_sample_form_grids( grid_index, grid_name, request.type.sample_form.grid_fields( grid_index ), displayable_sample_widgets=displayable_sample_widgets, editing_samples=False )}
+ %endfor
%else:
There are no samples.
%if can_add_samples:
@@ -162,8 +174,3 @@
</ul>
%endif
%endif
-## Render the other grids
-<% trans.sa_session.refresh( request.type.sample_form ) %>
-%for grid_index, grid_name in enumerate( request.type.sample_form.layout ):
- ${render_request_type_sample_form_grids( grid_index, grid_name, request.type.sample_form.grid_fields( grid_index ), displayable_sample_widgets=displayable_sample_widgets, editing_samples=False )}
-%endfor
--- /dev/null
+++ b/templates/requests/common/view_request_history.mako
@@ -0,0 +1,58 @@
+<%inherit file="/base.mako"/>
+<%namespace file="/message.mako" import="render_msg" />
+
+<%
+ is_admin = cntrller == 'requests_admin' and trans.user_is_admin()
+ is_complete = request.is_complete
+ is_submitted = request.is_submitted
+ is_unsubmitted = request.is_unsubmitted
+ can_add_samples = is_unsubmitted
+ can_edit_request = ( is_admin and not is_complete ) or is_unsubmitted
+ can_reject = is_admin and is_submitted
+ can_select_datasets = is_admin and ( is_complete or is_submitted )
+ can_submit_request = request.samples and is_unsubmitted
+%>
+
+<br/><br/>
+<ul class="manage-table-actions">
+ <li><a class="action-button" id="request-${request.id}-popup" class="menubutton">Request Actions</a></li>
+ <div popupmenu="request-${request.id}-popup">
+ <a class="action-button" href="${h.url_for( controller='requests_common', action='view_request', cntrller=cntrller, id=trans.security.encode_id( request.id ) )}">Browse this request</a>
+ %if can_edit_request:
+ <a class="action-button" href="${h.url_for( controller='requests_common', action='edit_basic_request_info', cntrller=cntrller, id=trans.security.encode_id( request.id ) )}">Edit this request</a>
+ %endif
+ %if can_submit_request:
+ <a class="action-button" confirm="More samples cannot be added to this request once it is submitted. Click OK to submit." href="${h.url_for( controller='requests_common', action='submit_request', cntrller=cntrller, id=trans.security.encode_id( request.id ) )}">Submit this request</a>
+ %endif
+ %if can_reject:
+ <a class="action-button" href="${h.url_for( controller='requests_admin', action='reject_request', cntrller=cntrller, id=trans.security.encode_id( request.id ) )}">Reject this request</a>
+ %endif
+ </div>
+</ul>
+
+%if message:
+ ${render_msg( message, status )}
+%endif
+
+<h2>History of sequencing request "${request.name}"</h2>
+
+<div class="toolForm">
+ <table class="grid">
+ <thead>
+ <tr>
+ <th>State</th>
+ <th>Last Update</th>
+ <th>Comments</th>
+ </tr>
+ </thead>
+ <tbody>
+ %for state, updated, comments in events_list:
+ <tr class="libraryRow libraryOrFolderRow" id="libraryRow">
+ <td><b><a>${state}</a></b></td>
+ <td><a>${updated}</a></td>
+ <td><a>${comments}</a></td>
+ </tr>
+ %endfor
+ </tbody>
+ </table>
+</div>
--- a/templates/requests/common/common.mako
+++ b/templates/requests/common/common.mako
@@ -322,7 +322,7 @@
%if can_select_datasets:
<li><a class="action-button" href="${h.url_for( controller='requests_admin', action='select_datasets_to_transfer', request_id=trans.security.encode_id( request.id ), sample_id=trans.security.encode_id( sample.id ) )}">Select datasets to transfer</a></li>
%endif
- %if sample.datasets and len( sample.datasets ) > len( transferred_dataset_files ):
+ %if sample.datasets and len( sample.datasets ) > len( transferred_dataset_files ) and sample.library and sample.folder:
<li><a class="action-button" href="${h.url_for( controller='requests_admin', action='manage_datasets', sample_id=trans.security.encode_id( sample.id ) )}">Manage selected datasets</a></li>
%elif sample.datasets and len(sample.datasets ) == len( transferred_dataset_files ):
<li><a class="action-button" href="${h.url_for( controller='requests_common', action='view_sample_datasets', cntrller=cntrller, sample_id=trans.security.encode_id( sample.id ), transfer_status=trans.model.SampleDataset.transfer_status.COMPLETE )}">View transferred datasets</a></li>
1
0
galaxy-dist commit d8184d91928c: Remove FASTA filter script from BLAST+ tools (I want to generalise it)
by commits-noreply@bitbucket.org 20 Nov '10
by commits-noreply@bitbucket.org 20 Nov '10
20 Nov '10
# HG changeset patch -- Bitbucket.org
# Project galaxy-dist
# URL http://bitbucket.org/galaxy/galaxy-dist/overview
# User peterjc <p.j.a.cock(a)googlemail.com>
# Date 1287998919 -3600
# Node ID d8184d91928c83f0269bd0267be949bc5d676e8b
# Parent 5c212dfc6189bb41d334b0519411ca4f04fde9ec
Remove FASTA filter script from BLAST+ tools (I want to generalise it)
--- a/tool_conf.xml.sample
+++ b/tool_conf.xml.sample
@@ -269,7 +269,6 @@
<tool file="ncbi_blast_plus/ncbi_tblastn_wrapper.xml" /><tool file="ncbi_blast_plus/ncbi_tblastx_wrapper.xml" /><tool file="ncbi_blast_plus/blastxml_to_tabular.xml" />
- <tool file="ncbi_blast_plus/blast_filter_fasta.xml" /></section><section name="NGS: Mapping" id="solexa_tools"><tool file="sr_mapping/lastz_wrapper.xml" />
--- a/tools/ncbi_blast_plus/blast_filter_fasta.py
+++ /dev/null
@@ -1,38 +0,0 @@
-#!/usr/bin/env python
-"""Filter a FASTA file using tabular output, e.g. from BLAST.
-
-Takes five command line options, tabular BLAST filename, ID column number
-(using one based counting), input FASTA filename, and two output FASTA
-filenames (for records with and without any BLAST hits).
-
-In the default NCBI BLAST+ tabular output, the query sequence ID is in column
-one, and the ID of the match from the database is in column two.
-"""
-import sys
-from galaxy_utils.sequence.fasta import fastaReader, fastaWriter
-
-#Parse Command Line
-blast_file, blast_col, in_file, out_positive_file, out_negative_file = sys.argv[1:]
-blast_col = int(blast_col)-1
-assert blast_col >= 0
-
-#Read tabular BLAST file and record all queries with hit(s)
-ids = set()
-blast_handle = open(blast_file, "rU")
-for line in blast_handle:
- ids.add(line.split("\t")[blast_col])
-blast_handle.close()
-
-#Write filtered FASTA file based on IDs from BLAST file
-reader = fastaReader(open(in_file, "rU"))
-positive_writer = fastaWriter(open(out_positive_file, "w"))
-negative_writer = fastaWriter(open(out_negative_file, "w"))
-for record in reader:
- #The [1:] is because the fastaReader leaves the > on the identifer.
- if record.identifier and record.identifier.split()[0][1:] in ids:
- positive_writer.write(record)
- else:
- negative_writer.write(record)
-positive_writer.close()
-negative_writer.close()
-reader.close()
--- a/tools/ncbi_blast_plus/blast_filter_fasta.xml
+++ /dev/null
@@ -1,37 +0,0 @@
-<tool id="blast_filter_fasta" name="Filter FASTA using BLAST output" version="0.0.1">
- <description>Divide a FASTA file based on BLAST hits</description>
- <command interpreter="python">
- blast_filter_fasta.py $blast_file $blast_col $in_file $out_positive_file $out_negative_file
- </command>
- <inputs>
- <param name="in_file" type="data" format="fasta" label="FASTA file to filter"/>
- <param name="blast_file" type="data" format="tabular" label="Tabular BLAST output"/>
- <param name="blast_col" type="select" label="Column containing FASTA identifiers">
- <option value="1">Column 1 - BLAST query ID</option>
- <option value="2">Column 2 - BLAST match ID</option>
- </param>
- </inputs>
- <outputs>
- <data name="out_positive_file" format="fasta" label="Sequences with BLAST hits" />
- <data name="out_negative_file" format="fasta" label="Sequences without BLAST hits" />
- </outputs>
- <requirements>
- </requirements>
- <tests>
- </tests>
- <help>
-
-**What it does**
-
-Typical use would be to take a multi-sequence FASTA and the tabular output of
-running BLAST on it, and divide the FASTA file in two: those sequence with a
-BLAST hit, and those without.
-
-In the default NCBI BLAST+ tabular output, the query sequence ID is in column
-one, and the ID of the match from the database is in column two.
-
-This allows you to filter the FASTA file for the subjects in the BLAST search,
-rather than filtering the FASTA file for the queries in the BLAST search.
-
- </help>
-</tool>
1
0
galaxy-dist commit 0f6ace5c397b: Ignore backup files from some editors
by commits-noreply@bitbucket.org 20 Nov '10
by commits-noreply@bitbucket.org 20 Nov '10
20 Nov '10
# HG changeset patch -- Bitbucket.org
# Project galaxy-dist
# URL http://bitbucket.org/galaxy/galaxy-dist/overview
# User peterjc <p.j.a.cock(a)googlemail.com>
# Date 1286965717 -3600
# Node ID 0f6ace5c397b000993db8e491a33e42423cdc807
# Parent d8184d91928c83f0269bd0267be949bc5d676e8b
Ignore backup files from some editors
--- a/.hgignore
+++ b/.hgignore
@@ -43,4 +43,4 @@ run_functional_tests.html
*.orig
.DS_Store
*.rej
-
+*~
1
0
galaxy-dist commit caed55b53f5a: Allows the downloading of metadata files associated with datasets (such as bai indices for bam files). This is done by adding a dropdown menu to the Save icon of appropriate datasets. Could potentially be modified to access implicitly converted datatypes as well in the future. Closes #410
by commits-noreply@bitbucket.org 20 Nov '10
by commits-noreply@bitbucket.org 20 Nov '10
20 Nov '10
# HG changeset patch -- Bitbucket.org
# Project galaxy-dist
# URL http://bitbucket.org/galaxy/galaxy-dist/overview
# User Kanwei Li <kanwei(a)gmail.com>
# Date 1289525191 18000
# Node ID caed55b53f5a811226e0bfa1c177e7b3e57a909a
# Parent ff7327f2946e9121139cefbf4a45dba2791b7162
Allows the downloading of metadata files associated with datasets (such as bai indices for bam files). This is done by adding a dropdown menu to the Save icon of appropriate datasets. Could potentially be modified to access implicitly converted datatypes as well in the future. Closes #410
--- a/templates/root/history_common.mako
+++ b/templates/root/history_common.mako
@@ -1,8 +1,10 @@
<% _=n_ %>
## Render the dataset `data` as history item, using `hid` as the displayed id
<%def name="render_dataset( data, hid, show_deleted_on_refresh = False, for_editing = True )">
- <a name="${trans.security.encode_id( data.id )}"></a><%
+ dataset_id = trans.security.encode_id( data.id )
+ from galaxy.datatypes.metadata import FileParameter
+
if data.state in ['no state','',None]:
data_state = "queued"
else:
@@ -41,7 +43,6 @@
%endif
%else:
<%
- dataset_id = trans.security.encode_id( data.id )
if for_editing:
display_url = h.url_for( controller='dataset', action='display', dataset_id=dataset_id, preview=True, filename='' )
else:
@@ -117,10 +118,25 @@
%endif
</div><div class="info">${_('Info: ')}${data.display_info()}</div>
- <div>
- <% dataset_id=trans.security.encode_id( data.id ) %>
+ <div>
%if data.has_data():
+
+ ## Check for downloadable metadata files
+ <% meta_files = [ k for k in data.metadata.spec.keys() if isinstance( data.metadata.spec[k].param, FileParameter ) ] %>
+ %if meta_files:
+ <div popupmenu="dataset-${dataset_id}-popup">
+ %for file_type in meta_files:
+ <a class="action-button" href="${h.url_for( controller='dataset', action='get_metadata_file', hda_id=dataset_id, metadata_type=file_type )}">
+ Download ${file_type}</a>
+ %endfor
+ </div>
+ <div style="float:left;" class="menubutton split popup" id="dataset-${dataset_id}-popup">
+ %endif
<a href="${h.url_for( controller='dataset', action='display', dataset_id=dataset_id, to_ext=data.ext )}" title="Save" class="icon-button disk tooltip"></a>
+ %if meta_files:
+ </div>
+ %endif
+
%if for_editing:
<a href="${h.url_for( controller='tool_runner', action='rerun', id=data.id )}" target="galaxy_main" title="Run this job again" class="icon-button arrow-circle tooltip"></a>
%if app.config.get_bool( 'enable_tracks', False ) and data.ext in app.datatypes_registry.get_available_tracks():
--- a/templates/root/history.mako
+++ b/templates/root/history.mako
@@ -277,6 +277,7 @@ var updater_callback = function ( tracke
// Keep going (if there are still any items to track)
updater( tracked_datasets );
}
+ make_popup_menus();
},
error: function() {
// Just retry, like the old method, should try to be smarter
--- a/lib/galaxy/web/controllers/dataset.py
+++ b/lib/galaxy/web/controllers/dataset.py
@@ -305,7 +305,18 @@ class DatasetInterface( BaseController,
return trans.show_error_message( msg )
-
+ @web.expose
+ def get_metadata_file(self, trans, hda_id, metadata_type):
+ """ Allows the downloading of metadata files associated with datasets (eg. bai index for bam files) """
+ data = trans.sa_session.query( trans.app.model.HistoryDatasetAssociation ).get( trans.security.decode_id( hda_id ) )
+ if not data or not trans.app.security_agent.can_access_dataset( trans.get_current_user_roles(), data.dataset ):
+ return trans.show_error_message( "You are not allowed to access this dataset" )
+
+ valid_chars = '.,^_-()[]0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
+ fname = ''.join(c in valid_chars and c or '_' for c in data.name)[0:150]
+ trans.response.headers["Content-Disposition"] = "attachment; filename=Galaxy%s-[%s].%s" % (data.hid, fname, metadata_type)
+ return open(data.metadata.get(metadata_type).file_name)
+
@web.expose
def display(self, trans, dataset_id=None, preview=False, filename=None, to_ext=None, **kwd):
"""Catches the dataset id and displays file contents as directed"""
@@ -323,8 +334,7 @@ class DatasetInterface( BaseController,
data = None
if not data:
raise paste.httpexceptions.HTTPRequestRangeNotSatisfiable( "Invalid reference dataset id: %s." % str( dataset_id ) )
- current_user_roles = trans.get_current_user_roles()
- if not trans.app.security_agent.can_access_dataset( current_user_roles, data.dataset ):
+ if not trans.app.security_agent.can_access_dataset( trans.get_current_user_roles(), data.dataset ):
return trans.show_error_message( "You are not allowed to access this dataset" )
if data.state == trans.model.Dataset.states.UPLOAD:
@@ -358,8 +368,7 @@ class DatasetInterface( BaseController,
if not to_ext:
to_ext = data.extension
valid_chars = '.,^_-()[]0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
- fname = data.name
- fname = ''.join(c in valid_chars and c or '_' for c in fname)[0:150]
+ fname = ''.join(c in valid_chars and c or '_' for c in data.name)[0:150]
trans.response.headers["Content-Disposition"] = "attachment; filename=Galaxy%s-[%s].%s" % (data.hid, fname, to_ext)
return open( data.file_name )
if not os.path.exists( data.file_name ):
1
0
galaxy-dist commit 5c212dfc6189: Fix a caption capitalisation
by commits-noreply@bitbucket.org 20 Nov '10
by commits-noreply@bitbucket.org 20 Nov '10
20 Nov '10
# HG changeset patch -- Bitbucket.org
# Project galaxy-dist
# URL http://bitbucket.org/galaxy/galaxy-dist/overview
# User peterjc <p.j.a.cock(a)googlemail.com>
# Date 1286980710 -3600
# Node ID 5c212dfc6189bb41d334b0519411ca4f04fde9ec
# Parent 122aaabe2c7eb48726f65233370926b838b6b444
Fix a caption capitalisation
--- a/tools/ncbi_blast_plus/ncbi_blastn_wrapper.xml
+++ b/tools/ncbi_blast_plus/ncbi_blastn_wrapper.xml
@@ -62,7 +62,7 @@ blastn
<option value="vecscreen">vecscreen</option>
--></param>
- <param name="evalue_cutoff" type="float" size="15" value="0.001" label="set expectation value cutoff" />
+ <param name="evalue_cutoff" type="float" size="15" value="0.001" label="Set expectation value cutoff" /><param name="out_format" type="select" label="Output format"><option value="-outfmt 6" selected="True">Tabular</option><option value="-outfmt 5">BLAST XML</option>
--- a/tools/ncbi_blast_plus/ncbi_blastp_wrapper.xml
+++ b/tools/ncbi_blast_plus/ncbi_blastp_wrapper.xml
@@ -57,7 +57,7 @@ blastp
<option value="blastp">blastp</option><option value="blastp-short">blastp-short</option></param>
- <param name="evalue_cutoff" type="float" size="15" value="0.001" label="set expectation value cutoff" />
+ <param name="evalue_cutoff" type="float" size="15" value="0.001" label="Set expectation value cutoff" /><param name="out_format" type="select" label="Output format"><option value="-outfmt 6" selected="True">Tabular</option><option value="-outfmt 5">BLAST XML</option>
--- a/tools/ncbi_blast_plus/ncbi_tblastx_wrapper.xml
+++ b/tools/ncbi_blast_plus/ncbi_tblastx_wrapper.xml
@@ -51,7 +51,7 @@ tblastx
<param name="subject" type="data" format="fasta" label="Nucleotide FASTA file to use as database"/></when></conditional>
- <param name="evalue_cutoff" type="float" size="15" value="0.001" label="set expectation value cutoff" />
+ <param name="evalue_cutoff" type="float" size="15" value="0.001" label="Set expectation value cutoff" /><param name="out_format" type="select" label="Output format"><option value="-outfmt 6" selected="True">Tabular</option><option value="-outfmt 5">BLAST XML</option>
--- a/tools/ncbi_blast_plus/ncbi_blastx_wrapper.xml
+++ b/tools/ncbi_blast_plus/ncbi_blastx_wrapper.xml
@@ -52,7 +52,7 @@ blastx
<param name="subject" type="data" format="fasta" label="Protein FASTA file to use as database"/></when></conditional>
- <param name="evalue_cutoff" type="float" size="15" value="0.001" label="set expectation value cutoff" />
+ <param name="evalue_cutoff" type="float" size="15" value="0.001" label="Set expectation value cutoff" /><param name="out_format" type="select" label="Output format"><option value="-outfmt 6" selected="True">Tabular</option><option value="-outfmt 5">BLAST XML</option>
--- a/tools/ncbi_blast_plus/ncbi_tblastn_wrapper.xml
+++ b/tools/ncbi_blast_plus/ncbi_tblastn_wrapper.xml
@@ -52,7 +52,7 @@ tblastn
<param name="subject" type="data" format="fasta" label="Nucleotide FASTA file to use as database"/></when></conditional>
- <param name="evalue_cutoff" type="float" size="15" value="0.001" label="set expectation value cutoff" />
+ <param name="evalue_cutoff" type="float" size="15" value="0.001" label="Set expectation value cutoff" /><param name="out_format" type="select" label="Output format"><option value="-outfmt 6" selected="True">Tabular</option><option value="-outfmt 5">BLAST XML</option>
1
0
galaxy-dist commit ff7327f2946e: When generating the list of target libraries for transferring sample datasets, use all libraries accessible to the request's user rather than all libraries for which that user has LIBRARY_ADD permission.
by commits-noreply@bitbucket.org 20 Nov '10
by commits-noreply@bitbucket.org 20 Nov '10
20 Nov '10
# HG changeset patch -- Bitbucket.org
# Project galaxy-dist
# URL http://bitbucket.org/galaxy/galaxy-dist/overview
# User Greg Von Kuster <greg(a)bx.psu.edu>
# Date 1289522279 18000
# Node ID ff7327f2946e9121139cefbf4a45dba2791b7162
# Parent f2383b761f4e05442fd5ba6b1cde517732aa2c03
When generating the list of target libraries for transferring sample datasets, use all libraries accessible to the request's user rather than all libraries for which that user has LIBRARY_ADD permission.
--- a/lib/galaxy/model/__init__.py
+++ b/lib/galaxy/model/__init__.py
@@ -53,6 +53,8 @@ class User( object ):
roles.append( role )
return roles
def accessible_libraries( self, trans, actions ):
+ # TODO: eliminate this method - instead use
+ # trans.app.security_agent.get_accessible_libraries().
# Get all permitted libraries for this user
all_libraries = trans.sa_session.query( trans.app.model.Library ) \
.filter( trans.app.model.Library.table.c.deleted == False ) \
--- a/lib/galaxy/web/controllers/requests_common.py
+++ b/lib/galaxy/web/controllers/requests_common.py
@@ -2,6 +2,7 @@ from galaxy.web.base.controller import *
from galaxy.web.framework.helpers import time_ago, iff, grids
from galaxy.model.orm import *
from galaxy import model, util
+from galaxy.util.odict import odict
from galaxy.web.form_builder import *
import logging, os, csv
@@ -413,8 +414,7 @@ class RequestsCommon( BaseController, Us
cntrller=cntrller,
id=request_id,
editing_samples=editing_samples ) )
- # Get all libraries for which the current user has permission to add items.
- libraries = request.user.accessible_libraries( trans, [ trans.app.security_agent.permitted_actions.LIBRARY_ADD ] )
+ libraries = self.__get_accessible_libraries( trans, request.user )
# Build a list of sample widgets (based on the attributes of each sample) for display.
displayable_sample_widgets = self.__get_sample_widgets( trans, request, request.samples, **kwd )
encoded_selected_sample_ids = self.__get_encoded_selected_sample_ids( trans, request, **kwd )
@@ -815,8 +815,7 @@ class RequestsCommon( BaseController, Us
else:
sample_index = len( displayable_sample_widgets )
if params.get( 'add_sample_button', False ):
- # Get all libraries for which the current user has permission to add items
- libraries = request.user.accessible_libraries( trans, [ trans.app.security_agent.permitted_actions.LIBRARY_ADD ] )
+ libraries = self.__get_accessible_libraries( trans, request.user )
num_samples_to_add = int( params.get( 'num_sample_to_copy', 1 ) )
# See if the user has selected a sample to copy.
copy_sample_index = int( params.get( 'copy_sample_index', -1 ) )
@@ -1186,9 +1185,9 @@ class RequestsCommon( BaseController, Us
# the first time a bar code was added to the sample, so change it's state
# to the next associated SampleState.
if sample.state.id == request.type.states[0].id:
- event = trans.app.model.SampleEvent(sample,
- request.type.states[1],
- 'Bar code associated with the sample' )
+ event = trans.model.SampleEvent( sample,
+ request.type.states[1],
+ 'Bar code associated with the sample' )
trans.sa_session.add( event )
trans.sa_session.flush()
sample.bar_code = bar_code
@@ -1216,6 +1215,19 @@ class RequestsCommon( BaseController, Us
folder = None
return library, folder
# ===== Methods for handling form definition widgets =====
+ def __get_accessible_libraries( self, trans, user ):
+ # Return a dictionary whose keys are libraries that user can
+ # access and whose values are empty string ''. This is because
+ # methods expect the dictionary instead of a simple list because
+ # this method replaces the deprecated model.User.accessible_libraries()
+ # method. TODO: fix methods that call this method to expect the list
+ # returne dby trans.app.securoty_agent.get_accessible_libraries() and
+ # then eliminate this method.
+ accessible_libraries = trans.app.security_agent.get_accessible_libraries( trans, user )
+ accessible_libraries_dict = odict()
+ for library in accessible_libraries:
+ accessible_libraries_dict[ library ] = ''
+ return accessible_libraries_dict
def __get_request_widgets( self, trans, id ):
"""Get the widgets for the request"""
request = trans.sa_session.query( trans.model.Request ).get( id )
@@ -1263,8 +1275,7 @@ class RequestsCommon( BaseController, Us
# Build the list of widgets which will be used to render each sample row on the request page
if not request:
return sample_widgets
- # Get the list of libraries for which the current user has permission to add items.
- libraries = request.user.accessible_libraries( trans, [ trans.app.security_agent.permitted_actions.LIBRARY_ADD ] )
+ libraries = self.__get_accessible_libraries( trans, request.user )
# Build the list if sample widgets, populating the values from kwd.
for index, sample in enumerate( samples ):
id_index = index + 1
--- a/lib/galaxy/webapps/community/__init__.py
+++ b/lib/galaxy/webapps/community/__init__.py
@@ -1,3 +1,3 @@
-"""The Galaxy Reports application."""
+"""The Galaxy Tool Shed application."""
from galaxy.web.framework import expose, url_for
--- a/lib/galaxy/security/__init__.py
+++ b/lib/galaxy/security/__init__.py
@@ -74,6 +74,8 @@ class RBACAgent:
raise "Unimplemented Method"
def make_library_public( self, library ):
raise "Unimplemented Method"
+ def get_accessible_libraries( self, trans, user ):
+ raise "Unimplemented Method"
def folder_is_public( self, library ):
raise "Unimplemented Method"
def make_folder_public( self, folder, count=0 ):
@@ -244,6 +246,26 @@ class GalaxyRBACAgent( RBACAgent ):
return self.allow_action( roles, self.permitted_actions.DATASET_MANAGE_PERMISSIONS, dataset )
def can_access_library( self, roles, library ):
return self.library_is_public( library ) or self.allow_action( roles, self.permitted_actions.LIBRARY_ACCESS, library )
+ def get_accessible_libraries( self, trans, user ):
+ """Return all data libraries that user can access"""
+ accessible_libraries = []
+ current_user_role_ids = [ role.id for role in user.all_roles() ]
+ library_access_action = self.permitted_actions.LIBRARY_ACCESS.action
+ restricted_library_ids = [ lp.library_id for lp in trans.sa_session.query( trans.model.LibraryPermissions ) \
+ .filter( trans.model.LibraryPermissions.table.c.action == library_access_action ) \
+ .distinct() ]
+ accessible_restricted_library_ids = [ lp.library_id for lp in trans.sa_session.query( trans.model.LibraryPermissions ) \
+ .filter( and_( trans.model.LibraryPermissions.table.c.action == library_access_action,
+ trans.model.LibraryPermissions.table.c.role_id.in_( current_user_role_ids ) ) ) ]
+ # Filter to get libraries accessible by the current user. Get both
+ # public libraries and restricted libraries accessible by the current user.
+ for library in trans.sa_session.query( trans.model.Library ) \
+ .filter( and_( trans.model.Library.table.c.deleted == False,
+ ( or_( not_( trans.model.Library.table.c.id.in_( restricted_library_ids ) ),
+ trans.model.Library.table.c.id.in_( accessible_restricted_library_ids ) ) ) ) ) \
+ .order_by( trans.app.model.Library.name ):
+ accessible_libraries.append( library )
+ return accessible_libraries
def can_access_library_item( self, roles, item, user ):
if type( item ) == self.model.Library:
return self.can_access_library( roles, item )
1
0
galaxy-dist commit bbc0f56e3e16: A few more bug fixes in the new sample tracking code.
by commits-noreply@bitbucket.org 20 Nov '10
by commits-noreply@bitbucket.org 20 Nov '10
20 Nov '10
# HG changeset patch -- Bitbucket.org
# Project galaxy-dist
# URL http://bitbucket.org/galaxy/galaxy-dist/overview
# User Greg Von Kuster <greg(a)bx.psu.edu>
# Date 1289427445 18000
# Node ID bbc0f56e3e16f93bf3c81d09b0fa12876a3f2579
# Parent b1813ff5bb4ef20d0b5d5a1fdcfc16cf6ec3ba53
A few more bug fixes in the new sample tracking code.
--- a/templates/admin/requests/select_datasets_to_transfer.mako
+++ b/templates/admin/requests/select_datasets_to_transfer.mako
@@ -127,7 +127,7 @@
</div>
%if sample and sample.datasets:
- <% title = 'Datasets currently selected for "%s"' % sample.name %>
+ <% title = 'All selected datasets for "%s"' % sample.name %><p/>
${render_sample_datasets( 'requests_admin', sample, sample.datasets, title )}
%endif
--- a/lib/galaxy/web/controllers/requests_common.py
+++ b/lib/galaxy/web/controllers/requests_common.py
@@ -952,9 +952,10 @@ class RequestsCommon( BaseController, Us
sample_datasets = sample.transfer_error_dataset_files
return trans.fill_template( '/requests/common/view_sample_datasets.mako',
cntrller=cntrller,
+ title=title,
sample=sample,
sample_datasets=sample_datasets,
- transfer_status=transferr_status,
+ transfer_status=transfer_status,
message=message,
status=status,
files=[],
--- a/templates/requests/common/common.mako
+++ b/templates/requests/common/common.mako
@@ -329,10 +329,26 @@
%endif
</td><td>
- %if is_admin and sample.untransferred_dataset_files:
- <a id="sampleDatasets-${sample.id}" href="${h.url_for( controller='requests_admin', action='manage_datasets', cntrller=cntrller, sample_id=trans.security.encode_id( sample.id ) )}">${len( sample.transferred_dataset_files )}</a>
+ %if is_admin:
+ %if sample.untransferred_dataset_files:
+ ## At least 1 selected dataset is not yet transferred, so this link
+ ## will direct the admin to a page allowing them to transfer datasets.
+ <a href="${h.url_for( controller='requests_common', action='manage_datasets', cntrller=cntrller, sample_id=trans.security.encode_id( sample.id ) )}">${len( sample.transferred_dataset_files )}</a>
+ %else:
+ ## All selected datasets have successfully transferred, so this link
+ ## will direct the admin to a page displaying all transferred datasets.
+ <a href="${h.url_for( controller='requests_common', action='view_sample_datasets', cntrller=cntrller, sample_id=trans.security.encode_id( sample.id ), transfer_status=trans.model.SampleDataset.transfer_status.COMPLETE )}">${len( sample.transferred_dataset_files )}</a>
+ %endif
%else:
- ${len( sample.transferred_dataset_files )}
+ %if sample.transferred_dataset_files:
+ ## The cuurent user is not an admin, so this link will direct the
+ ## user to the target data library containing those datasets that
+ ## were successfully transferred.
+ <a href="${h.url_for( controller='library_common', action='browse_library', cntrller='library', id=trans.security.encode_id( sample.library.id ) )}">${len( sample.transferred_dataset_files )}</a>
+ %else:
+ ## Display a 0 with no link.
+ ${len( sample.transferred_dataset_files )}
+ %endif
%endif
</td>
%endif
--- a/templates/requests/common/view_sample_datasets.mako
+++ b/templates/requests/common/view_sample_datasets.mako
@@ -40,4 +40,5 @@
No datasets with status ${transfer_status}" belong to this sample
%else:
No datasets have been selected for this sample.
+ %endif
%endif
1
0
galaxy-dist commit 7ea4c156ae32: Add a pop-up menu for a sample if it is possible to either select datasets to transfer or transfer selected datasets for the sample. Also use better naming convention for a key variable name.
by commits-noreply@bitbucket.org 20 Nov '10
by commits-noreply@bitbucket.org 20 Nov '10
20 Nov '10
# HG changeset patch -- Bitbucket.org
# Project galaxy-dist
# URL http://bitbucket.org/galaxy/galaxy-dist/overview
# User Greg Von Kuster <greg(a)bx.psu.edu>
# Date 1289492968 18000
# Node ID 7ea4c156ae32c4757378229bfc49584df91a024a
# Parent 591c53b44ae4a6237a841adaa3abfe59829beebe
Add a pop-up menu for a sample if it is possible to either select datasets to transfer or transfer selected datasets for the sample. Also use better naming convention for a key variable name.
--- a/lib/galaxy/web/controllers/requests_common.py
+++ b/lib/galaxy/web/controllers/requests_common.py
@@ -212,14 +212,14 @@ class RequestsCommon( BaseController, Us
except:
return invalid_id_redirect( trans, cntrller, request_id )
sample_state_id = params.get( 'sample_state_id', None )
- # Get the user entered sample information
- current_samples = self.__get_sample_widgets( trans, request, request.samples, **kwd )
+ # Build a list of sample widgets (based on the attributes of each sample) for display.
+ displayable_sample_widgets = self.__get_sample_widgets( trans, request, request.samples, **kwd )
request_widgets = self.__get_request_widgets( trans, request.id )
return trans.fill_template( '/requests/common/view_request.mako',
cntrller=cntrller,
request=request,
request_widgets=request_widgets,
- current_samples=current_samples,
+ displayable_sample_widgets=displayable_sample_widgets,
status=status,
message=message )
@web.expose
@@ -415,8 +415,8 @@ class RequestsCommon( BaseController, Us
editing_samples=editing_samples ) )
# Get all libraries for which the current user has permission to add items.
libraries = request.user.accessible_libraries( trans, [ trans.app.security_agent.permitted_actions.LIBRARY_ADD ] )
- # Get the user entered sample information
- current_samples = self.__get_sample_widgets( trans, request, request.samples, **kwd )
+ # Build a list of sample widgets (based on the attributes of each sample) for display.
+ displayable_sample_widgets = self.__get_sample_widgets( trans, request, request.samples, **kwd )
encoded_selected_sample_ids = self.__get_encoded_selected_sample_ids( trans, request, **kwd )
sample_operation = params.get( 'sample_operation', 'none' )
def handle_error( **kwd ):
@@ -433,14 +433,17 @@ class RequestsCommon( BaseController, Us
handle_error( **kwd )
if params.get( 'import_samples_button', False ):
# Import sample field values from a csv file
- return self.__import_samples( trans, cntrller, request, current_samples, libraries, **kwd )
+ return self.__import_samples( trans, cntrller, request, displayable_sample_widgets, libraries, **kwd )
elif params.get( 'add_sample_button', False ):
return self.add_sample( trans, cntrller, request_id, **kwd )
elif params.get( 'save_samples_button', False ):
if encoded_selected_sample_ids:
- # This gets tricky because we need the list of samples to include the same number
- # of objects that that current_samples ( i.e., request.samples ) has. We'll first
- # get the set of samples corresponding to the checked sample ids.
+ # We need the list of displayable_sample_widgets to include the same number
+ # of objects that that request.samples has so that we can enumerate over each
+ # list without problems. We have to be careful here since the user may have
+ # used the multi-select check boxes when editing sample widgets, but didn't
+ # select all of them. We'll first get the set of samples corresponding to the
+ # checked sample ids.
samples = []
selected_samples = []
for encoded_sample_id in encoded_selected_sample_ids:
@@ -453,12 +456,12 @@ class RequestsCommon( BaseController, Us
else:
samples.append( None )
# The __save_samples method requires sample_widgets, not sample objects
- samples = self.__get_sample_widgets( trans, request, samples, **kwd )
+ sample_widgets = self.__get_sample_widgets( trans, request, samples, **kwd )
else:
- samples = current_samples
- return self.__save_samples( trans, cntrller, request, samples, **kwd )
+ sample_widgets = displayable_sample_widgets
+ return self.__save_samples( trans, cntrller, request, sample_widgets, **kwd )
request_widgets = self.__get_request_widgets( trans, request.id )
- sample_copy = self.__build_copy_sample_select_field( trans, current_samples )
+ sample_copy = self.__build_copy_sample_select_field( trans, displayable_sample_widgets )
libraries_select_field, folders_select_field = self.__build_library_and_folder_select_fields( trans,
request.user,
0,
@@ -473,7 +476,7 @@ class RequestsCommon( BaseController, Us
request=request,
encoded_selected_sample_ids=encoded_selected_sample_ids,
request_widgets=request_widgets,
- current_samples=current_samples,
+ displayable_sample_widgets=displayable_sample_widgets,
sample_copy=sample_copy,
libraries=libraries,
sample_operation_select_field=sample_operation_select_field,
@@ -805,12 +808,12 @@ class RequestsCommon( BaseController, Us
is_admin = cntrller == 'requests_admin' and trans.user_is_admin()
# Get the widgets for rendering the request form
request_widgets = self.__get_request_widgets( trans, request.id )
- current_samples = self.__get_sample_widgets( trans, request, request.samples, **kwd )
- if not current_samples:
+ displayable_sample_widgets = self.__get_sample_widgets( trans, request, request.samples, **kwd )
+ if not displayable_sample_widgets:
# Form field names are zero-based.
sample_index = 0
else:
- sample_index = len( current_samples )
+ sample_index = len( displayable_sample_widgets )
if params.get( 'add_sample_button', False ):
# Get all libraries for which the current user has permission to add items
libraries = request.user.accessible_libraries( trans, [ trans.app.security_agent.permitted_actions.LIBRARY_ADD ] )
@@ -818,18 +821,18 @@ class RequestsCommon( BaseController, Us
# See if the user has selected a sample to copy.
copy_sample_index = int( params.get( 'copy_sample_index', -1 ) )
for index in range( num_samples_to_add ):
- id_index = len( current_samples ) + 1
+ id_index = len( displayable_sample_widgets ) + 1
if copy_sample_index != -1:
# The user has selected a sample to copy.
- library_id = current_samples[ copy_sample_index][ 'library_select_field' ].get_selected( return_value=True )
- folder_id = current_samples[ copy_sample_index ][ 'folder_select_field' ].get_selected( return_value=True )
- name = current_samples[ copy_sample_index ][ 'name' ] + '_%i' % ( len( current_samples ) + 1 )
- field_values = [ val for val in current_samples[ copy_sample_index ][ 'field_values' ] ]
+ library_id = displayable_sample_widgets[ copy_sample_index][ 'library_select_field' ].get_selected( return_value=True )
+ folder_id = displayable_sample_widgets[ copy_sample_index ][ 'folder_select_field' ].get_selected( return_value=True )
+ name = displayable_sample_widgets[ copy_sample_index ][ 'name' ] + '_%i' % ( len( displayable_sample_widgets ) + 1 )
+ field_values = [ val for val in displayable_sample_widgets[ copy_sample_index ][ 'field_values' ] ]
else:
# The user has not selected a sample to copy, just adding a new generic sample.
library_id = None
folder_id = None
- name = 'Sample_%i' % ( len( current_samples ) + 1 )
+ name = 'Sample_%i' % ( len( displayable_sample_widgets ) + 1 )
field_values = [ '' for field in request.type.sample_form.fields ]
# Build the library_select_field and folder_select_field for the new sample being added.
library_select_field, folder_select_field = self.__build_library_and_folder_select_fields( trans,
@@ -841,25 +844,26 @@ class RequestsCommon( BaseController, Us
folder_id=folder_id,
**kwd )
# Append the new sample to the current list of samples for the request
- current_samples.append( dict( name=name,
- barcode='',
- library=None,
- library_id=library_id,
- folder=None,
- folder_id=folder_id,
- field_values=field_values,
- library_select_field=library_select_field,
- folder_select_field=folder_select_field ) )
+ displayable_sample_widgets.append( dict( id=None,
+ name=name,
+ barcode='',
+ library=None,
+ library_id=library_id,
+ folder=None,
+ folder_id=folder_id,
+ field_values=field_values,
+ library_select_field=library_select_field,
+ folder_select_field=folder_select_field ) )
encoded_selected_sample_ids = self.__get_encoded_selected_sample_ids( trans, request, **kwd )
sample_operation = params.get( 'sample_operation', 'none' )
sample_operation_select_field = self.__build_sample_operation_select_field( trans, is_admin, request, sample_operation )
- sample_copy = self.__build_copy_sample_select_field( trans, current_samples )
+ sample_copy = self.__build_copy_sample_select_field( trans, displayable_sample_widgets )
return trans.fill_template( '/requests/common/edit_samples.mako',
cntrller=cntrller,
request=request,
encoded_selected_sample_ids=encoded_selected_sample_ids,
request_widgets=request_widgets,
- current_samples=current_samples,
+ displayable_sample_widgets=displayable_sample_widgets,
sample_operation_select_field=sample_operation_select_field,
sample_copy=sample_copy,
editing_samples=False,
@@ -876,9 +880,9 @@ class RequestsCommon( BaseController, Us
request = trans.sa_session.query( trans.model.Request ).get( trans.security.decode_id( request_id ) )
except:
return invalid_id_redirect( trans, cntrller, request_id )
- current_samples = self.__get_sample_widgets( trans, request, request.samples, **kwd )
+ displayable_sample_widgets = self.__get_sample_widgets( trans, request, request.samples, **kwd )
sample_index = int( params.get( 'sample_id', 0 ) )
- sample_name = current_samples[sample_index]['name']
+ sample_name = displayable_sample_widgets[sample_index]['name']
sample = request.has_sample( sample_name )
if sample:
trans.sa_session.delete( sample.values )
@@ -960,7 +964,7 @@ class RequestsCommon( BaseController, Us
status=status,
files=[],
folder_path=folder_path )
- def __import_samples( self, trans, cntrller, request, current_samples, libraries, **kwd ):
+ def __import_samples( self, trans, cntrller, request, displayable_sample_widgets, libraries, **kwd ):
"""
Reads the samples csv file and imports all the samples. The format of the csv file is:
SampleName,DataLibrary,DataLibraryFolder,Field1,Field2....
@@ -987,19 +991,20 @@ class RequestsCommon( BaseController, Us
folder_id = folder.id
library_select_field, folder_select_field = self.__build_library_and_folder_select_fields( trans,
request.user,
- len( current_samples ),
+ len( displayable_sample_widgets ),
libraries,
None,
library_id,
folder_id,
**kwd )
- current_samples.append( dict( name=row[0],
- barcode='',
- library=None,
- folder=None,
- library_select_field=library_select_field,
- folder_select_field=folder_select_field,
- field_values=row[3:] ) )
+ displayable_sample_widgets.append( dict( id=None,
+ name=row[0],
+ barcode='',
+ library=None,
+ folder=None,
+ library_select_field=library_select_field,
+ folder_select_field=folder_select_field,
+ field_values=row[3:] ) )
except Exception, e:
if str( e ) == "'unicode' object has no attribute 'file'":
message = "Select a file"
@@ -1014,12 +1019,12 @@ class RequestsCommon( BaseController, Us
status='error',
message=message ) )
request_widgets = self.__get_request_widgets( trans, request.id )
- sample_copy = self.__build_copy_sample_select_field( trans, current_samples )
+ sample_copy = self.__build_copy_sample_select_field( trans, displayable_sample_widgets )
return trans.fill_template( '/requests/common/edit_samples.mako',
cntrller=cntrller,
request=request,
request_widgets=request_widgets,
- current_samples=current_samples,
+ displayable_sample_widgets=displayable_sample_widgets,
sample_copy=sample_copy,
editing_samples=False )
def __save_samples( self, trans, cntrller, request, samples, **kwd ):
@@ -1110,17 +1115,17 @@ class RequestsCommon( BaseController, Us
# by the admin ( i.e., the sample's SampleState would be set to request.type.states[0] ).
for index in range( len( samples ) - len( request.samples ) ):
sample_index = len( request.samples )
- current_sample = samples[ sample_index ]
- form_values = trans.model.FormValues( request.type.sample_form, current_sample[ 'field_values' ] )
+ sample_widget = samples[ sample_index ]
+ form_values = trans.model.FormValues( request.type.sample_form, sample_widget[ 'field_values' ] )
trans.sa_session.add( form_values )
trans.sa_session.flush()
- s = trans.model.Sample( name=current_sample[ 'name' ],
+ s = trans.model.Sample( name=sample_widget[ 'name' ],
desc='',
request=request,
form_values=form_values,
bar_code='',
- library=current_sample[ 'library' ],
- folder=current_sample[ 'folder' ] )
+ library=sample_widget[ 'library' ],
+ folder=sample_widget[ 'folder' ] )
trans.sa_session.add( s )
trans.sa_session.flush()
return trans.response.send_redirect( web.url_for( controller='requests_common',
@@ -1264,9 +1269,9 @@ class RequestsCommon( BaseController, Us
for index, sample in enumerate( samples ):
id_index = index + 1
if sample is None:
- # Id sample is None, then we'll use the sample from the request object since it will
- # not have updated =values from kwd.
+ # Use the sample from the request object since it will not have updated values from kwd.
sample = request.samples[ index ]
+ sample_id = sample.id
name = sample.name
bar_code = sample.bar_code
library = sample.library
@@ -1274,6 +1279,7 @@ class RequestsCommon( BaseController, Us
field_values = sample.values.content
else:
# Update the sample attributes from kwd
+ sample_id = None
name = util.restore_text( params.get( 'sample_%i_name' % index, sample.name ) )
bar_code = util.restore_text( params.get( 'sample_%i_barcode' % index, sample.bar_code ) )
library_id = util.restore_text( params.get( 'sample_%i_library_id' % id_index, '' ) )
@@ -1295,7 +1301,8 @@ class RequestsCommon( BaseController, Us
library_id=library_id,
folder_id=folder_id,
**kwd )
- sample_widgets.append( dict( name=name,
+ sample_widgets.append( dict( id=sample_id,
+ name=name,
barcode=bar_code,
library=library,
folder=folder,
@@ -1325,7 +1332,8 @@ class RequestsCommon( BaseController, Us
library_id=library_id,
folder_id=folder_id,
**kwd )
- sample_widgets.append( dict( name=name,
+ sample_widgets.append( dict( id=None,
+ name=name,
barcode=bar_code,
library=library,
folder=folder,
@@ -1335,10 +1343,10 @@ class RequestsCommon( BaseController, Us
index += 1
return sample_widgets
# ===== Methods for building SelectFields used on various request forms =====
- def __build_copy_sample_select_field( self, trans, current_samples ):
+ def __build_copy_sample_select_field( self, trans, displayable_sample_widgets ):
copy_sample_index_select_field = SelectField( 'copy_sample_index' )
copy_sample_index_select_field.add_option( 'None', -1, selected=True )
- for index, sample_dict in enumerate( current_samples ):
+ for index, sample_dict in enumerate( displayable_sample_widgets ):
copy_sample_index_select_field.add_option( sample_dict[ 'name' ], index )
return copy_sample_index_select_field
def __build_request_type_id_select_field( self, trans, selected_value='none' ):
@@ -1458,20 +1466,20 @@ class RequestsCommon( BaseController, Us
message += '<b>' + ef + '</b> '
return message
return None
- def __validate_sample_names( self, trans, cntrller, request, current_samples, **kwd ):
+ def __validate_sample_names( self, trans, cntrller, request, displayable_sample_widgets, **kwd ):
# Check for duplicate sample names for all samples of the request.
editing_samples = util.string_as_bool( kwd.get( 'editing_samples', False ) )
message = ''
- for index in range( len( current_samples ) - len( request.samples ) ):
+ for index in range( len( displayable_sample_widgets ) - len( request.samples ) ):
sample_index = index + len( request.samples )
- current_sample = current_samples[ sample_index ]
- sample_name = current_sample[ 'name' ]
+ sample_widget = displayable_sample_widgets[ sample_index ]
+ sample_name = sample_widget[ 'name' ]
if not sample_name.strip():
message = 'Enter the name of sample number %i' % sample_index
break
count = 0
- for i in range( len( current_samples ) ):
- if sample_name == current_samples[ i ][ 'name' ]:
+ for i in range( len( displayable_sample_widgets ) ):
+ if sample_name == displayable_sample_widgets[ i ][ 'name' ]:
count += 1
if count > 1:
message = "You tried to add %i samples with the name (%s). Samples belonging to a request must have unique names." % ( count, sample_name )
--- a/templates/requests/common/common.mako
+++ b/templates/requests/common/common.mako
@@ -113,7 +113,7 @@
</script></%def>
-<%def name="render_editable_sample_row( cntrller, sample, current_sample_index, current_sample, encoded_selected_sample_ids )">
+<%def name="render_editable_sample_row( cntrller, sample, sample_widget_index, sample_widget, encoded_selected_sample_ids )"><%
is_admin = cntrller == 'requests_admin' and trans.user_is_admin()
if sample:
@@ -145,7 +145,7 @@
<td><input type="checkbox" name=select_sample_${sample.id} id="sample_checkbox" value="true" ${checked_str}/><input type="hidden" name=select_sample_${sample.id} id="sample_checkbox" value="true"/></td>
%endif
<td valign="top">
- <input type="text" name="sample_${current_sample_index}_name" value="${current_sample['name']}" size="10"/>
+ <input type="text" name="sample_${sample_widget_index}_name" value="${sample_widget['name']}" size="10"/><div class="toolParamHelp" style="clear: both;"><i>${' (required)' }</i></div>
@@ -153,10 +153,10 @@
%if display_bar_code:
<td valign="top">
%if is_admin:
- <input type="text" name="sample_${current_sample_index}_barcode" value="${current_sample['barcode']}" size="10"/>
+ <input type="text" name="sample_${sample_widget_index}_barcode" value="${sample_widget['barcode']}" size="10"/>
%else:
- ${current_sample['barcode']}
- <input type="hidden" name="sample_${current_sample_index}_barcode" value="${current_sample['barcode']}"/>
+ ${sample_widget['barcode']}
+ <input type="hidden" name="sample_${sample_widget_index}_barcode" value="${sample_widget['barcode']}"/>
%endif
</td>
%endif
@@ -169,8 +169,8 @@
%else:
<td></td>
%endif
- <td valign="top">${current_sample['library_select_field'].get_html()}</td>
- <td valign="top">${current_sample['folder_select_field'].get_html()}</td>
+ <td valign="top">${sample_widget['library_select_field'].get_html()}</td>
+ <td valign="top">${sample_widget['folder_select_field'].get_html()}</td>
%if display_datasets:
<td valign="top">
## An admin can select the datasets to transfer, while a non-admin can only view what has been selected
@@ -220,11 +220,11 @@
%endif
%if can_delete_samples:
## Delete button
- <td valign="top"><a class="action-button" href="${h.url_for( controller='requests_common', action='delete_sample', cntrller=cntrller, request_id=trans.security.encode_id( request.id ), sample_id=current_sample_index )}"><img src="${h.url_for('/static/images/delete_icon.png')}" style="cursor:pointer;"/></a></td>
+ <td valign="top"><a class="action-button" href="${h.url_for( controller='requests_common', action='delete_sample', cntrller=cntrller, request_id=trans.security.encode_id( request.id ), sample_id=sample_widget_index )}"><img src="${h.url_for('/static/images/delete_icon.png')}" style="cursor:pointer;"/></a></td>
%endif
</%def>
-<%def name="render_samples_grid( cntrller, request, current_samples, action, editing_samples=False, encoded_selected_sample_ids=[], render_buttons=False, grid_header='<h3>Samples</h3>' )">
+<%def name="render_samples_grid( cntrller, request, displayable_sample_widgets, action, editing_samples=False, encoded_selected_sample_ids=[], render_buttons=False, grid_header='<h3>Samples</h3>' )">
## Displays the "Samples" grid
<%
trans.sa_session.refresh( request )
@@ -236,7 +236,8 @@
can_add_samples = request.is_unsubmitted
can_delete_samples = editing_samples and request.samples and not is_complete
can_edit_samples = request.samples and ( is_admin or not is_complete )
- can_select_datasets = is_admin and current_samples and ( is_submitted or is_complete )
+ can_select_datasets = is_admin and displayable_sample_widgets and ( is_submitted or is_complete )
+ can_transfer_datasets = is_admin and request.samples and not request.is_rejected
display_checkboxes = editing_samples and ( is_complete or is_rejected or is_submitted )
display_bar_code = request.samples and ( is_complete or is_rejected or is_submitted )
display_datasets = request.samples and ( is_complete or is_submitted )
@@ -278,46 +279,67 @@
<thead><tbody><% trans.sa_session.refresh( request ) %>
- ## current_samples is a dictionary whose keys are:
- ## name, barcode, library, folder, field_values, library_select_field, folder_select_field
- %for current_sample_index, current_sample in enumerate( current_samples ):
+ ## displayable_sample_widgets is a dictionary whose keys are:
+ ## id, name, barcode, library, folder, field_values, library_select_field, folder_select_field
+ ## A displayable_sample_widget will have an id == None if the widget's associated sample has not
+ ## yet been saved (i.e., the use clicked the "Add sample" button but has not yet clicked the
+ ## "Save" button.
+ %for sample_widget_index, sample_widget in enumerate( displayable_sample_widgets ):
<%
- current_sample_name = current_sample[ 'name' ]
- current_sample_barcode = current_sample[ 'barcode' ]
- current_sample_library = current_sample[ 'library' ]
- if current_sample_library:
+ sample_widget_name = sample_widget[ 'name' ]
+ sample_widget_barcode = sample_widget[ 'barcode' ]
+ sample_widget_library = sample_widget[ 'library' ]
+ if sample_widget_library:
if cntrller == 'requests':
library_cntrller = 'library'
elif is_admin:
library_cntrller = 'library_admin'
else:
library_cntrller = None
- current_sample_folder = current_sample[ 'folder' ]
+ sample_widget_folder = sample_widget[ 'folder' ]
try:
- sample = request.samples[ current_sample_index ]
+ sample = request.samples[ sample_widget_index ]
except:
sample = None
%>
%if editing_samples:
- <tr>${render_editable_sample_row( cntrller, sample, current_sample_index, current_sample, encoded_selected_sample_ids )}</tr>
+ <tr>${render_editable_sample_row( cntrller, sample, sample_widget_index, sample_widget, encoded_selected_sample_ids )}</tr>
%elif sample:
<tr>
- <td>${current_sample_name}</td>
+ <td>
+ %if sample.state and ( can_select_datasets or can_transfer_datasets ):
+ ## A sample will have a state only after the request has been submitted.
+ <% encoded_id = trans.security.encode_id( sample.id ) %>
+ <div style="float: left; margin-left: 2px;" class="menubutton split popup" id="sample-${sample.id}-popup">
+ ${sample.name}
+ </div>
+ <div popupmenu="sample-${sample.id}-popup">
+ %if can_select_datasets:
+ <li><a class="action-button" href="${h.url_for( controller='requests_admin', action='select_datasets_to_transfer', request_id=trans.security.encode_id( request.id ), sample_id=trans.security.encode_id( sample.id ) )}">Select datasets to transfer</a></li>
+ %endif
+ %if sample.untransferred_dataset_files:
+ <li><a class="action-button" href="${h.url_for( controller='requests_admin', action='manage_datasets', sample_id=trans.security.encode_id( sample.id ) )}">Transfer datasets</a></li>
+ %endif
+ </div>
+ %else:
+ ${sample_widget_name}
+ %endif
+ </td>
%if display_bar_code:
- <td>${current_sample_barcode}</td>
+ <td>${sample_widget_barcode}</td>
%endif
%if is_unsubmitted:
<td>Unsubmitted</td>
%else:
<td><a id="sampleState-${sample.id}" href="${h.url_for( controller='requests_common', action='sample_events', cntrller=cntrller, sample_id=trans.security.encode_id( sample.id ) )}">${render_sample_state( sample )}</a></td>
%endif
- %if current_sample_library and library_cntrller is not None:
- <td><a href="${h.url_for( controller='library_common', action='browse_library', cntrller=library_cntrller, id=trans.security.encode_id( current_sample_library.id ) )}">${current_sample_library.name}</a></td>
+ %if sample_widget_library and library_cntrller is not None:
+ <td><a href="${h.url_for( controller='library_common', action='browse_library', cntrller=library_cntrller, id=trans.security.encode_id( sample_widget_library.id ) )}">${sample_widget_library.name}</a></td>
%else:
<td></td>
%endif
- %if current_sample_folder:
- <td>${current_sample_folder.name}</td>
+ %if sample_widget_folder:
+ <td>${sample_widget_folder.name}</td>
%else:
<td></td>
%endif
@@ -371,7 +393,7 @@
</tr>
%else:
## The Add sample button was clicked for this sample_widget
- <tr>${render_editable_sample_row( cntrller, None, current_sample_index, current_sample, encoded_selected_sample_ids )}</tr>
+ <tr>${render_editable_sample_row( cntrller, None, sample_widget_index, sample_widget, encoded_selected_sample_ids )}</tr>
%endif
%endfor
</tbody>
@@ -439,7 +461,7 @@
</tr></%def>
-<%def name="render_request_type_sample_form_grids( grid_index, grid_name, fields_dict, current_samples, editing_samples )">
+<%def name="render_request_type_sample_form_grids( grid_index, grid_name, fields_dict, displayable_sample_widgets, editing_samples )"><%
if not grid_name:
grid_name = "Sample form layout " + grid_index
@@ -466,7 +488,7 @@
<thead><tbody><% trans.sa_session.refresh( request ) %>
- %for sample_index, sample in enumerate( current_samples ):
+ %for sample_index, sample in enumerate( displayable_sample_widgets ):
<%
if editing_samples or sample_index >= len( request.samples ):
display_only = False
@@ -505,7 +527,7 @@
<tr><td>
%if is_admin:
- <% encoded_id = trans.security.encode_id(dataset.id) %>
+ <% encoded_id = trans.security.encode_id( dataset.id ) %><span class="expandLink dataset-${dataset}-click"><span class="rowIcon"></span><div style="float: left; margin-left: 2px;" class="menubutton split popup" id="dataset-${dataset.id}-popup"><a class="dataset-${encoded_id}-click" href="${h.url_for( controller='requests_admin', action='manage_datasets', operation='view', id=trans.security.encode_id( dataset.id ) )}">${dataset.name}</a>
--- a/templates/requests/common/edit_samples.mako
+++ b/templates/requests/common/edit_samples.mako
@@ -72,14 +72,14 @@
<div class="toolFormBody"><form id="edit_samples" name="edit_samples" action="${h.url_for( controller='requests_common', action='edit_samples', cntrller=cntrller, id=trans.security.encode_id( request.id ), editing_samples=editing_samples )}" method="post">
- %if current_samples:
+ %if displayable_sample_widgets:
<%
if editing_samples:
grid_header = '<h3>Edit Current Samples of Request "%s"</h3>' % request.name
else:
grid_header = '<h3>Add Samples to Request "%s"</h3>' % request.name
%>
- ${render_samples_grid( cntrller, request, current_samples, action='edit_samples', editing_samples=editing_samples, encoded_selected_sample_ids=encoded_selected_sample_ids, render_buttons=False, grid_header=grid_header )}
+ ${render_samples_grid( cntrller, request, displayable_sample_widgets, action='edit_samples', editing_samples=editing_samples, encoded_selected_sample_ids=encoded_selected_sample_ids, render_buttons=False, grid_header=grid_header )}
%if editing_samples and len( sample_operation_select_field.options ) > 1 and not is_unsubmitted:
<div class="form-row" style="background-color:#FAFAFA;">
For selected samples:
@@ -118,14 +118,14 @@
## Render the other grids
<% trans.sa_session.refresh( request.type.sample_form ) %>
%for grid_index, grid_name in enumerate( request.type.sample_form.layout ):
- ${render_request_type_sample_form_grids( grid_index, grid_name, request.type.sample_form.grid_fields( grid_index ), current_samples=current_samples, editing_samples=editing_samples )}
+ ${render_request_type_sample_form_grids( grid_index, grid_name, request.type.sample_form.grid_fields( grid_index ), displayable_sample_widgets=displayable_sample_widgets, editing_samples=editing_samples )}
%endfor
%else:
<label>There are no samples.</label>
%endif
%if not editing_samples and is_unsubmitted:
## The user is adding a new sample
- %if current_samples:
+ %if displayable_sample_widgets:
<p/><div class="form-row"><label> Copy <input type="text" name="num_sample_to_copy" value="1" size="3"/> samples from sample ${sample_copy.get_html()}</label>
@@ -138,7 +138,7 @@
<div class="form-row">
## hidden element to make twill work.
<input type="hidden" name="hidden_input" value=""/>
- %if ( request.samples or current_samples ) and ( editing_samples or len( current_samples ) > len( request.samples ) ):
+ %if ( request.samples or displayable_sample_widgets ) and ( editing_samples or len( displayable_sample_widgets ) > len( request.samples ) ):
<input type="submit" name="add_sample_button" value="Add sample" /><input type="submit" name="save_samples_button" value="Save"/><input type="submit" name="cancel_changes_button" value="Cancel"/>
--- a/templates/requests/common/view_request.mako
+++ b/templates/requests/common/view_request.mako
@@ -148,12 +148,12 @@
</div></div><p/>
-%if current_samples:
+%if displayable_sample_widgets:
<%
grid_header = '<h3>Samples</h3>'
render_buttons = can_edit_samples
%>
- ${render_samples_grid( cntrller, request, current_samples=current_samples, action='view_request', editing_samples=False, encoded_selected_sample_ids=[], render_buttons=render_buttons, grid_header=grid_header )}
+ ${render_samples_grid( cntrller, request, displayable_sample_widgets=displayable_sample_widgets, action='view_request', editing_samples=False, encoded_selected_sample_ids=[], render_buttons=render_buttons, grid_header=grid_header )}
%else:
There are no samples.
%if can_add_samples:
@@ -165,5 +165,5 @@
## Render the other grids
<% trans.sa_session.refresh( request.type.sample_form ) %>
%for grid_index, grid_name in enumerate( request.type.sample_form.layout ):
- ${render_request_type_sample_form_grids( grid_index, grid_name, request.type.sample_form.grid_fields( grid_index ), current_samples=current_samples, editing_samples=False )}
+ ${render_request_type_sample_form_grids( grid_index, grid_name, request.type.sample_form.grid_fields( grid_index ), displayable_sample_widgets=displayable_sample_widgets, editing_samples=False )}
%endfor
1
0