Skip to content

Commit b59130f

Browse files
authored
Merge pull request #115 from broadinstitute/development
Ideogram.js, Cell Ranger upgrades
2 parents 3adf783 + 327b483 commit b59130f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+1406
-764
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,4 @@ ssmtp.conf
2626

2727
# Ignore hidden macOS files
2828
.DS_Store
29+
/config/.read_only_service_account.json

Dockerfile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# use KDUX base Rails image, configure only project-specific items here
2-
FROM broadinstitute/kdux-rails-baseimage:1.0
2+
FROM broadinstitute/kdux-rails-baseimage:1.1
33

44
# Set ruby version
55
RUN bash -lc 'rvm --default use ruby-2.3.6'
@@ -11,7 +11,8 @@ COPY Gemfile.lock /home/app/webapp/Gemfile.lock
1111
WORKDIR /home/app/webapp
1212
RUN bundle install
1313
COPY set_user_permissions.bash /etc/my_init.d/01_set_user_permissions.bash
14-
COPY rails_startup.bash /etc/my_init.d/02_rails_startup.bash
14+
COPY generate_dh_parameters.bash /etc/my_init.d/02_generate_dh_parameters.bash
15+
COPY rails_startup.bash /etc/my_init.d/03_rails_startup.bash
1516

1617
# Configure NGINX
1718
RUN rm /etc/nginx/sites-enabled/default

README.rdoc

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,10 @@ portal is configured and ready to use:
5454
* For 'Authorized Javascript Origins', enter <code>https://(your hostname)/single_cell</code>
5555
* For 'Authorized redirect URIs', enter <code>https://(your hostname)/single_cell/users/auth/google_oauth2/callback</code>
5656
* Save the client id
57+
* <b>Whitelisting your OAuth Audience</b>
58+
* Once you have exported your OAuth credentials, you will need to have your client id whitelisted to allow it to make
59+
authenticated requests into the FireCloud API as per {OpenID Connect 1.0}[http://openid.net/specs/openid-connect-core-1_0.html#IDTokenValidation]
60+
* Send an email to <b>dsp-devops@broadinstitute.org</b> with your OAuth2 client ID so it can be added to the whitelist
5761
* <b>GCP Service Account keys</b>: Regardless of where the portal is deployed, it requires a Google Cloud Platform Service Account in order to make authenticated calls into FireCloud and Google Cloud Storage. Therefore, you must export the default service account key. See https://developers.google.com/identity/protocols/OAuth2ServiceAccount for more information about service accounts. To export the credentials:
5862
* Log into your new GCP project
5963
* Click the navigation menu in the top left and select 'IAM & Admin ' > 'Service Accounts'
@@ -71,7 +75,7 @@ portal is configured and ready to use:
7175
* Log in with the admin account, and select 'Admin Configurations' from the profile menu (top righthand corner)
7276
* At the bottom of the page, in the 'Other Tasks' dropdown, select 'Manage Service Account FireCloud Registration' and click 'Execute Task'
7377
* Fill out all form fields and submit
74-
* <b>Creating a FireCloud Project</b>: Before you can create studies, you will need to create a FireCloud project that will own all the workspaces created in the portal. To do this:
78+
* <b>Creating a FireCloud Project</b>: Once your OAuth audience has been whitelisted, and before you can create studies, you will need to create a FireCloud project that will own all the workspaces created in the portal. To do this:
7579
* Create a {Google Billing Project}[https://software.broadinstitute.org/firecloud/documentation/article?id=9762].
7680
* Using the same Google account that owns the billing project, log into the portal and select 'My Billing Projects' from the profile menu.
7781
* Click 'New Billing Project' at the bottom of the page

app/assets/javascripts/application.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,13 @@
5353
//= require sheather_jones
5454
//= require jquery.stickyPanel
5555
//= require clipboard.min
56+
//= require ideogram.min
5657

5758
var fileUploading = false;
5859
var PAGE_RENDERED = false;
5960
var OPEN_MODAL = '';
6061
var CLUSTER_TYPE = '3d';
62+
var UNSAFE_CHARACTERS = /[\;\/\?\:\@\=\&\'\"\<\>\#\%\{\}\|\\\^\~\[\]\`]/g;
6163

6264
// Minimum width of plot + legend
6365
// Addresses https://github.com/broadinstitute/single_cell_portal/issues/20
@@ -863,6 +865,20 @@ function validateUnique(formId, textFieldClass) {
863865
});
864866
}
865867

868+
// validate a name that will be used as a URL query string parameter (remove unsafe characters)
869+
function validateName(value, selector) {
870+
if ( value.match(UNSAFE_CHARACTERS) ) {
871+
alert('You have entered invalid characters for cluster/gene list names: \"' + value.match(UNSAFE_CHARACTERS).join(', ') + '\". These have been automatically removed from the entered value.');
872+
sanitizedName = value.replace(UNSAFE_CHARACTERS, '');
873+
selector.val(sanitizedName);
874+
selector.parent().addClass('has-error');
875+
return false
876+
} else {
877+
selector.parent().removeClass('has-error');
878+
return true
879+
}
880+
}
881+
866882
function validateCandidateUpload(formId, filename, classSelector) {
867883
var names = [];
868884
classSelector.each(function(index, name) {

app/assets/javascripts/ideogram.min.js

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/assets/javascripts/ideogram.min.js.map

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/controllers/admin_configurations_controller.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ def set_admin_configuration
320320

321321
# Never trust parameters from the scary internet, only allow the white list through.
322322
def admin_configuration_params
323-
params.require(:admin_configuration).permit(:config_type, :value_type, :value, :multiplier)
323+
params.require(:admin_configuration).permit(:config_type, :value_type, :value, :multiplier, configuration_options_attributes: [:id, :name, :value, :_destroy])
324324
end
325325

326326
def user_params

app/controllers/billing_projects_controller.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def index
3232
billing_accounts = @fire_cloud_client.get_billing_accounts
3333
@accounts = billing_accounts.map {|account| [account['displayName'], account['accountName']]}
3434
@projects = {}
35-
billing_projects = @fire_cloud_client.get_billing_projects
35+
billing_projects = @fire_cloud_client.get_billing_projects.keep_if {|project| project['role'] == 'Owner'}
3636

3737
# load user list for each project
3838
billing_projects.each do |project|
@@ -198,7 +198,7 @@ def load_service_account
198198

199199
# check to make sure that the current user has access to the current project
200200
def check_project_permissions
201-
projects = @fire_cloud_client.get_billing_projects
201+
projects = @fire_cloud_client.get_billing_projects.keep_if {|project| project['role'] == 'Owner'}
202202
unless projects.map {|project| project['projectName']}.include?(params[:project_name])
203203
redirect_to merge_default_redirect_params(billing_projects_path, scpbr: params[:scpbr]), alert: 'You do not have permission to perform that action.' and return
204204
end

app/controllers/reports_controller.rb

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,9 @@ def index
154154
when /cell-ranger/
155155
pipeline_inputs = analysis.payload['inputs'].detect {|input| input['name'] == 'cellranger.fastqs'}
156156
@inputs = pipeline_inputs['value']
157+
when /infercnv/
158+
pipeline_inputs = analysis.payload['inputs'].detect {|input| input['name'] == 'infercnv.expression_file'}
159+
@inputs = [pipeline_inputs['value']]
157160
else
158161
# make a guess, we have no idea
159162
pipeline_inputs = analysis.payload['inputs'].select {|input| input['name'] =~ /fastq/}
@@ -162,19 +165,27 @@ def index
162165
end
163166
@inputs.flatten!
164167
end
165-
fastq_files = @inputs.map {|input| input.gsub(/gs:\/\/#{study.bucket_id}\//, '')}
168+
input_files = @inputs.map {|input| input.gsub(/gs:\/\/#{study.bucket_id}\//, '')}
166169
# we need to now find the size of the files for the plot
167-
fastq_files.each do |fastq|
168-
directory = fastq.include?('/') ? fastq.split('/').first : '/'
169-
study_directory = study.directory_listings.find_by(name: directory)
170-
if study_directory.present?
171-
study_directory_file = study_directory.files.detect {|f| f['name'] == fastq}
172-
input_size += study_directory_file['size']
173-
else
174-
study_file = study.study_files.by_type('Fastq').detect {|f| f.name == fastq}
175-
if study_file.present? && !study_file.human_data?
176-
input_size += study_file.upload_file_size
177-
end
170+
input_files.each do |file|
171+
case pipeline_name
172+
when /infercnv/
173+
study_file = study.study_files.by_type('Expression Matrix').detect {|f| f.name == file}
174+
if study_file.present? && !study_file.human_data?
175+
input_size += study_file.upload_file_size
176+
end
177+
else
178+
directory = file.include?('/') ? file.split('/').first : '/'
179+
study_directory = study.directory_listings.find_by(name: directory)
180+
if study_directory.present?
181+
study_directory_file = study_directory.files.detect {|f| f['name'] == file}
182+
input_size += study_directory_file['size']
183+
else
184+
study_file = study.study_files.by_type('Fastq').detect {|f| f.name == file}
185+
if study_file.present? && !study_file.human_data?
186+
input_size += study_file.upload_file_size
187+
end
188+
end
178189
end
179190
end
180191
if @pipeline_runtimes[pipeline_name].present?

0 commit comments

Comments
 (0)