]> git.donarmstrong.com Git - biopieces.git/blobdiff - code_perl/Maasha/UCSC.pm
revised KISS format
[biopieces.git] / code_perl / Maasha / UCSC.pm
index 7445807a42029c8940cd36716b7aa2349406b84c..5c188fd1ffbaa800cf5dd42cb8238297b4c0728d 100644 (file)
@@ -28,6 +28,7 @@ package Maasha::UCSC;
 # >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
 
 
+use warnings;
 use strict;
 use vars qw ( @ISA @EXPORT );
 
@@ -683,68 +684,6 @@ CREATE TABLE $table (
 }
 
 
-sub psl_put_header
-{
-    # Martin A. Hansen, September 2007.
-
-    # Write a PSL header to file.
-
-    my ( $fh,  # file handle  - OPTIONAL
-       ) = @_;
-
-    # Returns nothing.
-
-    $fh = \*STDOUT if not $fh;
-
-    print $fh qq(psLayout version 3
-match   mis-    rep.    N's     Q gap   Q gap   T gap   T gap   strand  Q               Q       Q       Q       T               T       T       T       block   blockSizes      qStart        match   match           count   bases   count   bases           name            size    start   end     name            size    start   end     count
---------------------------------------------------------------------------------------------------------------------------------------------------------------- 
-);
-}
-
-
-sub psl_put_entry
-{
-    # Martin A. Hansen, September 2007.
-
-    # Write a PSL entry to file.
-
-    my ( $record,       # hashref
-         $fh,           # file handle  -  OPTIONAL
-       ) = @_;
-
-    # Returns nothing.
-
-    $fh = \*STDOUT if not $fh;
-
-    my @output;
-
-    push @output, $record->{ "MATCHES" };
-    push @output, $record->{ "MISMATCHES" };
-    push @output, $record->{ "REPMATCHES" };
-    push @output, $record->{ "NCOUNT" };
-    push @output, $record->{ "QNUMINSERT" };
-    push @output, $record->{ "QBASEINSERT" };
-    push @output, $record->{ "SNUMINSERT" };
-    push @output, $record->{ "SBASEINSERT" };
-    push @output, $record->{ "STRAND" };
-    push @output, $record->{ "Q_ID" };
-    push @output, $record->{ "Q_LEN" };
-    push @output, $record->{ "Q_BEG" };
-    push @output, $record->{ "Q_END" } + 1;
-    push @output, $record->{ "S_ID" };
-    push @output, $record->{ "S_LEN" };
-    push @output, $record->{ "S_BEG" };
-    push @output, $record->{ "S_END" } + 1;
-    push @output, $record->{ "BLOCK_COUNT" };
-    push @output, $record->{ "BLOCK_LENS" };
-    push @output, $record->{ "Q_BEGS" };
-    push @output, $record->{ "S_BEGS" };
-
-    print $fh join( "\t", @output ), "\n";
-}
-
-
 sub psl_upload_to_ucsc
 {
     # Martin A. Hansen, September 2007.
@@ -1216,6 +1155,11 @@ sub phastcons_parse_entry
     # Given a PhastCons entry converts this to a
     # list of super blocks.
 
+#    $options->{ "min" }       ||= 10;
+#    $options->{ "dist" }      ||= 25;
+#    $options->{ "threshold" } ||= 0.8;
+#    $options->{ "gap" }       ||= 5;
+
     my ( $lines,   # list of lines
          $args,    # argument hash
        ) = @_;
@@ -1351,7 +1295,7 @@ sub phastcons_normalize
 
     # Normalizes a list of lists with PhastCons scores,
     # in such a way that each list contains the same number
-    # or PhastCons scores.
+    # of PhastCons scores.
 
     my ( $AoA,    # AoA with PhastCons scores
        ) = @_;
@@ -1415,7 +1359,7 @@ sub phastcons_list_inflate
         # splice @{ $list }, $pos, 0, "X";
     }
 
-    die qq(ERROR: bad inflate\n) if scalar @{ $list } != $len + $diff;
+    die qq(ERROR: Bad inflate\n) if scalar @{ $list } != $len + $diff;
 }
 
 
@@ -1445,7 +1389,7 @@ sub phastcons_list_deflate
         splice @{ $list }, $pos, 1;
     }
 
-    die qq(ERROR: bad deflate\n) if scalar @{ $list } != $len - $diff;
+    die qq(ERROR: Dad deflate\n) if scalar @{ $list } != $len - $diff;
 }
 
 
@@ -1638,9 +1582,13 @@ sub ucsc_get_user
 
     # Returns a string.
 
-    my ( $fh, $line, $user );
+    my ( $file, $fh, $line, $user );
+
+    $file = "$ENV{ 'HOME' }/.hg.conf";
 
-    $fh = Maasha::Common::read_open( "$ENV{ 'HOME' }/.hg.conf" );
+    return if not -f $file;
+
+    $fh = Maasha::Common::read_open( $file );
 
     while ( $line = <$fh> )
     {
@@ -1669,9 +1617,13 @@ sub ucsc_get_password
 
     # Returns a string.
 
-    my ( $fh, $line, $password );
+    my ( $file, $fh, $line, $password );
+
+    $file = "$ENV{ 'HOME' }/.hg.conf";
+
+    return if not -f $file;
 
-    $fh = Maasha::Common::read_open( "$ENV{ 'HOME' }/.hg.conf" );
+    $fh = Maasha::Common::read_open( $file );
 
     while ( $line = <$fh> )
     {