]> git.donarmstrong.com Git - biopieces.git/blobdiff - code_perl/Maasha/TwoBit.pm
refactoring of assemble_pairs
[biopieces.git] / code_perl / Maasha / TwoBit.pm
index cc9d60023df0cbdf7c8c3a9e3232835eab03b50f..a8e7bcf3fa0e1d35e449b2980ecd3ed23f708857 100644 (file)
@@ -29,13 +29,14 @@ package Maasha::TwoBit;
 # >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
 
 
+use warnings;
 use warnings;
 use strict;
 use vars qw( @ISA @EXPORT );
 
 use Data::Dumper;
 
-use Inline ( C => <<'END_C', DIRECTORY => $ENV{ "TMP_DIR" } );
+use Inline ( C => <<'END_C', DIRECTORY => $ENV{ "BP_TMP" } );
 
 int find_block_beg( char *string, char c, int beg, int len )
 {
@@ -305,22 +306,22 @@ sub twobit_get_TOC
 
     sysseek $fh, 0, 0;
 
-    $signature = &unpack_32bit( $fh );
-    $version   = &unpack_32bit( $fh );
-    $seq_count = &unpack_32bit( $fh );
-    $reserved  = &unpack_32bit( $fh );
+    $signature = unpack_32bit( $fh );
+    $version   = unpack_32bit( $fh );
+    $seq_count = unpack_32bit( $fh );
+    $reserved  = unpack_32bit( $fh );
 
-    &Maasha::Common::error( qq(2bit file signature didn't match - inverse bit order?) ) if $signature != 0x1A412743;
+    Maasha::Common::error( qq(2bit file signature didn't match - inverse bit order?) ) if $signature != 0x1A412743;
 
     for ( $i = 0; $i < $seq_count; $i++ )
     {
-        $seq_name_size = &unpack_8bit( $fh );
+        $seq_name_size = unpack_8bit( $fh );
 
         sysread $fh, $string, $seq_name_size;
 
         $seq_name = unpack( "A$seq_name_size", $string );
 
-        $offset = &unpack_32bit( $fh );
+        $offset = unpack_32bit( $fh );
         
         push @AoA, [ $seq_name, $offset ];
     }
@@ -356,24 +357,24 @@ sub twobit_get_seq
 
     sysseek $fh, $offset, 0;
 
-    $seq_len = &unpack_32bit( $fh );
+    $seq_len = unpack_32bit( $fh );
     $sub_len = $seq_len if $sub_len > $seq_len;
 
-    $n_count = &unpack_32bit( $fh );
+    $n_count = unpack_32bit( $fh );
 
-    map { push @n_begs,  &unpack_32bit( $fh ) } 1 .. $n_count;
-    map { push @n_sizes, &unpack_32bit( $fh ) } 1 .. $n_count;
+    map { push @n_begs,  unpack_32bit( $fh ) } 1 .. $n_count;
+    map { push @n_sizes, unpack_32bit( $fh ) } 1 .. $n_count;
 
-    $m_count = &unpack_32bit( $fh );
+    $m_count = unpack_32bit( $fh );
 
-    map { push @m_begs,  &unpack_32bit( $fh ) } 1 .. $m_count;
-    map { push @m_sizes, &unpack_32bit( $fh ) } 1 .. $m_count;
+    map { push @m_begs,  unpack_32bit( $fh ) } 1 .. $m_count;
+    map { push @m_sizes, unpack_32bit( $fh ) } 1 .. $m_count;
 
-    $reserved = &unpack_32bit( $fh );
+    $reserved = unpack_32bit( $fh );
 
     $offset += 4 + 4 + $n_count * 8 + 4 + $m_count * 8 + 4;
 
-    $seq = &unpack_dna( $fh, $offset, $sub_beg, $sub_len );
+    $seq = unpack_dna( $fh, $offset, $sub_beg, $sub_len );
 
     for ( $n = 0; $n < $n_count; $n++ )
     {
@@ -514,12 +515,12 @@ sub fasta2twobit
     $seq_offset = 0;    # offset for reading sequence from FASTA file
     $offset     = 16;   # offset starting after header line which is 16 bytes
 
-    while ( $entry = &Maasha::Fasta::get_entry( $fh_in ) )
+    while ( $entry = Maasha::Fasta::get_entry( $fh_in ) )
     {
         $seq_len      = length $entry->[ SEQ ];
         $seq_name_len = length $entry->[ SEQ_NAME ];
 
-        $mask_index = &mask_locate( $entry->[ SEQ ], $mask );
+        $mask_index = mask_locate( $entry->[ SEQ ], $mask );
 
         $pack_len = ( $seq_len + ( 4 - ( $seq_len ) % 4 ) ) / 4;
 
@@ -604,7 +605,7 @@ sub fasta2twobit
         $seq = uc $seq;
         $seq =~ tr/RYWSMKHDVBN/TTTTTTTTTTT/;
 
-        $bin .= &pack_dna( $seq );
+        $bin .= pack_dna( $seq );
 
         print $fh_out $bin;
     }