if ( $script eq "print_usage" ) { script_print_usage( $in, $out, $options ) }
elsif ( $script eq "read_stockholm" ) { script_read_stockholm( $in, $out, $options ) }
- elsif ( $script eq "read_phastcons" ) { script_read_phastcons( $in, $out, $options ) }
- elsif ( $script eq "read_mysql" ) { script_read_mysql( $in, $out, $options ) }
elsif ( $script eq "uppercase_seq" ) { script_uppercase_seq( $in, $out, $options ) }
elsif ( $script eq "complexity_seq" ) { script_complexity_seq( $in, $out, $options ) }
elsif ( $script eq "get_genome_align" ) { script_get_genome_align( $in, $out, $options ) }
num|n=s
);
}
- elsif ( $script eq "read_phastcons" )
- {
- @options = qw(
- data_in|i=s
- num|n=s
- min|m=s
- dist|d=s
- threshold|t=f
- gap|g=s
- );
- }
- elsif ( $script eq "read_mysql" )
- {
- @options = qw(
- database|d=s
- query|q=s
- user|u=s
- password|p=s
- );
- }
elsif ( $script eq "get_genome_align" )
{
@options = qw(
}
-sub script_read_phastcons
-{
- # Martin A. Hansen, December 2007.
-
- # Read PhastCons format.
-
- my ( $in, # handle to in stream
- $out, # handle to out stream
- $options, # options hash
- ) = @_;
-
- # Returns nothing.
-
- my ( $data_in, $file, $num, $entry, @records, $record );
-
- $options->{ "min" } ||= 10;
- $options->{ "dist" } ||= 25;
- $options->{ "threshold" } ||= 0.8;
- $options->{ "gap" } ||= 5;
-
- while ( $record = Maasha::Biopieces::get_record( $in ) ) {
- Maasha::Biopieces::put_record( $record, $out );
- }
-
- $num = 1;
-
- foreach $file ( @{ $options->{ "files" } } )
- {
- $data_in = Maasha::Common::read_open( $file );
-
- while ( $entry = Maasha::UCSC::fixedstep_get_entry( $data_in ) )
- {
- @records = Maasha::UCSC::phastcons_parse_entry( $entry, $options );
-
- foreach $record ( @records )
- {
- $record->{ "REC_TYPE" } = "BED";
- $record->{ "BED_LEN" } = $record->{ "CHR_END" } - $record->{ "CHR_BEG" } + 1;
-
- Maasha::Biopieces::put_record( $record, $out );
-
- goto NUM if $options->{ "num" } and $num == $options->{ "num" };
-
- $num++;
- }
- }
-
- close $data_in;
- }
-
- NUM:
-
- close $data_in if $data_in;
-}
-
-
-sub script_read_mysql
-{
- # Martin A. Hansen, May 2008.
-
- # Read a MySQL query into stream.
-
- my ( $in, # handle to in stream
- $out, # handle to out stream
- $options, # options hash
- ) = @_;
-
- # Returns nothing.
-
- my ( $record, $dbh, $results );
-
- $options->{ "user" } ||= Maasha::UCSC::ucsc_get_user();
- $options->{ "password" } ||= Maasha::UCSC::ucsc_get_password();
-
- while ( $record = Maasha::Biopieces::get_record( $in ) ) {
- Maasha::Biopieces::put_record( $record, $out );
- }
-
- $dbh = Maasha::SQL::connect( $options->{ "database" }, $options->{ "user" }, $options->{ "password" } );
-
- $results = Maasha::SQL::query_hashref_list( $dbh, $options->{ "query" } );
-
- Maasha::SQL::disconnect( $dbh );
-
- map { Maasha::Biopieces::put_record( $_ ) } @{ $results };
-}
-
-
sub script_complexity_seq
{
# Martin A. Hansen, May 2008.