end
if ( msa.is_aligned() )
- Util.print_message( PRG_NAME, "Length of original alignment : " + msa.get_length.to_s )
- log << "Length of original alignment : " + msa.get_length.to_s + ld
+ Util.print_message( PRG_NAME, "Length of original alignment : " + msa.get_length.to_s )
+ log << "Length of original alignment : " + msa.get_length.to_s + ld
+ gp = msa.calculate_gap_proportion
+ Util.print_message( PRG_NAME, "Gap-proportion of original alignment : " + gp.to_s )
+ log << "Gap-proportion of original alignment : " + gp.to_s + ld
else
Util.print_message( PRG_NAME, "the input is not aligned" )
log << "The input is not aligned" + ld
unless ( @rg )
if ( msa.is_aligned() )
- Util.print_message( PRG_NAME, "length of processed alignment: " + msa.get_length.to_s )
- log << "length of processed alignment: " + msa.get_length.to_s + ld
+ Util.print_message( PRG_NAME, "Length of processed alignment : " + msa.get_length.to_s )
+ log << "Length of processed alignment : " + msa.get_length.to_s + ld
+ gp = msa.calculate_gap_proportion
+ Util.print_message( PRG_NAME, "Gap-proportion of processed alignment: " + gp.to_s )
+ log << "Gap-proportion of processed alignment: " + gp.to_s + ld
else
Util.print_warning_message( PRG_NAME, "output is not aligned" )
log << "output is not aligned" + ld
seq_1 = get_sequence( index_1 )
seq_2 = get_sequence( index_2 )
overlap_count = 0
- for i in 0...seq_1.get_length()
+ for i in 0...seq_1.get_length
if !Util.is_aa_gap_character?( seq_1.get_character_code( i ) ) &&
!Util.is_aa_gap_character?( seq_2.get_character_code( i ) )
overlap_count += 1
seq_1 = get_sequence( index_1 )
seq_2 = get_sequence( index_2 )
identities_count = 0
- for i in 0...seq_1.get_length()
+ for i in 0...seq_1.get_length
if !Util.is_aa_gap_character?( seq_1.get_character_code( i ) ) &&
!Util.is_aa_gap_character?( seq_2.get_character_code( i ) ) &&
seq_1.get_character_code( i ) != 63 &&
end
return cols
end
+
+ def calculate_gap_proportion()
+ if ( !is_aligned() )
+ error_msg = "attempt to get gap only columns of unaligned msa"
+ raise StandardError, error_msg, caller
+ end
+ total_sum = 0.0
+ gap_sum = 0.0
+ for c in 0 ... get_length
+ for s in 0 ... get_number_of_seqs
+ total_sum = total_sum + 1
+ if Util.is_aa_gap_character?( get_sequence( s ).get_character_code( c ) )
+ gap_sum = gap_sum + 1
+ end
+ end
+
+ end
+ return gap_sum / total_sum
+ end
def get_gap_columns()
if ( !is_aligned() )