From 592097c9d8ed6ed0a74bca26ee12454d774cd345 Mon Sep 17 00:00:00 2001 From: cmzmasek Date: Fri, 9 Jun 2017 13:27:07 -0700 Subject: [PATCH] in progress --- forester/ruby/evoruby/lib/evo/msa/msa.rb | 14 ++++++++++---- forester/ruby/evoruby/lib/evo/tool/msa_processor.rb | 2 +- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/forester/ruby/evoruby/lib/evo/msa/msa.rb b/forester/ruby/evoruby/lib/evo/msa/msa.rb index 1cdc78d..dede7c7 100644 --- a/forester/ruby/evoruby/lib/evo/msa/msa.rb +++ b/forester/ruby/evoruby/lib/evo/msa/msa.rb @@ -423,7 +423,7 @@ module Evoruby end end - def extract( first, last ) + def extract( first, last, suffix ) if !is_aligned() error_msg = "attempt to extract from unaligned msa" raise StandardError, error_msg, caller @@ -442,12 +442,18 @@ module Evoruby end msa = Msa.new() for i in 0 ... get_number_of_seqs - msa.add_sequence( get_sequence( i ).get_subsequence( first, last ) ) + subseq = get_sequence( i ).get_subsequence( first, last ) + if suffix != nil + msa.add( subseq.get_name + suffix, subseq.get_sequence_as_string ) + else + msa.add( subseq.get_name, subseq.get_sequence_as_string ) + end end + msa end - def sliding_extraction( step, size ) + def sliding_extraction( step, size, suffix = nil ) counter = 0 done = false msas = Array.new() @@ -460,7 +466,7 @@ module Evoruby end unless first >= last counter +=1 - res = extract( first, last) + res = extract(first, last, suffix) res.set_name(first.to_s + "-" + last.to_s) msas << res end diff --git a/forester/ruby/evoruby/lib/evo/tool/msa_processor.rb b/forester/ruby/evoruby/lib/evo/tool/msa_processor.rb index 1bcaeb3..1d92b60 100644 --- a/forester/ruby/evoruby/lib/evo/tool/msa_processor.rb +++ b/forester/ruby/evoruby/lib/evo/tool/msa_processor.rb @@ -377,7 +377,7 @@ module Evoruby end if @window - msas = msa.sliding_extraction( @step, @size ) + msas = msa.sliding_extraction( @step, @size, '_Q' ) begin io = MsaIO.new() w = MsaWriter -- 1.7.10.2