Skip to content

Commit

Permalink
was not writing fasta
Browse files Browse the repository at this point in the history
  • Loading branch information
averissimo committed Feb 5, 2016
1 parent 57ed790 commit 9ccb66a
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
2 changes: 2 additions & 0 deletions script.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ def run_user_config
b.gen_report_from_output
# prune results
b.prune_results
#
b.write_fasta
end
#
run_user_config
8 changes: 8 additions & 0 deletions src/reporting.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ def initialize(config_path)
@store.identity.max,
File.join(@store.output.dir,
@store.output.intermediate),
File.join(@store.output.dir,
@store.output.fastas),
@store.prune_identical.key?('use_worst') \
&& @store.prune_identical.use_worst,
logger
Expand Down Expand Up @@ -127,6 +129,12 @@ def prune_results
exit
end

def write_fasta
db.write_fasta_files
end



# _ _
# (_) | |
# _ __ _ __ ___ ____ _| |_ ___
Expand Down
11 changes: 6 additions & 5 deletions src/results_db.rb
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,13 @@ class ResultsDB
def initialize(identity_min,
identity_max,
output_dir,
fasta_dir,
keep_worst = false,
logger = nil)
@threshold = identity_min
@threshold_max = identity_max
@output_dir = output_dir
@fasta_dir = fasta_dir
@keep_worst = keep_worst
# hash of DB instances
initialize_db
Expand Down Expand Up @@ -235,18 +237,17 @@ def write_fasta_files
fasta_files = gather_fasta
#
fasta_files.keys.each do |fasta_db|
write_fasta_each(fasta_db, :nt, FILE_FASTA_NT)
write_fasta_each(fasta_db, :aa, FILE_FASTA_AA)
write_fasta_each(fasta_db, :nt, Reporting::FILE_FASTA_NT, fasta_files)
write_fasta_each(fasta_db, :aa, Reporting::FILE_FASTA_AA, fasta_files)
end
end

protected

#
# write each fasta file method (will be called for nt and aa)
def write_fasta_each(fasta_db, type, filename)
File.open(File.join(@store.output.dir,
@store.output.fastas,
def write_fasta_each(fasta_db, type, filename, fasta_files)
File.open(File.join(@fasta_dir,
fasta_db.to_s + '_' + filename),
'wb',
col_sep: "\t") do |fid|
Expand Down

0 comments on commit 9ccb66a

Please sign in to comment.