From 2c254b7f1a635b629f42f64bda29481321b1f063 Mon Sep 17 00:00:00 2001 From: martinahansen Date: Wed, 16 Sep 2009 07:47:39 +0000 Subject: [PATCH] fixed match_seq bug git-svn-id: http://biopieces.googlecode.com/svn/trunk@668 74ccb610-7750-0410-82ae-013aeee3265d --- bp_bin/match_seq | 4 ++-- code_perl/Maasha/Fasta.pm | 25 ++++++++++++++++++++++++- code_perl/Maasha/Match.pm | 1 - code_perl/Maasha/Plot.pm | 7 +++++-- 4 files changed, 31 insertions(+), 6 deletions(-) diff --git a/bp_bin/match_seq b/bp_bin/match_seq index bb95a3f..d5362fa 100755 --- a/bp_bin/match_seq +++ b/bp_bin/match_seq @@ -64,9 +64,9 @@ if ( @entries == 1 ) map { Maasha::Biopieces::put_record( $_, $out ) } @{ $results }; } -elsif ( @entries == 2 ) +else { - $results = Maasha::Match::match_mummer( [ $entries[ 0 ] ], [ $entries[ 1 ] ], $options, $tmp_dir ); + $results = Maasha::Match::match_mummer( [ shift @entries ], \@entries, $options, $tmp_dir ); map { Maasha::Biopieces::put_record( $_, $out ) } @{ $results }; } diff --git a/code_perl/Maasha/Fasta.pm b/code_perl/Maasha/Fasta.pm index 4e28f87..2066155 100644 --- a/code_perl/Maasha/Fasta.pm +++ b/code_perl/Maasha/Fasta.pm @@ -95,7 +95,7 @@ sub put_entry { # Martin A. Hansen, January 2007. - # Writes FASTA entries to STDOUT or file. + # Writes a FASTA entry to a file handle. my ( $entry, # a FASTA entries $fh, # file handle to output file - OPTIONAL @@ -119,6 +119,29 @@ sub put_entry } +sub put_entries +{ + # Martin A. Hansen, September 2009 + + # Write FASTA entries to a file. + + my ( $entries, # list of FASTA entries + $file, # output file + $wrap, # line width - OPTIONAL + ) = @_; + + # Returns nothing + + my ( $fh ); + + $fh = Maasha::Filesys::file_write_open( $file ); + + map { put_entry( $_, $fh, $wrap ) } @{ $entries }; + + close $fh; +} + + sub wrap { # Martin A. Hansen, June 2007 diff --git a/code_perl/Maasha/Match.pm b/code_perl/Maasha/Match.pm index 9d315b7..1e971ba 100644 --- a/code_perl/Maasha/Match.pm +++ b/code_perl/Maasha/Match.pm @@ -123,7 +123,6 @@ sub match_mummer push @results, dclone $result; } - } unlink $file_in1; diff --git a/code_perl/Maasha/Plot.pm b/code_perl/Maasha/Plot.pm index 4981b62..a662fbc 100644 --- a/code_perl/Maasha/Plot.pm +++ b/code_perl/Maasha/Plot.pm @@ -97,8 +97,11 @@ sub lineplot_simple for ( $i = 1; $i < scalar @{ $data->[ 0 ] } + 1; $i++ ) { - $title = $options->{ 'keys' }->[ $i - 1 ] || $options->{ 'list' }; - push @plot_cmd, qq("$tmp_file" using $i with lines title "$title"); + if ( ( $i % 5 ) == 0 ) + { + $title = $options->{ 'keys' }->[ $i - 1 ] || $options->{ 'list' }; + push @plot_cmd, qq("$tmp_file" using $i with lines title "$title"); + } } print $fh_in "plot " . join( ", ", @plot_cmd ) . "\n"; -- 2.39.2