Skip to content

Commit

Permalink
Support analyses with empty ref_project
Browse files Browse the repository at this point in the history
Close #176
  • Loading branch information
lmrodriguezr committed May 6, 2024
1 parent a71e2a6 commit 168ee28
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 40 deletions.
4 changes: 3 additions & 1 deletion lib/miga/dataset/result/add.rb
Original file line number Diff line number Diff line change
Expand Up @@ -261,10 +261,12 @@ def add_result_distances_ref(base)
def add_result_distances_nonref(base)
return nil unless
result_files_exist?(base, %w[.aai-medoids.tsv .aai.db]) ||
result_files_exist?(base, %w[.ani-medoids.tsv .ani.db])
result_files_exist?(base, %w[.ani-medoids.tsv .ani.db]) ||
result_files_exist?(base, %w[.empty])

add_files_to_ds_result(
MiGA::Result.new("#{base}.json"), name,
empty: '.empty',
aai_medoids: '.aai-medoids.tsv',
haai_db: '.haai.db',
aai_db: '.aai.db',
Expand Down
4 changes: 2 additions & 2 deletions lib/miga/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ module MiGA
# - String indicating release status:
# - rc* release candidate, not released as gem
# - [0-9]+ stable release, released as gem
VERSION = [1.3, 15, 0].freeze
VERSION = [1.3, 15, 1].freeze

##
# Nickname for the current major.minor version.
VERSION_NAME = 'mezzotint'

##
# Date of the current gem relese.
VERSION_DATE = Date.new(2024, 5, 2)
VERSION_DATE = Date.new(2024, 5, 6)

##
# References of MiGA
Expand Down
74 changes: 38 additions & 36 deletions scripts/distances.bash
Original file line number Diff line number Diff line change
Expand Up @@ -29,44 +29,46 @@ blast=no
blat=no
diamond=no
fastani=no
case $(miga option -P "$PROJECT" -k haai_p) in
fastaai)
fastaai=yes
;;
diamond)
diamond=yes
aai=yes
;;
blast)
blast=yes
aai=yes
;;
esac
if [[ ! -s "${DATASET}.empty" ]] ; then
case $(miga option -P "$PROJECT" -k haai_p) in
fastaai)
fastaai=yes
;;
diamond)
diamond=yes
aai=yes
;;
blast)
blast=yes
aai=yes
;;
esac

case $(miga option -P "$PROJECT" -k aai_p) in
diamond)
diamond=yes
aai=yes
;;
blast)
blast=yes
aai=yes
;;
esac
case $(miga option -P "$PROJECT" -k aai_p) in
diamond)
diamond=yes
aai=yes
;;
blast)
blast=yes
aai=yes
;;
esac

case $(miga option -P "$PROJECT" -k ani_p) in
blast)
blast=yes
ani=yes
;;
blat)
blat=yes
ani=yes
;;
fastani)
fastani=yes
;;
esac
case $(miga option -P "$PROJECT" -k ani_p) in
blast)
blast=yes
ani=yes
;;
blat)
blat=yes
ani=yes
;;
fastani)
fastani=yes
;;
esac
fi


miga date > "${DATASET}.done"
Expand Down
10 changes: 9 additions & 1 deletion utils/distance/runner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def initialize(project_path, dataset_name, opts_hash = {})

# Launch the appropriate analysis
def go!
$stderr.puts "Launching analysis"
$stderr.puts 'Launching analysis'
return if dataset.multi?

Dir.mktmpdir do |tmp_dir|
Expand Down Expand Up @@ -68,6 +68,14 @@ def go_ref!
# Launch analysis for query datasets
def go_query!
$stderr.puts 'Launching analysis for query dataset'

# Check if the project is empty
if ref_project.dataset_ref_active.empty?
out_base = File.expand_path(dataset.name, home)
File.open("#{out_base}.empty", 'w') { |fh| fh.puts 'Empty ref_project' }
return
end

# Check if project is ready
tsk = ref_project.clade? ? [:subclades, :ani] : [:clade_finding, :aai]
res = ref_project.result(tsk[0])
Expand Down

0 comments on commit 168ee28

Please sign in to comment.