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

Diann form #150

Merged
merged 3 commits into from
Aug 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
52 changes: 41 additions & 11 deletions webapp/home/forms.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
"""User facing forms for making support requests (help/tools/data)."""

import json
import logging
import bioblend
from django_recaptcha import fields
from django import forms
from django.conf import settings
Expand Down Expand Up @@ -267,6 +269,7 @@ def clean_email(self):
def action(self, request, resource):
error = None
actioned = False
is_registered_email = False
email = self.cleaned_data['email']
try:
is_registered_email = galaxy.is_registered_email(email)
Expand All @@ -276,8 +279,12 @@ def action(self, request, resource):
f"{str(exc)[:1000]}\n")
error = (
"Galaxy connection refused (could not check account"
" status)."
" status)"
)
if isinstance(exc, bioblend.ConnectionError):
data = json.loads(exc.body)
if data.get('err_msg'):
error += f": {data['err_msg']}"
# Admins will have to action this manually
actioned = self.dispatch(exception=error)

Expand Down Expand Up @@ -310,7 +317,7 @@ def action(self, request, resource):
msg = f"Dispatching {resource} warning to {email}"
logger.info(msg)
records_logger.info(msg)
self.dispatch_warning(request)
self.dispatch_warning(request, error=error is not None)

return actioned

Expand Down Expand Up @@ -355,12 +362,15 @@ def dispatch(self, exception=None, notify_user_success=True):
self.cleaned_data['email'],
self.RESOURCE_NAME,
)
actioned = not exception and self.AUTO_ACTION
return actioned
return self.AUTO_ACTION

def dispatch_warning(self, request):
def dispatch_warning(self, request, error=False):
"""Dispatch warning email to let user know their email is invalid."""
template = 'home/requests/mail/invalid-institutional-email'
template = (
'home/requests/mail/error'
if error else
'home/requests/mail/invalid-institutional-email'
)
dispatch_form_mail(
to_address=self.cleaned_data['email'],
subject=f"Access to {self.RESOURCE_NAME} could not be granted",
Expand Down Expand Up @@ -410,7 +420,7 @@ class FgeneshRequestForm(BaseAccessRequestForm):
terms = {
'button_text': 'View terms',
'src': static('home/documents/fgenesh-biocommons-terms.html'),
'agreement_name': 'FGENESH++ Service Terms of Use and Policies',
'agreement_name': f'{RESOURCE_NAME} Service Terms of Use and Policies',
}

def render_matrix_field(self):
Expand All @@ -426,7 +436,7 @@ def dispatch(self, exception=None, notify_user_success=False):


class CellRangerRequestForm(BaseAccessRequestForm):
"""Form to request AlphaFold access."""
"""Form to request Cell Ranger access."""

RESOURCE_NAME = 'Cell Ranger'
AUTO_ACTION = True
Expand All @@ -437,14 +447,34 @@ class CellRangerRequestForm(BaseAccessRequestForm):
agree_usage = forms.BooleanField()

terms = {
'button_text': 'View license agreement',
'button_text': 'View license',
'src': static('home/documents/cellranger-end-user-license.html'),
'agreement_name': 'Cell Ranger End User Licence Agreement',
'agreement_name': f'{RESOURCE_NAME} End User Licence Agreement',
}


class DiannRequestForm(BaseAccessRequestForm):
"""Form to request Diann access."""

RESOURCE_NAME = 'DIA-NN'
AUTO_ACTION = True

name = forms.CharField()
email = forms.EmailField(validators=[validators.institutional_email])
research_description = forms.CharField(max_length=500, required=False)
research_topics = forms.CharField(max_length=200, required=False)
agree_terms = forms.BooleanField()

terms = {
'button_text': 'View license',
'src': static('home/documents/diann-1.8-license.txt'),
'agreement_name': f'{RESOURCE_NAME} End User Licence Agreement',
}


ACCESS_FORMS = {
'alphafold': AlphafoldRequestForm,
'fgenesh': FgeneshRequestForm,
'cellranger': CellRangerRequestForm,
'diann': DiannRequestForm,
'fgenesh': FgeneshRequestForm,
}
6 changes: 6 additions & 0 deletions webapp/home/static/home/css/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,12 @@ textarea.invalid {
border-radius: .25rem;
transition-duration: .25s;
}
.ga-btn:focus {
box-shadow: var(--color) 0 0 5px 2px;
}
.ga-btn:focus-visible {
outline: 0;
}
.ga-btn.sm {
margin: .5rem;
padding: .15rem .35rem;
Expand Down
46 changes: 46 additions & 0 deletions webapp/home/static/home/documents/diann-1.8-license.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

1. General. The DIA-NN software is licensed to you for use only under the terms of this License,
and all rights not expressly granted to you are reserved. The rights granted herein are limited to Vadim Demichev’s intellectual
property rights in the DIA-NN software and do not include any other patents or intellectual property rights.

2. Permitted License Uses and Restrictions. This License allows you to install and use the DIA-NN software.
You may make one copy of the DIA-NN Software in machine-readable form for backup purposes only;
provided that the backup copy must include all copyright or other proprietary notices contained on the original.
Except as and only to the extent expressly permitted in this License or by applicable law, you may not copy, decompile,
reverse engineer, disassemble, attempt to derive the source code of, modify, or create derivative works of the DIA-NN software or any part thereof.

3. Transfer. You may not rent, lease, lend or sublicense the DIA-NN software. You may, however, make a one-time permanent transfer
of all of your license rights to the DIA-NN software to another party, provided that: (a) the transfer must include all of the DIA-NN software,
including all its component parts, original media, printed materials and this License; (b) you do not retain any copies of the DIA-NN software,
full or partial, including copies stored on a computer or other storage device; and (c) the party receiving the DIA-NN software reads
and agrees to accept the terms and conditions of this License.

4. Attribution. If you share, distribute or publish any materials that were produced using the DIA-NN software ("Derived Materials"), you must indicate
within these Derived Materials that they were produced using the DIA-NN software. You may satisfy this condition in any reasonable manner
based on the medium, means, and context in which you share the Derived Materials. For example, the required attribution can be expressed by including
one of the statements "Processed using DIA-NN", "Generated using DIA-NN" or "Produced using DIA-NN" in the Derived Materials.

5. All third-party software included in this DIA-NN software distribution retains its original license (see below).
For the inclusion in this DIA-NN software distribution, the source code of MSToolkit and MiniDNN was modified.

MiniDNN
- folder within this distribution: /MiniDNN
- URL: https://github.com/yixuan/MiniDNN
- License information: /MiniDNN/LICENSE.txt

MSToolkit
- folder within this distribution: /mstoolkit
- URL: https://github.com/mhoopmann/mstoolkit
- License information: /mstoolkit/LICENSE.txt

Eigen
- folder within this distribution: /eigen
- URL: http://eigen.tuxfamily.org/
- License information: eigen/COPYING.README
10 changes: 1 addition & 9 deletions webapp/home/templates/home/requests/access/alphafold.html
Original file line number Diff line number Diff line change
Expand Up @@ -130,15 +130,7 @@ <h2> Galaxy Australia AlphaFold 2 Access Request </h2>
</div>

<div class="container mb-10">
Privacy Collection Notice By completing this form you agree that your
responses will be provided to the Australian BioCommons and Galaxy
Australia and will be used solely for the purposes of determining
suitability for access to the Australian AlphaFold Service. Your
responses will be protected against unauthorised access and use; providing
your name is required to enable any follow ups. For more information,
please see the
<a href="https://www.biocommons.org.au/privacy/">
BioCommons Privacy Statement</a>.
{% include 'home/requests/access/snippets/privacy-collection-notice.html' %}
</div>

<div class="row mb-10">
Expand Down
10 changes: 1 addition & 9 deletions webapp/home/templates/home/requests/access/cellranger.html
Original file line number Diff line number Diff line change
Expand Up @@ -93,15 +93,7 @@ <h2> Galaxy Australia Cell Ranger Access Request </h2>
</div>

<div class="container mb-10">
<b>Privacy Collection Notice</b>: by completing this form you agree that your
responses will be provided to the Australian BioCommons and Galaxy
Australia and will be used solely for the purposes of determining
suitability for access to the Australian Cell Ranger Service. Your
responses will be protected against unauthorised access and use; providing
your name is required to enable any follow ups. For more information,
please see the
<a href="https://www.biocommons.org.au/privacy/">
BioCommons Privacy Statement</a>.
{% include 'home/requests/access/snippets/privacy-collection-notice.html' %}
</div>

<div class="row mb-10">
Expand Down
116 changes: 116 additions & 0 deletions webapp/home/templates/home/requests/access/diann.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
{% extends 'home/header.html' %}

{% load static %}


{% block head %}
<link rel="stylesheet" href="{% static 'home/css/requests.css' %}">
<link rel="stylesheet" href="{% static 'home/css/request-form.css' %}">
{% endblock %}


{% block content %}
<main class="container mt-4">

<div class="mb-10">
<h2> Galaxy Australia DIA-NN Access Request </h2>
<small>
<a href="/request/access">
<span class="material-icons">arrow_back</span>
Back to tool access menu
</a>
</small>
</div>

<p class="lead">
DIA-NN is a universal software for data-independent acquisition (DIA) proteomics data processing by the Demichev, Ralser and Lilley labs.
</p>

<p>
DIA-NN (v1.8.1) is available on Galaxy Australia for Australian researchers undertaking publicly funded research (i.e. using DIA-NN for academic research purposes).
</p>

<p>
Please apply for access, using your institutional email. The following sign up form is to confirm eligibility for access to DIA-NN on Galaxy Australia.
</p>

<form class="mt-10" method="post">

{% csrf_token %}

{{ form.non_field_errors }}

{% include 'home/requests/access/snippets/personal-details-fields.html' %}

<hr>

<div class="mb-10">
<h3 class="mb-3">Your research (optional)</h3>
<div class="form-group mb-3">
<label class="form-label" for="researchDescription">Please provide a brief description of your research</label>
<input
class="form-control"
id="researchDescription"
name="research_description"
type="text"
value="{{ form.research_description.value|default_if_none:'' }}"
/>
</div>
<div class="form-group mb-3">
<label class="form-label" for="researchTopics">Which broad topics best describe your research?</label>
<input
class="form-control"
id="researchTopics"
name="research_topics"
type="text"
value="{{ form.research_topics.value|default_if_none:'' }}"
/>
</div>
</div>

<hr>

<div class="row mb-10">
<div class="col-sm-12">
<h3 class="mb-3">License acknowledgement statement</h3>
<p>
The {{ form.RESOURCE_NAME }} DIA-NN license is required to be
acknowledged prior to access.
</p>

{% include 'home/requests/access/snippets/agree-terms-modal.html' %}

</div>
</div>

<hr>

<div class="container mb-10">
{% include 'home/requests/access/snippets/privacy-collection-notice.html' %}
</div>

<div class="row mb-10">
<div class="col text-center">
<button class='ga-btn' type="submit"> Submit </button>
</div>
</div>
</form>

</main>
{% endblock %}


{% block script %}
<script src="{% static 'home/js/forms.js' %}"></script>
<script>
function showAcceptLicense(acceptLicenseBtn) {
console.log("Button:")
console.log(acceptLicenseBtn);
$(acceptLicenseBtn).siblings('.form-check').show();
}
</script>
{% endblock %}


{% block onload %}
{% endblock %}
10 changes: 1 addition & 9 deletions webapp/home/templates/home/requests/access/fgenesh.html
Original file line number Diff line number Diff line change
Expand Up @@ -179,15 +179,7 @@ <h3 class="mb-3">Select matrices</h3>
<hr>

<div class="container mb-10">
<b>Privacy Collection Notice:</b> By completing this form you agree that your
responses will be provided to the Australian BioCommons and Galaxy
Australia and will be used solely for the purposes of determining
suitability for access to the Australian FGENESH++ Service. Your
responses will be protected against unauthorised access and use; providing
your name is required to enable any follow ups. For more information,
please see the
<a href="https://www.biocommons.org.au/privacy/">
BioCommons Privacy Statement</a>.
{% include 'home/requests/access/snippets/privacy-collection-notice.html' %}
</div>

<div class="row mb-10">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,14 @@ <h5 class="modal-title"></h5>
</div>

<script>

{% if form.terms.src|slice:"-4:" == ".txt" %}
const termsIframe = $('#termsModal iframe')
termsIframe.ready( () => termsIframe.contents()
.find('body')
.css('padding', '1rem'));
{% endif %}

function agreeTermsAction(el) {
enableTermsInput();
$('#agreeTermsInput').attr('checked', true);
Expand All @@ -91,7 +99,7 @@ <h5 class="modal-title"></h5>
}
$('#termsModal iframe').contents().on('scroll', (event) => {
const scrollFromEnd = $(termsContainer)[0].scrollHeight
- $(termsContainer).scrollTop()
- $('#termsModal iframe').contents().scrollTop()
- $('#termsModal iframe').height();
if (scrollFromEnd < 50) enableAgreeTermsButton();
});
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<h3>Data Privacy Notice</h3>
<p>
By completing this form you agree that your
responses will be provided to the Australian BioCommons and Galaxy
Australia and will be used solely for the purposes of determining
suitability for access to the Australian {{ form.RESOURCE_NAME }} Service. Your
responses will be protected against unauthorised access and use; providing
your name is required to enable any follow ups. For more information,
please see the
<a href="https://www.biocommons.org.au/privacy/">
BioCommons Privacy Statement</a>.
</p>
8 changes: 2 additions & 6 deletions webapp/home/templates/home/requests/mail/access-request.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,8 @@ <h3>Error actioning {{ resource_name }} access request - Galaxy Australia</h3>
<em style="font-size: 16pt; color: firebrick;">
&#128128; {{ failed_message }}
</em>
<p>
Exception: <br>
<code style="background-color: #f0d5cc; color: #c43f1a; font-size: 12pt; padding: 8px; max-height: 600px; max-width: 80%; overflow: auto;">
{{ exception }}
</code>
</p>
<pre style="background-color: #f0d5cc; color: #c43f1a; font-size: 0.9rem; padding: .5rem; max-height: 300px; overflow: auto;">{{ exception }}</code>
</pre>
{% else %}
<h3>New {{ resource_name }} access request submitted - Galaxy Australia</h3>
<em style="font-size: 16pt; color: forestgreen;">
Expand Down
Loading
Loading