clean:
cd $(LIB_DIR) && ${MAKE} clean
cd $(TEST_DIR) && ${MAKE} clean
- rm bed2chrom_files
rm bed2fixedstep
rm bed2tag_contigs
rm bed_sort
printf( "fixedStep chrom=%s start=%zu step=1\n", chr, beg + 1 );
for ( j = beg; j <= end; j++ ) {
- printf( "%hd\n", ba->array[ j ] );
+ printf( "%u\n", ba->array[ j ] );
}
}
}
/* Debug function to print the content of a byte array. */
- int i;
+ uint i;
printf( "\nba->nmemb: %zu ba->end: %zu\n", ba->nmemb, ba->end );
}
}
+ Maasha::Common::error( qq(no --database specified) ) if $script eq "remove_ucsc_tracks" and not $options{ "database" };
Maasha::Common::error( qq(no --database specified) ) if $script eq "create_blast_db" and not $options{ "database" };
Maasha::Common::error( qq(no --index_name specified) ) if $script =~ /create_vmatch_index/ and not $options{ "index_name" };
Maasha::Common::error( qq(no --database or --genome specified) ) if $script eq "blast_seq" and not $options{ "genome" } and not $options{ "database" };
put_record( $record, $out ) if not $options->{ 'no_stream' };
}
- # ---- locate track in config file ----
-
- $fh_in = Maasha::Common::read_open( $options->{ 'config_file' } );
+ $fh_in = Maasha::Filesys::file_read_open( $options->{ 'config_file' } );
while ( $track = Maasha::UCSC::ucsc_config_entry_get( $fh_in ) ) {
push @tracks, $track;
close $fh_in;
- map { push @new_tracks, $_ if not exists $track_hash{ $_->{ 'track' } } } @tracks;
-
- print STDERR qq(WARNING: track not found in config file: "$options->{ 'config_file' }"\n) if scalar @tracks == scalar @new_tracks;
+ foreach $track ( @tracks )
+ {
+ if ( not exists $track_hash{ $track->{ 'track' } } ) {
+ push @new_tracks, $track;
+ } else {
+ print STDERR qq(Removing track "$track->{ 'track' }" from config file.\n) if $options->{ 'verbose' };
+ }
+ }
rename "$options->{ 'config_file' }", "$options->{ 'config_file' }~";
- $fh_out = Maasha::Common::write_open( $options->{ 'config_file' } );
+ $fh_out = Maasha::Filesys::file_write_open( $options->{ 'config_file' } );
map { Maasha::UCSC::ucsc_config_entry_put( $_, $fh_out ) } @new_tracks;
# Returns nothing.
- my ( $file, %entry, $fh_out );
+ my ( $file, $entry, %new_entry, $fh_in, $fh_out, $was_found );
$file = $ENV{ "HOME" } . "/ucsc/my_tracks.ra";
Maasha::Filesys::file_copy( $file, "$file~" ); # create a backup
- %entry = (
+ %new_entry = (
database => $options->{ 'database' },
track => $options->{ 'table' },
shortLabel => $options->{ 'short_label' },
type => $type,
);
- $entry{ 'mafTrack' } = "multiz17way" if $type eq "type bed 6 +";
- $entry{ 'maxHeightPixels' } = "50:50:11" if $type eq "wig 0";
+ $new_entry{ 'mafTrack' } = "multiz17way" if $type eq "type bed 6 +";
+ $new_entry{ 'maxHeightPixels' } = "50:50:11" if $type eq "wig 0";
+
+ $fh_in = Maasha::Filesys::file_read_open( "$file~" );
+ $fh_out = Maasha::Filesys::file_write_open( $file );
+
+ while ( $entry = ucsc_config_entry_get( $fh_in ) )
+ {
+ if ( $entry->{ 'database' } eq $new_entry{ 'database' } and $entry->{ 'track' } eq $new_entry{ 'track' } )
+ {
+ ucsc_config_entry_put( \%new_entry, $fh_out );
- $fh_out = Maasha::Filesys::file_append_open( $file );
+ $was_found = 1;
+ }
+ else
+ {
+ ucsc_config_entry_put( $entry, $fh_out );
+ }
+ }
- ucsc_config_entry_put( \%entry, $fh_out );
+ ucsc_config_entry_put( \%new_entry, $fh_out ) if not $was_found;
+ close $fh_in;
close $fh_out;
Maasha::Common::run( "ucscMakeTracks.pl", "-b > /dev/null 2>&1" );