Skip to content

Commit

Permalink
Merge pull request #2150 from broadinstitute/jb-anndata-ux-reference-…
Browse files Browse the repository at this point in the history
…file

Don't create default cluster fragment for reference AnnData files (SCP-5825)
  • Loading branch information
bistline authored Oct 7, 2024
2 parents 381701f + ca12d1d commit 7c49585
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app/models/ann_data_file_info.rb
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ def sanitize_fragments!

# create the default cluster data_fragment entries
def set_default_cluster_fragments!
return false if fragments_by_type(:cluster).any?
return false if fragments_by_type(:cluster).any? || reference_file

default_obsm_keys = AnnDataIngestParameters::PARAM_DEFAULTS[:obsm_keys]
default_obsm_keys.each do |obsm_key_name|
Expand Down
2 changes: 1 addition & 1 deletion app/models/ingest_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ def poll_for_completion(run_at: 1.minute.from_now)
if done? && !failed?
Rails.logger.info "IngestJob poller: #{pipeline_name} is done!"
Rails.logger.info "IngestJob poller: #{pipeline_name} status: #{current_status}"
unless special_action? || action == :ingest_anndata
unless special_action? || (action == :ingest_anndata && study_file.is_viz_anndata?)
study_file.update(parse_status: 'parsed')
study_file.bundled_files.each { |sf| sf.update(parse_status: 'parsed') }
end
Expand Down
7 changes: 6 additions & 1 deletion test/models/ann_data_file_info_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -127,14 +127,19 @@ def generate_id
end

test 'should set default cluster fragments' do
ann_data_info = AnnDataFileInfo.new
ann_data_info = AnnDataFileInfo.new(reference_file: false)
assert ann_data_info.valid?
default_keys = AnnDataIngestParameters::PARAM_DEFAULTS[:obsm_keys]
default_keys.each do |obsm_key_name|
name = obsm_key_name.delete_prefix('X_')
matcher = { data_type: :cluster, name:, obsm_key_name: }.with_indifferent_access
assert ann_data_info.find_fragment(**matcher).present?
end
# ensure non-parseable AnnData files don't create fragment
reference_anndata = AnnDataFileInfo.new
assert reference_anndata.valid?
assert_empty reference_anndata.data_fragments
assert_empty reference_anndata.obsm_key_names
end

test 'should validate data fragments' do
Expand Down

0 comments on commit 7c49585

Please sign in to comment.