From f008038c37ebdd7bc0535da8645f11b59a4d5bde Mon Sep 17 00:00:00 2001 From: martinahansen Date: Tue, 11 Nov 2008 07:03:12 +0000 Subject: [PATCH] finished remove_ucsc_tracks git-svn-id: http://biopieces.googlecode.com/svn/trunk@307 74ccb610-7750-0410-82ae-013aeee3265d --- code_perl/Maasha/Biopieces.pm | 20 ++++++++++---------- code_perl/Maasha/UCSC.pm | 7 +++++-- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/code_perl/Maasha/Biopieces.pm b/code_perl/Maasha/Biopieces.pm index f4bb834..fc7cd05 100644 --- a/code_perl/Maasha/Biopieces.pm +++ b/code_perl/Maasha/Biopieces.pm @@ -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 ); } diff --git a/code_perl/Maasha/UCSC.pm b/code_perl/Maasha/UCSC.pm index adb8c93..7ae2e37 100644 --- a/code_perl/Maasha/UCSC.pm +++ b/code_perl/Maasha/UCSC.pm @@ -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 -- 2.39.5