]> git.donarmstrong.com Git - biopieces.git/commitdiff
fixed bug in Fasta.pm
authormartinahansen <martinahansen@74ccb610-7750-0410-82ae-013aeee3265d>
Mon, 15 Jun 2009 14:13:56 +0000 (14:13 +0000)
committermartinahansen <martinahansen@74ccb610-7750-0410-82ae-013aeee3265d>
Mon, 15 Jun 2009 14:13:56 +0000 (14:13 +0000)
git-svn-id: http://biopieces.googlecode.com/svn/trunk@524 74ccb610-7750-0410-82ae-013aeee3265d

code_perl/Maasha/Common.pm
code_perl/Maasha/Fasta.pm
code_perl/Maasha/Filesys.pm

index 83c963301942ff9e01a27e4f3a624c22f9b142e6..9fc7eabd3348bfe614229a88904602c2b23a7d20 100644 (file)
@@ -294,38 +294,6 @@ sub pipe_open
 }
 
 
-sub file_store
-{
-    # Martin A. Hansen, December 2004.
-
-    # writes a data structure to file.
-
-    my ( $path,      # full path to file
-         $data,      # data structure
-       ) = @_;
-    
-    Storable::store( $data, $path ) or Maasha::Common::error( qq(Could not write-open file "$path": $!) );
-}
-
-
-sub file_retrieve
-{
-    # Martin A. Hansen, December 2004.
-
-    # retrieves hash data structure
-    # (this routines needs to test if its a hash, array or else)
-
-    my ( $path,   # full path to data file
-       ) = @_;
-
-    my ( $data );
-
-    $data = Storable::retrieve( $path ) or Maasha::Common::error( qq(Could not read-open file "$path": $!) );
-
-    return wantarray ? %{ $data } : $data;
-}
-
-
 sub read_args
 {
     # Martin A. Hansen, December 2006
index a81a546de9fdd4048339fbd2db28ec5f2c228f3b..55a17b570e2327011aed2e84189cd229f815ab34 100644 (file)
@@ -31,6 +31,7 @@ package Maasha::Fasta;
 use strict;
 use Data::Dumper;
 use Maasha::Common;
+use Maasha::Filesys;
 use Maasha::Seq;
 use vars qw ( @ISA @EXPORT );
 
@@ -365,11 +366,11 @@ sub index_create
 
     my ( $file_size, $fh, $entry, $beg, $len, %hash, @index );
 
-    $file_size = Maasha::Common::file_size( $path );
+    $file_size = Maasha::Filesys::file_size( $path );
 
     push @index, "FILE_SIZE=$file_size";
 
-    $fh = Maasha::Common::read_open( $path );
+    $fh = Maasha::Filesys::file_read_open( $path );
 
     $beg = 0;
     $len = 0;
@@ -465,7 +466,7 @@ sub index_store
 
     # returns nothing
 
-    Maasha::Common::file_store( $path, $index );
+    Maasha::Filesys::file_store( $path, $index );
 }
 
 
@@ -482,7 +483,7 @@ sub index_retrieve
 
     my $index;
 
-    $index = Maasha::Common::file_retrieve( $path );
+    $index = Maasha::Filesys::file_retrieve( $path );
 
     return wantarray ? @{ $index } : $index;
 }
index b189a4124e8dc53c380891fa6effed427ad05759..b545609787529c3f991efe13853fd8bd49c68d43 100644 (file)
@@ -31,6 +31,7 @@ package Maasha::Filesys;
 
 use strict;
 use IO::File;
+use Storable;
 use Maasha::Common;
 
 use Exporter;
@@ -202,6 +203,38 @@ sub file_read
 }
 
 
+sub file_store
+{
+    # Martin A. Hansen, December 2004.
+
+    # writes a data structure to file.
+
+    my ( $path,      # full path to file
+         $data,      # data structure
+       ) = @_;
+    
+    Storable::store( $data, $path ) or Maasha::Common::error( qq(Could not write-open file "$path": $!) );
+}
+
+
+sub file_retrieve
+{
+    # Martin A. Hansen, December 2004.
+
+    # retrieves hash data structure
+    # (this routines needs to test if its a hash, array or else)
+
+    my ( $path,   # full path to data file
+       ) = @_;
+
+    my ( $data );
+
+    $data = Storable::retrieve( $path ) or Maasha::Common::error( qq(Could not read-open file "$path": $!) );
+
+    return wantarray ? %{ $data } : $data;
+}
+
+
 sub file_copy
 {
     # Martin A. Hansen, November 2008.