From efb960df45efb634e2639ff911475a9d598cacee Mon Sep 17 00:00:00 2001 From: eead-csic-compbio Date: Thu, 27 Oct 2016 17:27:40 +0200 Subject: [PATCH] fixed bug in plot_matrix_heatmap.sh -c X ; now only rows with values < X are retained, as expected --- CHANGES.txt | 1 + lib/phyTools.pm | 8 ++++---- plot_matrix_heatmap.sh | 10 ++++++---- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index 324d253..fa00cec 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -155,3 +155,4 @@ 17102016: updated manual with FAQ about ANI calculation on soft-core clusters (thanks Raffael Inglin) 18102016: added FAQ explaining the meaning of branch numbers in compare_clusters.pl -T trees 18102016: added extra check to pfam_enrich.pl +27102016: fixed bug in plot_matrix_heatmap.sh -c X ; now only rows with values < X are retained, as expected (thanks Valerie!) diff --git a/lib/phyTools.pm b/lib/phyTools.pm index b87529c..d6d7935 100755 --- a/lib/phyTools.pm +++ b/lib/phyTools.pm @@ -281,7 +281,7 @@ sub read_FASTA_sequence if(!open(FASTA,"gzip -dc $infile |")) { die "# read_FASTA_sequence: cannot read GZIP compressed $infile $!\n" - ."# please check gzip in installed\n"; + ."# please check gzip is installed\n"; } } elsif($infile =~ /\.bz2$/ || $magic eq "BZ") # BZIP2 compressed input @@ -289,7 +289,7 @@ sub read_FASTA_sequence if(!open(FASTA,"bzip2 -dc $infile |")) { die "# read_FASTA_sequence: cannot read BZIP2 compressed $infile $!\n" - ."# please check bzip2 in installed\n"; + ."# please check bzip2 is installed\n"; } } else{ open(FASTA,"<$infile") || die "# read_FASTA_sequence: cannot read $infile $!\n"; } @@ -428,7 +428,7 @@ sub read_FASTA_file_array if(!open(FASTA,"gzip -dc $infile |")) { die "# read_FASTA_sequence_array: cannot read GZIP compressed $infile $!\n" - ."# please check gzip in installed\n"; + ."# please check gzip is installed\n"; } } elsif($infile =~ /\.bz2$/ || $magic eq "BZ") # BZIP2 compressed input @@ -436,7 +436,7 @@ sub read_FASTA_file_array if(!open(FASTA,"bzip2 -dc $infile |")) { die "# read_FASTA_sequence_array: cannot read BZIP2 compressed $infile $!\n" - ."# please check bzip2 in installed\n"; + ."# please check bzip2 is installed\n"; } } else{ open(FASTA,"<$infile") || die "# read_FASTA_sequence_array: cannot read $infile $!\n"; } diff --git a/plot_matrix_heatmap.sh b/plot_matrix_heatmap.sh index 238625a..190497a 100755 --- a/plot_matrix_heatmap.sh +++ b/plot_matrix_heatmap.sh @@ -253,13 +253,13 @@ if [ $sim_cutoff_int -ne 100 ] then heatmap_outfile="${tab_file%.*}_sim_cutoff_${sim_cutoff}_heatmap.$outformat" echo "# Plotting file $heatmap_outfile" + nj_tree="${tab_file%.*}_sim_cutoff_${sim_cutoff}_BioNJ.ph" else heatmap_outfile="${tab_file%.*}_heatmap.$outformat" echo "# Plotting file $heatmap_outfile" + nj_tree="${tab_file%.*}_BioNJ.ph" fi -nj_tree="${tab_file%.*}_BioNJ.ph" - # 2) call R using a heredoc and write the resulting script to file R --no-save -q < ${progname%.*}_script_run_at_${start_time}.R library("gplots") @@ -272,8 +272,10 @@ rownames(mat_dat) <- rnames if($sim_cutoff < 100) { - rows <- (apply( mat_dat , 1 , function(x) any( x < $sim_cutoff) ) ) - mat_dat <- mat_dat[rows, rows] + tmp_mat = mat_dat + diag(tmp_mat) = NA + rows <- (!apply( tmp_mat , 1 , function(x) any( x > $sim_cutoff , na.rm=T) ) ) + mat_dat <- mat_dat[rows, rows] } if($reorder_clusters > 0){