]> git.donarmstrong.com Git - biopieces.git/commitdiff
added fixedStep format to upload_to_ucsc
authormartinahansen <martinahansen@74ccb610-7750-0410-82ae-013aeee3265d>
Tue, 26 Aug 2008 01:36:32 +0000 (01:36 +0000)
committermartinahansen <martinahansen@74ccb610-7750-0410-82ae-013aeee3265d>
Tue, 26 Aug 2008 01:36:32 +0000 (01:36 +0000)
git-svn-id: http://biopieces.googlecode.com/svn/trunk@224 74ccb610-7750-0410-82ae-013aeee3265d

code_c/Maasha/src/gmon.out
code_perl/Maasha/Biopieces.pm

index 41152f85f890ab7b5d504a651ea78535c6e3c6ed..6ef1c72af9c77b2ef9324420c7d608769cc6d749 100644 (file)
Binary files a/code_c/Maasha/src/gmon.out and b/code_c/Maasha/src/gmon.out differ
index 072846c1783f29aafe88befbec10dcdbe357e888..69de5bb2a6901fd2043aadec34f69bc0c43c17a2 100644 (file)
@@ -1428,10 +1428,11 @@ sub script_read_fixedstep
 
             if ( $head =~ /^chrom=([^ ]+) start=(\d+) step=(\d+)$/ )
             {
-                $record->{ "CHR" }     = $1;
-                $record->{ "CHR_BEG" } = $2;
-                $record->{ "STEP" }    = $3;
-                $record->{ "VALS" }    = join ",", @{ $entry };
+                $record->{ "REC_TYPE" } = "fixed_step";
+                $record->{ "CHR" }      = $1;
+                $record->{ "CHR_BEG" }  = $2;
+                $record->{ "STEP" }     = $3;
+                $record->{ "VALS" }     = join ",", @{ $entry };
             }
 
             put_record( $record, $out );
@@ -5837,6 +5838,8 @@ sub script_upload_to_ucsc
 
     # Calculate the mean of values of given keys.
 
+    # This routine has developed into the most ugly hack. Do something!
+
     my ( $in,        # handle to in stream
          $out,       # handle to out stream
          $options,   # options hash
@@ -5845,7 +5848,7 @@ sub script_upload_to_ucsc
     # Returns nothing.
 
     my ( $record, $file, $wib_file, $wig_file, $wib_dir, $fh_in, $fh_out, $i, $first, $format, $args, $type, $columns, $append, %fh_hash,
-         $chr, $beg, $end, $block, $line, $max, $beg_block, $entry, $q_id, $clones );
+         $chr, $beg, $end, $block, $line, $max, $beg_block, $entry, $q_id, $clones, $vals );
 
     $options->{ "short_label" } ||= $options->{ 'table' };
     $options->{ "long_label" }  ||= $options->{ 'table' };
@@ -5865,8 +5868,6 @@ sub script_upload_to_ucsc
 
     if ( $options->{ 'wiggle' } )
     {
-        $options->{ "visibility" } = "full";
-
         while ( $record = get_record( $in ) )
         {
             put_record( $record, $out ) if not $options->{ "no_stream" };
@@ -5946,22 +5947,6 @@ sub script_upload_to_ucsc
 
         close $fh_out;
 
-        $wig_file = "$options->{ 'table' }.wig";
-        $wib_file = "$options->{ 'table' }.wib";
-
-        $wib_dir  = "$ENV{ 'HOME' }/ucsc/wib";
-
-        Maasha::Common::dir_create_if_not_exists( $wib_dir );
-
-        # Maasha::Common::run( "wigEncode", "$file $wig_file $wib_file > /dev/null 2>&1" );
-
-        `cd $BP_TMP && wigEncode $file $wig_file $wib_file > /dev/null 2>&1`;
-        Maasha::Common::run( "mv", "$BP_TMP/$wib_file $wib_dir" );
-
-        unlink $file;
-
-        $file = $wig_file;
-
         $format = "WIGGLE";
     }
     else
@@ -5972,7 +5957,17 @@ sub script_upload_to_ucsc
         {
             put_record( $record, $out ) if not $options->{ "no_stream" };
 
-            if ( $record->{ "REC_TYPE" } eq "PSL" )
+            if ( $record->{ "REC_TYPE" } eq "fixed_step" )
+            {
+                $vals = $record->{ "VALS" };
+                $vals =~ tr/,/\n/;
+
+                print $fh_out "fixedStep chrom=$record->{ 'CHR' } start=$record->{ 'CHR_BEG' } step=$record->{ 'STEP' }\n";
+                print $fh_out "$vals\n";
+
+                $format = "WIGGLE" if not $format;
+            }
+            elsif ( $record->{ "REC_TYPE" } eq "PSL" )
             {
                 Maasha::UCSC::psl_put_header( $fh_out ) if $first;
                 Maasha::UCSC::psl_put_entry( $record, $fh_out );
@@ -6088,6 +6083,22 @@ sub script_upload_to_ucsc
         }
         elsif ( $format eq "WIGGLE" )
         {
+            $options->{ "visibility" } = "full";
+
+            $wig_file = "$options->{ 'table' }.wig";
+            $wib_file = "$options->{ 'table' }.wib";
+
+            $wib_dir  = "$ENV{ 'HOME' }/ucsc/wib";
+
+            Maasha::Common::dir_create_if_not_exists( $wib_dir );
+
+            `cd $BP_TMP && wigEncode $file $wig_file $wib_file > /dev/null 2>&1`;
+            Maasha::Common::run( "mv", "$BP_TMP/$wib_file $wib_dir" );
+
+            unlink $file;
+
+            $file = $wig_file;
+
             $type = "wig 0";
 
             Maasha::UCSC::wiggle_upload_to_ucsc( $BP_TMP, $wib_dir, $file, $options );