Bioinf
view release on metacpan or search on metacpan
if(@hash_out == 1){ return($hash_out[0]);
}elsif( @hash_out > 1 ){ return(@hash_out); }
}
#________________________________________________________________________
# Title : overlay_seq_by_certain_chars
# Usage : %out =%{&overlay_seq_by_certain_chars(\%hash1, \%hash2, 'HE')};
# Function : (name1 000000112324)+(name1 ABC..AD..EFDK ) => (name1 000..00..12324)
# (name2 000000112324)+(name2 --HHH--EEEE-- ) => (name1 ---000--1123--)
# uses the second hash a template for the first sequences. gap_char is
# '-' or '.' or any given char or symbol.
# To insert gaps rather than overlap, use insert_gaps_in_seq_hash
# Example : %out =%{&overlay_seq_by_certain_chars(\%hash1, \%hash2, 'E')};
# output> with 'E' option >>> "name1 --HHH--1232-"
# Warning : If gap_chr ('H',,,) is not given, it replaces all the
# non-gap chars (normal alphabet), ie,
# it becomes 'superpose_seq_hash'
# Keywords : Overlap, superpose hash, overlay, superpose_seq_hash
# Options : E for replacing All 'E' occurrances in ---EEEE--HHHH----, etc.
# : H for replacing all 'H' " " "
# Returns : one hash ref.
# Argument : 2 ref for hash of identical keys and value length.
# Category :
# Version : 1.0
#--------------------------------------------------------------------
sub overlay_seq_by_certain_chars{
my($i, $k,$j, $name, @in, %out, $gap_chr, @str1, @str2);
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
####### Sub argument handling ######## $gap_chr here can be 'HE' etc.
#______________________________________
for($k=0; $k< @_ ;$k++){
if( ( !ref($_[$k]) )&&($_[$k]=~ /^(.+)$/) ){
$gap_chr .= $1;
}elsif((ref($_[$k]) eq "SCALAR")&&(${$_[$k]}=~ /^(.)+$/) ){
$gap_chr .= $1;
}elsif(ref($_[$k]) eq "HASH") { push(@in, $_[$k]); }
}
if($#in < 1){
print "\n overlay_seq_by_certain_chars needs 2 hashes. Error \n"; exit; }
my(%hash1)=%{$in[0]};
my(%hash2)=%{$in[1]};
my(@names1)= sort keys %hash1;
my(@names2)= sort keys %hash2;
(@names1 > @names2)? $bigger=@names1 : $bigger=@names2;
for ($j=0; $j < $bigger; $j++){
@str1=split(//, $hash1{$names1[$j]});
@str2=split(//, $hash2{$names2[$j]});
if( ($gap_chr eq '') && ($hash2{$names2[$j]}=~/(\W)/) ){
$gap_chr=$1;
}
#________________________________________________________________________
# Title : superpose_seq_hash ( first to second hash) ## the oldest version.
# Usage : %out =%{&superpose_seq_hash(\%hash1, \%hash2)};
# Function : (name1 000000112324)+(name1 ABC..AD..EFD ) => (name1 000..01..324)
# uses the second hash a template for the first sequences. gap_char is
# '-' or '.'
# To insert gaps rather than overlap, use insert_gaps_in_seq_hash
# Example :
# Warning : Accepts only two HASHes and many possible gap_chr. Default gap is '-'
# Keywords : overlay sequence, overlay alphabet, superpose sequence,
# Options :
# Returns : one hash ref.
# Argument : 2 refs. for hash of identical keys and value length and gap_chr.
# Category :
# Version : 1.0
#--------------------------------------------------------------------
sub superpose_seq_hash{
if($debug eq 1){ print __LINE__, " # superpose_seq_hash : \n"; }
my($gap_chr)='-';
my($i, $j, %hash1, %hash2, $name, %out, @str1, @str2);
@str2=split(/|\,/, $hash2{$names2[$j]});
for($i=0; $i < @str2; $i++){
if($str2[$i] ne $gap_chr){ $str2[$i]=$str1[$i]; } }
$out{$names1[$j]}=join(",", @str2);
}
return(\%out);
}
#________________________________________________________________________
# Title : overlay_seq_hash ( first to second hash) ## the oldest version.
# Usage : %out =%{&overlay_seq_hash(\%hash1, \%hash2)};
# Function : (name1 000000112324)+(name1 ABC..AD..EFD ) => (name1 000..01..324)
# uses the second hash a template for the first sequences. gap_char is
# '-' or '.'
# To insert gaps rather than overlap, use insert_gaps_in_seq_hash
# Example :
# Warning : Accepts only two HASHes and many possible gap_chr. Default gap is '-'
# Keywords :
# Options :
# Returns : one hash ref.
# Argument : 2 refs. for hash of identical keys and value length and gap_chr.
# Category :
# Version : 1.0
#--------------------------------------------------------------------
sub overlay_seq_hash{
my($gap_chr)='-'; my($i, $j, $name, %out, @str1, @str2);
if((ref($_[0]) eq 'HASH')&&(ref($_[1]) eq 'HASH')){
my(%hash1)=%{$_[0]}; my(%hash2)=%{$_[1]}; }
else{ print "\n overlay_seq_hash needs hash ref\n"; print chr(007); exit; }
my(@names1)=keys %hash1; my(@names2)=keys %hash2;
(@names1 > @names2)? $bigger=@names1 : $bigger=@names2;
for ($j=0; $j < $bigger; $j++){
if($hash2{$names2[$j]}=~/(\W)/){ $gap_chr = $1; }
@str1=split(//, $hash1{$names1[$j]}); @str2=split(//, $hash2{$names2[$j]});
for($i=0; $i < @str2; $i++){
if(($str2[$i] =~ /\W/)||($str2[$i] =~ //)){ $str1[$i]="$gap_chr";}}
$out{$names1[$j]}=join(",", @str1);
# It superposes the NON sec. region on @seq_positionSTR to nullify positions.
# get_posi_diff ignores non char positions in calc.
#"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
if( ($ss_opt =~ /ss$/i) && ($comm_col !~ /C/i) ){
%DSSP=%{&open_dssp_files($name, $H, $S, $E, $T, $I, $G, $B, $simplify, $comm_col)};
if($debug1 eq 1){
print "\n",__LINE__," open_dssp_files has options \$H ->$H \$S->$S \$E->$E \n";
print "\n",__LINE__," \$T->$T \$I->$I \$G->$B \$simplify->$simplify \$comm_col ->$comm_col\n";
&show_hash( \%DSSP );
}
if(ref(\%DSSP) eq 'HASH'){ # to check it %DSSP was valid, If not it skips overlaying
@stringDSSP = split(/|\,/, $DSSP{$name});
$size_of_stringDSSP = @stringDSSP;
$size_of_seq_positionSTR = @seq_positionSTR;
if($debug2 eq 1){
print "\n",__LINE__," \@stringDSSP is \n @stringDSSP\n";
print "\n",__LINE__," Size of \@stringDSSP is $size_of_stringDSSP\n" ;
print "\n",__LINE__," Size of \@seq_positionSTR is $size_of_seq_positionSTR\n";
print "\n",__LINE__," \$gap_char is \"$gap_char\" \n" ;
}
#"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
push(@new_string, $string2[$i]);
}
}
$new_string{$key2}= join("", @new_string);
@new_string = ();
}
\%new_string;
}
#________________________________________________________________________
# Title : get_common_column (similar to overlay_seq_for_identical_chars )
# Usage : %out =%{&get_common_column(\%hash1, \%hash2, '-')};
# Function : (name1 --EHH--HHEE-- )
# (name2 --HHH--EEEE-- ) ==> result is;
#
# (name1_name2 -- HH-- EE-- )
# to get the identical chars in hash strings of sequences.
#
# Example : %out =%{&get_common_column(\%hash1, \%hash2, '-')};
# output> with 'E' option >>> "name1 --HHH--1232-"
# Following input will give;
# %hash2 = ('s2', '--EEH-CHHEE----EEH-CHHEE----EEH-CHHEE----EEH-CHHEE--');
# %hash3 = ('s3', '-KEEH-CHHEE-XX-EEH-CHHEE----EEH-CHHEE----EEH-CHHEE--');
# %hash4 = ('s4', '-TESH-CHEEE-XX-EEH-CHHEE----EEH-CHHEE----EEH-CHHEE--');
#
# s1_s2_s3_s4 --E-H-CH-EE----E-H--HHEE----E-H--HHEE----E-H-CHHEE--
#
# Warning : This gets more than 2 hashes. Not more than that!
#
# Class : get_common_column, get_common_column_in_seq, get common column in sequence
# for secondary structure only representation.
# Keywords : Overlap, superpose hash, overlay identical chars, superpose_seq_hash
# get_common_column, get_com_column, get_common_sequence,
# get_common_seq_region, multiply_seq_hash, get_common_column_in_sequence
# Options :
# Reference :
# Returns : one hash ref. of the combined key name (i.e., name1_name2). Combined by '_'
# Tips :
# Argument : 2 or more ref for hash of identical keys and value length.
# One optional arg for replacing space char to the given one.
# Author : jong@salt2.med.harvard.edu
# Category :
}
FINAL:
if ($debug eq 1){
print "\n",__LINE__, " # get_common_column Final res. \%out :\n",
&show_hash(%out);
}
return(\%out);
}
#________________________________________________________________________
# Title : overlay_seq_for_identical_chars
# Usage : %out =%{&overlay_seq_for_identical_chars(\%hash1, \%hash2, '-')};
# Function : (name1 --EHH--HHEE-- )
# (name2 --HHH--EEEE-- ) ==> result is;
#
# (name1_name2 -- HH-- EE-- )
# to get the identical chars in hash strings of sequences.
#
# Example : %out =%{&overlay_seq_for_identical_chars(\%hash1, \%hash2, '-')};
# output> with 'E' option >>> "name1 --HHH--1232-"
# Warning : Works only for 2 sequence hashes.
# Keywords : Overlap, superpose hash, overlay identical chars, superpose_seq_hash
# Options :
# Returns : one hash ref. of the combined key name (i.e., name1_name2). Combined by '_'
# Argument : 2 ref for hash of identical keys and value length. One optional arg for
# replacing space char to the given one.
# Category :
# Version : 1.0
#--------------------------------------------------------------------
sub overlay_seq_for_identical_chars{
my($i, $k,$j, $name1, $name2, @in, %out, @out_chars, $gap_chr, @str1, @str2);
######################################
####### Sub argument handling ######## $gap_chr here can be 'HE' etc.
######################################
for($k=0; $k< @_ ;$k++){
if( ( !ref($_[$k]) )&&($_[$k]=~ /^(.)$/) ){
$gap_chr .= $1; }
elsif((ref($_[$k]) eq "SCALAR")&&(${$_[$k]}=~ /^(.)$/) ){
$gap_chr .= $1; }
elsif(ref($_[$k]) eq "HASH") { push(@in, $_[$k]); } }
if(@in < 2){ print "\n overlay_seq_for_identical_chars needs 2 hashes. Error \n"; exit; }
my(%hash1)=%{$in[0]}; my(%hash2)=%{$in[1]};
my(@names1)=sort keys %hash1; my(@names2)= sort keys %hash2;
$name1 = $names1[0]; $name2 = $names2[0];
@str1=split(/|\,/, $hash1{$names1[0]}); @str2=split(/|\,/, $hash2{$names2[0]});
for($i=0; $i < @str1; $i++){
if($str1[$i] eq $str2[$i] ){
push(@out_chars, $str1[$i]); }
elsif( defined($gap_chr) ){ push(@out_chars, $gap_chr); }
else{ push(@out_chars, ' '); }
}
open_aln_files open_brk_files open_cel_files open_clu_files
open_dna_files open_dssp_files open_embl_files open_fasta_files
open_fil_file open_hlx_files open_hmmfs_files open_hmmls_files
open_jp_files open_lottery_file open_msf_files open_msf_jp_files
open_msp_files open_out_files open_pdb_files open_pdbg_files
open_phd_files open_pir_files open_predator_files open_rms_files
open_rms_files2 open_sdb_files open_self open_seq_alignment_files
open_seq_files open_sequence_index_files open_slx_files open_sso_files
open_sst_files open_sst_files_with_gap open_stride_dat_files open_stride_dat_files
open_subdir_and_go_in_and_do open_swissprot_seq_files open_tem_files opendir_and_go
opendir_and_go_in_and_do_something opendir_and_go_rand_fasta opendir_and_go_rand_fasta_and_clustal overlay_seq_by_certain_chars
overlay_seq_for_identical_chars overlay_seq_hash pair_percent_id_trend pairwise_iden_pos
pairwise_percent_id parse_arguments permute permute_binary
pick_random_files pick_random_hash_pairs pir_permute_array_write pir_permute_hash_write
pir_write pir_write plot_histogram_horizontally plot_vertically
print_clusfile_from_hash print_in_block print_seq_in_block print_seq_in_block_old
print_seq_in_block_with_print print_seq_in_columns produce_random_numbers push_if_not_already
push_if_not_already put_gaps_every_x_position_in_string put_gaps_every_x_position_in_string_special put_gaps_in_hash
put_msp_lines_to_hash_from_bla put_position_back_to_str_seq put_slash_before_special_chars pwd_dir_name
pwd_path rand_DNA_seq_generate rand_RNA_seq_generate rand_sequence_mul_array
rand_sequence_one_array rand_sequence_one_string rand_word randomise_file_contents
randomise_lines read_all_head_boxes read_any_dir read_any_dir2
if(@hash_out == 1){ return($hash_out[0]);
}elsif( @hash_out > 1 ){ return(@hash_out); }
}
#________________________________________________________________________
# Title : overlay_seq_by_certain_chars
# Usage : %out =%{&overlay_seq_by_certain_chars(\%hash1, \%hash2, 'HE')};
# Function : (name1 000000112324)+(name1 ABC..AD..EFDK ) => (name1 000..00..12324)
# (name2 000000112324)+(name2 --HHH--EEEE-- ) => (name1 ---000--1123--)
# uses the second hash a template for the first sequences. gap_char is
# '-' or '.' or any given char or symbol.
# To insert gaps rather than overlap, use insert_gaps_in_seq_hash
# Example : %out =%{&overlay_seq_by_certain_chars(\%hash1, \%hash2, 'E')};
# output> with 'E' option >>> "name1 --HHH--1232-"
# Warning : If gap_chr ('H',,,) is not given, it replaces all the
# non-gap chars (normal alphabet), ie,
# it becomes 'superpose_seq_hash'
# Keywords : Overlap, superpose hash, overlay, superpose_seq_hash
# Options : E for replacing All 'E' occurrances in ---EEEE--HHHH----, etc.
# : H for replacing all 'H' " " "
# Returns : one hash ref.
# Argument : 2 ref for hash of identical keys and value length.
# Category :
# Version : 1.0
#--------------------------------------------------------------------
sub overlay_seq_by_certain_chars{
my($i, $k,$j, $name, @in, %out, $gap_chr, @str1, @str2);
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
####### Sub argument handling ######## $gap_chr here can be 'HE' etc.
#______________________________________
for($k=0; $k< @_ ;$k++){
if( ( !ref($_[$k]) )&&($_[$k]=~ /^(.+)$/) ){
$gap_chr .= $1;
}elsif((ref($_[$k]) eq "SCALAR")&&(${$_[$k]}=~ /^(.)+$/) ){
$gap_chr .= $1;
}elsif(ref($_[$k]) eq "HASH") { push(@in, $_[$k]); }
}
if($#in < 1){
print "\n overlay_seq_by_certain_chars needs 2 hashes. Error \n"; exit; }
my(%hash1)=%{$in[0]};
my(%hash2)=%{$in[1]};
my(@names1)= sort keys %hash1;
my(@names2)= sort keys %hash2;
(@names1 > @names2)? $bigger=@names1 : $bigger=@names2;
for ($j=0; $j < $bigger; $j++){
@str1=split(//, $hash1{$names1[$j]});
@str2=split(//, $hash2{$names2[$j]});
if( ($gap_chr eq '') && ($hash2{$names2[$j]}=~/(\W)/) ){
$gap_chr=$1;
}
#________________________________________________________________________
# Title : superpose_seq_hash ( first to second hash) ## the oldest version.
# Usage : %out =%{&superpose_seq_hash(\%hash1, \%hash2)};
# Function : (name1 000000112324)+(name1 ABC..AD..EFD ) => (name1 000..01..324)
# uses the second hash a template for the first sequences. gap_char is
# '-' or '.'
# To insert gaps rather than overlap, use insert_gaps_in_seq_hash
# Example :
# Warning : Accepts only two HASHes and many possible gap_chr. Default gap is '-'
# Keywords : overlay sequence, overlay alphabet, superpose sequence,
# Options :
# Returns : one hash ref.
# Argument : 2 refs. for hash of identical keys and value length and gap_chr.
# Category :
# Version : 1.0
#--------------------------------------------------------------------
sub superpose_seq_hash{
if($debug eq 1){ print __LINE__, " # superpose_seq_hash : \n"; }
my($gap_chr)='-';
my($i, $j, %hash1, %hash2, $name, %out, @str1, @str2);
@str2=split(/|\,/, $hash2{$names2[$j]});
for($i=0; $i < @str2; $i++){
if($str2[$i] ne $gap_chr){ $str2[$i]=$str1[$i]; } }
$out{$names1[$j]}=join(",", @str2);
}
return(\%out);
}
#________________________________________________________________________
# Title : overlay_seq_hash ( first to second hash) ## the oldest version.
# Usage : %out =%{&overlay_seq_hash(\%hash1, \%hash2)};
# Function : (name1 000000112324)+(name1 ABC..AD..EFD ) => (name1 000..01..324)
# uses the second hash a template for the first sequences. gap_char is
# '-' or '.'
# To insert gaps rather than overlap, use insert_gaps_in_seq_hash
# Example :
# Warning : Accepts only two HASHes and many possible gap_chr. Default gap is '-'
# Keywords :
# Options :
# Returns : one hash ref.
# Argument : 2 refs. for hash of identical keys and value length and gap_chr.
# Category :
# Version : 1.0
#--------------------------------------------------------------------
sub overlay_seq_hash{
my($gap_chr)='-'; my($i, $j, $name, %out, @str1, @str2);
if((ref($_[0]) eq 'HASH')&&(ref($_[1]) eq 'HASH')){
my(%hash1)=%{$_[0]}; my(%hash2)=%{$_[1]}; }
else{ print "\n overlay_seq_hash needs hash ref\n"; print chr(007); exit; }
my(@names1)=keys %hash1; my(@names2)=keys %hash2;
(@names1 > @names2)? $bigger=@names1 : $bigger=@names2;
for ($j=0; $j < $bigger; $j++){
if($hash2{$names2[$j]}=~/(\W)/){ $gap_chr = $1; }
@str1=split(//, $hash1{$names1[$j]}); @str2=split(//, $hash2{$names2[$j]});
for($i=0; $i < @str2; $i++){
if(($str2[$i] =~ /\W/)||($str2[$i] =~ //)){ $str1[$i]="$gap_chr";}}
$out{$names1[$j]}=join(",", @str1);
# It superposes the NON sec. region on @seq_positionSTR to nullify positions.
# get_posi_diff ignores non char positions in calc.
#"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
if( ($ss_opt =~ /ss$/i) && ($comm_col !~ /C/i) ){
%DSSP=%{&open_dssp_files($name, $H, $S, $E, $T, $I, $G, $B, $simplify, $comm_col)};
if($debug1 eq 1){
print "\n",__LINE__," open_dssp_files has options \$H ->$H \$S->$S \$E->$E \n";
print "\n",__LINE__," \$T->$T \$I->$I \$G->$B \$simplify->$simplify \$comm_col ->$comm_col\n";
&show_hash( \%DSSP );
}
if(ref(\%DSSP) eq 'HASH'){ # to check it %DSSP was valid, If not it skips overlaying
@stringDSSP = split(/|\,/, $DSSP{$name});
$size_of_stringDSSP = @stringDSSP;
$size_of_seq_positionSTR = @seq_positionSTR;
if($debug2 eq 1){
print "\n",__LINE__," \@stringDSSP is \n @stringDSSP\n";
print "\n",__LINE__," Size of \@stringDSSP is $size_of_stringDSSP\n" ;
print "\n",__LINE__," Size of \@seq_positionSTR is $size_of_seq_positionSTR\n";
print "\n",__LINE__," \$gap_char is \"$gap_char\" \n" ;
}
#"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
push(@new_string, $string2[$i]);
}
}
$new_string{$key2}= join("", @new_string);
@new_string = ();
}
\%new_string;
}
#________________________________________________________________________
# Title : get_common_column (similar to overlay_seq_for_identical_chars )
# Usage : %out =%{&get_common_column(\%hash1, \%hash2, '-')};
# Function : (name1 --EHH--HHEE-- )
# (name2 --HHH--EEEE-- ) ==> result is;
#
# (name1_name2 -- HH-- EE-- )
# to get the identical chars in hash strings of sequences.
#
# Example : %out =%{&get_common_column(\%hash1, \%hash2, '-')};
# output> with 'E' option >>> "name1 --HHH--1232-"
# Following input will give;
# %hash2 = ('s2', '--EEH-CHHEE----EEH-CHHEE----EEH-CHHEE----EEH-CHHEE--');
# %hash3 = ('s3', '-KEEH-CHHEE-XX-EEH-CHHEE----EEH-CHHEE----EEH-CHHEE--');
# %hash4 = ('s4', '-TESH-CHEEE-XX-EEH-CHHEE----EEH-CHHEE----EEH-CHHEE--');
#
# s1_s2_s3_s4 --E-H-CH-EE----E-H--HHEE----E-H--HHEE----E-H-CHHEE--
#
# Warning : This gets more than 2 hashes. Not more than that!
#
# Class : get_common_column, get_common_column_in_seq, get common column in sequence
# for secondary structure only representation.
# Keywords : Overlap, superpose hash, overlay identical chars, superpose_seq_hash
# get_common_column, get_com_column, get_common_sequence,
# get_common_seq_region, multiply_seq_hash, get_common_column_in_sequence
# Options :
# Reference :
# Returns : one hash ref. of the combined key name (i.e., name1_name2). Combined by '_'
# Tips :
# Argument : 2 or more ref for hash of identical keys and value length.
# One optional arg for replacing space char to the given one.
# Author : jong@salt2.med.harvard.edu
# Category :
}
FINAL:
if ($debug eq 1){
print "\n",__LINE__, " # get_common_column Final res. \%out :\n",
&show_hash(%out);
}
return(\%out);
}
#________________________________________________________________________
# Title : overlay_seq_for_identical_chars
# Usage : %out =%{&overlay_seq_for_identical_chars(\%hash1, \%hash2, '-')};
# Function : (name1 --EHH--HHEE-- )
# (name2 --HHH--EEEE-- ) ==> result is;
#
# (name1_name2 -- HH-- EE-- )
# to get the identical chars in hash strings of sequences.
#
# Example : %out =%{&overlay_seq_for_identical_chars(\%hash1, \%hash2, '-')};
# output> with 'E' option >>> "name1 --HHH--1232-"
# Warning : Works only for 2 sequence hashes.
# Keywords : Overlap, superpose hash, overlay identical chars, superpose_seq_hash
# Options :
# Returns : one hash ref. of the combined key name (i.e., name1_name2). Combined by '_'
# Argument : 2 ref for hash of identical keys and value length. One optional arg for
# replacing space char to the given one.
# Category :
# Version : 1.0
#--------------------------------------------------------------------
sub overlay_seq_for_identical_chars{
my($i, $k,$j, $name1, $name2, @in, %out, @out_chars, $gap_chr, @str1, @str2);
######################################
####### Sub argument handling ######## $gap_chr here can be 'HE' etc.
######################################
for($k=0; $k< @_ ;$k++){
if( ( !ref($_[$k]) )&&($_[$k]=~ /^(.)$/) ){
$gap_chr .= $1; }
elsif((ref($_[$k]) eq "SCALAR")&&(${$_[$k]}=~ /^(.)$/) ){
$gap_chr .= $1; }
elsif(ref($_[$k]) eq "HASH") { push(@in, $_[$k]); } }
if(@in < 2){ print "\n overlay_seq_for_identical_chars needs 2 hashes. Error \n"; exit; }
my(%hash1)=%{$in[0]}; my(%hash2)=%{$in[1]};
my(@names1)=sort keys %hash1; my(@names2)= sort keys %hash2;
$name1 = $names1[0]; $name2 = $names2[0];
@str1=split(/|\,/, $hash1{$names1[0]}); @str2=split(/|\,/, $hash2{$names2[0]});
for($i=0; $i < @str1; $i++){
if($str1[$i] eq $str2[$i] ){
push(@out_chars, $str1[$i]); }
elsif( defined($gap_chr) ){ push(@out_chars, $gap_chr); }
else{ push(@out_chars, ' '); }
}
( run in 0.401 second using v1.01-cache-2.11-cpan-49f99fa48dc )