Skip to content

Commit b7948ce

Browse files
authored
Merge pull request #2213 from broadinstitute/jb-de-result-matrix-file-query
Fixing query logic & order of operations for automated AnnData DE jobs (SCP-5946)
2 parents 12f666c + 47c8816 commit b7948ce

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

app/models/ingest_job.rb

+5-5
Original file line numberDiff line numberDiff line change
@@ -514,9 +514,9 @@ def set_study_state_after_ingest
514514
when :image_pipeline
515515
set_has_image_cache
516516
when :ingest_anndata
517+
set_anndata_file_info
517518
launch_anndata_subparse_jobs if study_file.is_viz_anndata?
518519
launch_differential_expression_jobs if study_file.is_viz_anndata?
519-
set_anndata_file_info
520520
end
521521
set_study_initialized
522522
end
@@ -741,10 +741,10 @@ def create_differential_expression_results
741741
Rails.logger.info "Creating differential expression result object for annotation: #{annotation_identifier}"
742742
cluster = ClusterGroup.find_by(study_id: study.id, study_file_id: study_file.id, name: params_object.cluster_name)
743743
matrix_url = params_object.matrix_file_path
744-
matrix_filename = matrix_url.split("gs://#{study.bucket_id}/").last
745-
matrix_file = StudyFile.where(study: study, 'expression_file_info.is_raw_counts' => true).any_of(
746-
{ upload_file_name: matrix_filename }, { remote_location: matrix_filename }
747-
).first
744+
bucket_path = matrix_url.split("gs://#{study.bucket_id}/").last
745+
matrix_file = StudyFile.where(
746+
study:, :upload_file_name.in => [bucket_path, bucket_path.split('/').last]
747+
).detect(&:is_raw_counts_file?)
748748
de_result = DifferentialExpressionResult.find_or_initialize_by(
749749
study: study, cluster_group: cluster, cluster_name: cluster.name,
750750
annotation_name: params_object.annotation_name, annotation_scope: params_object.annotation_scope,

0 commit comments

Comments
 (0)