my ( $options, $in, $out );
-# script_list_biopieces( $ENV{ 'INST_DIR'} . "/biopieces/usage/" ) if $script eq "list_biopieces";
-
$options = get_options( $script );
- if ( -t STDIN and not @ARGV )
- {
- $options->{ "path" } = "$ENV{ 'BP_DIR' }/bp_usage/$script";
- $script = "print_usage";
- }
+ $script = "print_usage" if ( -t STDIN and not @ARGV and $script ne "list_biopieces" );
- $in = read_stream( $options->{ "stream_in" } );
- $out = write_stream( $options->{ "stream_out" } );
+ $in = read_stream( $options->{ "stream_in" } );
+ $out = write_stream( $options->{ "stream_out" } );
if ( $script eq "print_usage" ) { script_print_usage( $in, $out, $options ) }
+ elsif ( $script eq "list_biopieces" ) { script_list_biopieces( $in, $out, $options ) }
elsif ( $script eq "read_fasta" ) { script_read_fasta( $in, $out, $options ) }
elsif ( $script eq "read_tab" ) { script_read_tab( $in, $out, $options ) }
elsif ( $script eq "read_psl" ) { script_read_psl( $in, $out, $options ) }
my ( %options, @options, $opt, @genomes );
- if ( $script eq "read_fasta" )
+ if ( $script eq "print_usage" )
+ {
+ @options = qw(
+ data_in|i=s
+ );
+ }
+ elsif ( $script eq "read_fasta" )
{
@options = qw(
data_in|i=s
# print STDERR Dumper( \%options ) and exit;
+ $options{ "script" } = $script;
+
$options{ "cols" } = [ split ",", $options{ "cols" } ] if defined $options{ "cols" };
$options{ "keys" } = [ split ",", $options{ "keys" } ] if defined $options{ "keys" };
$options{ "no_keys" } = [ split ",", $options{ "no_keys" } ] if defined $options{ "no_keys" };
# Returns nothing.
- my ( $wiki, $lines );
+ my ( $file, $wiki, $lines );
+
+ if ( $options->{ 'data_in' } ) {
+ $file = $options->{ 'data_in' };
+ } else {
+ $file = join "", $ENV{ 'BP_DIR' }, "/bp_usage/", $options->{ 'script' }, ".wiki";
+ }
- $wiki = Maasha::Gwiki::gwiki_read( "$options->{ 'path' }.wiki" );
+ $wiki = Maasha::Gwiki::gwiki_read( $file );
if ( not $options->{ "help" } ) {
@{ $wiki } = grep { $_->[ 0 ]->{ 'SECTION' } =~ /Biopiece|Synopsis|Usage|Options|Help/ } @{ $wiki };
{
# Martin A. Hansen, January 2008.
- # Prints the description from the usage for each of the biopieces.
+ # Prints the synopsis from the usage for each of the biopieces.
- my ( $path, # full path to usage directory
+ my ( $in, # handle to in stream
+ $out, # handle to out stream
+ $options, # options hash
) = @_;
# Returns nothing.
- my ( @files, $file, $fh, $line, @lines, $program );
+ my ( @files, $file, $wiki, $program, $synopsis );
- @files = Maasha::Common::ls_files( $path );
+ @files = Maasha::Common::ls_files( "$ENV{ 'BP_DIR' }/bp_usage" );
foreach $file ( sort @files )
{
- $program = ( split "/", $file )[ -1 ];
-
- $fh = Maasha::Common::read_open( $file );
-
- while ( $line = <$fh> )
+ if ( $file =~ /\/([a-z0-9_]+)\.wiki$/ )
{
- chomp $line;
+ $program = $1;
- if ( $line =~ /^Description:\s+(.+)/ )
- {
- @lines = Maasha::Common::wrap_line( $1, 60 );
+ $wiki = Maasha::Gwiki::gwiki_read( $file );
- printf( "%-30s%s\n", $program, shift @lines );
+ @{ $wiki } = grep { $_->[ 0 ]->{ 'SECTION' } =~ /Synopsis/ } @{ $wiki };
+ @{ $wiki } = grep { $_->[ 0 ]->{ 'FORMAT' } =~ /paragraph/ } @{ $wiki };
- map { printf( "%-30s%s\n", "", $_ ) } @lines;
- }
- }
+ $synopsis = $wiki->[ 0 ]->[ 0 ]->{ 'TEXT' };
- close $fh;
+ printf( "%-30s%s\n", $program, $synopsis );
+ }
}
exit;