]> git.donarmstrong.com Git - biopieces.git/commitdiff
finished remove_ucsc_tracks
authormartinahansen <martinahansen@74ccb610-7750-0410-82ae-013aeee3265d>
Tue, 11 Nov 2008 07:03:12 +0000 (07:03 +0000)
committermartinahansen <martinahansen@74ccb610-7750-0410-82ae-013aeee3265d>
Tue, 11 Nov 2008 07:03:12 +0000 (07:03 +0000)
git-svn-id: http://biopieces.googlecode.com/svn/trunk@307 74ccb610-7750-0410-82ae-013aeee3265d

code_perl/Maasha/Biopieces.pm
code_perl/Maasha/UCSC.pm

index f4bb8344d27ae30c3792d1f5f113bdd11e30fd35..fc7cd05e9782e77398d6f49c7bea07f08f34989e 100644 (file)
@@ -5109,7 +5109,15 @@ sub script_remove_ucsc_tracks
 
     map { push @new_tracks, $_ if not exists $track_hash{ $_->{ 'track' } } } @tracks;
 
-    Maasha::Common::error( qq(track not found in config file: "$options->{ 'config_file' }") ) if scalar @tracks == scalar @new_tracks;
+    print STDERR qq(WARNING: track not found in config file: "$options->{ 'config_file' }"\n) if scalar @tracks == scalar @new_tracks;
+
+    rename "$options->{ 'config_file' }", "$options->{ 'config_file' }~";
+
+    $fh_out = Maasha::Common::write_open( $options->{ 'config_file' } );
+
+    map { Maasha::UCSC::ucsc_config_put_entry( $_, $fh_out ) } @new_tracks;
+
+    close $fh_out;
 
     # ---- locate track in database ----
 
@@ -5125,18 +5133,10 @@ sub script_remove_ucsc_tracks
         }
         else
         {
-            Maasha::Common::error qq(table "$track" not found in database "$options->{ 'database' }");
+            print STDERR qq(WARNING: table "$track" not found in database "$options->{ 'database' }\n");
         }
     }
 
-    rename "$options->{ 'config_file' }", "$options->{ 'config_file' }~";
-
-    $fh_out = Maasha::Common::write_open( $options->{ 'config_file' } );
-
-    map { Maasha::UCSC::ucsc_config_put_entry( $_, $fh_out ) } @new_tracks;
-
-    close $fh_out;
-
     Maasha::SQL::disconnect( $dbh );
 }
 
index adb8c9333e155030bba3740e2570b2287b1e1530..7ae2e37924b250bf7034954866ace0da1498088c 100644 (file)
@@ -919,7 +919,10 @@ sub ucsc_config_get_entry
 
     while ( $line = <$fh> )
     {
-        if ( $line =~ /^# date: (.+)/ ) {
+        if ( $line =~ /Track added by 'upload_to_ucsc' (\S+) (\S+)/) {
+             $record{ 'date' } = $1;
+             $record{ 'time' } = $2;
+        } elsif ( $line =~ /^# date: (.+)/ ) {
             $record{ 'date' } = $1;
         } elsif ( $line =~ /^# time: (.+)/ ) {
             $record{ 'time' } = $1;
@@ -964,7 +967,7 @@ sub ucsc_config_put_entry
 
     print $fh_out "\n# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n\n";
 
-    map { print $fh_out "# $record->{ $_ }\n" if exists $record->{ $_ } } qw( date time database );
+    map { print $fh_out "# $_: $record->{ $_ }\n" if exists $record->{ $_ } } qw( date time database );
     map { print $fh_out "$_ $record->{ $_ }\n" if exists $record->{ $_ } } qw( track
                                                                                name
                                                                                description