lib/macroape/cli/preprocess_collection.rb in macroape-3.3.5 vs lib/macroape/cli/preprocess_collection.rb in macroape-3.3.6
- old
+ new
@@ -69,14 +69,17 @@
silent = true
end
end
pvalues = default_pvalues if pvalues.empty?
- collection = Macroape::Collection.new(rough_discretization, precise_discretization, background, pvalues)
+ collection = Bioinform::Collection.new(rough_discretization: rough_discretization,
+ precise_discretization: precise_discretization,
+ background: background,
+ pvalues: pvalues)
if File.directory?(data_source)
- motifs = Dir.glob(File.join(data_source,'*')).map do |filename|
+ motifs = Dir.glob(File.join(data_source,'*')).sort.map do |filename|
pwm = data_model.new(File.read(filename))
pwm.name ||= File.basename(filename, File.extname(filename))
pwm
end
elsif File.file?(data_source)
@@ -96,21 +99,21 @@
# When support of onefile collections is introduced - then here should be check if name exists.
# Otherwise it should skip motif and tell you about this
# Also two command line options to fail on skipping or to skip silently should be included
- info = {rough: {}, precise: {}}
+ info = OpenStruct.new(rough: {}, precise: {})
pwm.background!(background).max_hash_size!(max_hash_size)
pwm.discrete(rough_discretization).thresholds(*pvalues) do |pvalue, threshold, real_pvalue|
- info[:rough][pvalue] = threshold / rough_discretization
+ info.rough[pvalue] = threshold / rough_discretization
end
pwm.discrete(precise_discretization).thresholds(*pvalues) do |pvalue, threshold, real_pvalue|
- info[:precise][pvalue] = threshold / precise_discretization
+ info.precise[pvalue] = threshold / precise_discretization
end
- collection.add_pwm(pwm, info)
+ collection.add_pm(pwm, info)
end
File.open(output_file,'w') do |f|
f.puts(collection.to_yaml)
end
rescue => err
\ No newline at end of file