my ( $script, $BP_TMP );
-$script = &Maasha::Common::get_scriptname();
-$BP_TMP = &Maasha::Common::get_tmpdir();
+$script = Maasha::Common::get_scriptname();
+$BP_TMP = Maasha::Common::get_tmpdir();
# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> LOG <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-my $log_fh = &Maasha::Common::append_open( $ENV{ "LOG_DIR" } . "/biopieces.log" );
+my $log_fh = Maasha::Common::append_open( $ENV{ "LOG_DIR" } . "/biopieces.log" );
$log_fh->autoflush( 1 );
-&log( $log_fh, $script, \@ARGV );
+log( $log_fh, $script, \@ARGV );
close $log_fh;
my $t0 = gettimeofday();
-&run_script( $script );
+run_script( $script );
my $t1 = gettimeofday();
my ( $time_stamp, $user );
- $time_stamp = &Maasha::Common::time_stamp();
+ $time_stamp = Maasha::Common::time_stamp();
$user = $ENV{ "USER" };
my ( $options, $in, $out );
- &script_list_biopieces( $ENV{ 'INST_DIR'} . "/biopieces/usage/" ) if $script eq "list_biopieces";
-
- &script_print_usage( $ENV{ 'INST_DIR'} . "/biopieces/usage/$script" ) if -t STDIN and not @ARGV;
-
- $options = &get_options( $script );
-
- $in = &read_stream( $options->{ "stream_in" } );
- $out = &write_stream( $options->{ "stream_out" } );
-
- if ( $script eq "read_fasta" ) { &script_read_fasta( $in, $out, $options ) }
- elsif ( $script eq "read_align" ) { &script_read_align( $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 ) }
- elsif ( $script eq "read_bed" ) { &script_read_bed( $in, $out, $options ) }
- elsif ( $script eq "read_blast_tab" ) { &script_read_blast_tab( $in, $out, $options ) }
- elsif ( $script eq "read_embl" ) { &script_read_embl( $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_soft" ) { &script_read_soft( $in, $out, $options ) }
- elsif ( $script eq "read_gff" ) { &script_read_gff( $in, $out, $options ) }
- elsif ( $script eq "read_2bit" ) { &script_read_2bit( $in, $out, $options ) }
- elsif ( $script eq "read_solexa" ) { &script_read_solexa( $in, $out, $options ) }
- elsif ( $script eq "read_solid" ) { &script_read_solid( $in, $out, $options ) }
- elsif ( $script eq "read_mysql" ) { &script_read_mysql( $in, $out, $options ) }
- elsif ( $script eq "count_seq" ) { &script_count_seq( $in, $out, $options ) }
- elsif ( $script eq "length_seq" ) { &script_length_seq( $in, $out, $options ) }
- elsif ( $script eq "uppercase_seq" ) { &script_uppercase_seq( $in, $out, $options ) }
- elsif ( $script eq "shuffle_seq" ) { &script_shuffle_seq( $in, $out, $options ) }
- elsif ( $script eq "analyze_seq" ) { &script_analyze_seq( $in, $out, $options ) }
- elsif ( $script eq "analyze_tags" ) { &script_analyze_tags( $in, $out, $options ) }
- elsif ( $script eq "complexity_seq" ) { &script_complexity_seq( $in, $out, $options ) }
- elsif ( $script eq "oligo_freq" ) { &script_oligo_freq( $in, $out, $options ) }
- elsif ( $script eq "create_weight_matrix" ) { &script_create_weight_matrix( $in, $out, $options ) }
- elsif ( $script eq "calc_bit_scores" ) { &script_calc_bit_scores( $in, $out, $options ) }
- elsif ( $script eq "reverse_seq" ) { &script_reverse_seq( $in, $out, $options ) }
- elsif ( $script eq "complement_seq" ) { &script_complement_seq( $in, $out, $options ) }
- elsif ( $script eq "remove_indels" ) { &script_remove_indels( $in, $out, $options ) }
- elsif ( $script eq "transliterate_seq" ) { &script_transliterate_seq( $in, $out, $options ) }
- elsif ( $script eq "transliterate_vals" ) { &script_transliterate_vals( $in, $out, $options ) }
- elsif ( $script eq "translate_seq" ) { &script_translate_seq( $in, $out, $options ) }
- elsif ( $script eq "extract_seq" ) { &script_extract_seq( $in, $out, $options ) }
- elsif ( $script eq "get_genome_seq" ) { &script_get_genome_seq( $in, $out, $options ) }
- elsif ( $script eq "get_genome_align" ) { &script_get_genome_align( $in, $out, $options ) }
- elsif ( $script eq "get_genome_phastcons" ) { &script_get_genome_phastcons( $in, $out, $options ) }
- elsif ( $script eq "fold_seq" ) { &script_fold_seq( $in, $out, $options ) }
- elsif ( $script eq "split_seq" ) { &script_split_seq( $in, $out, $options ) }
- elsif ( $script eq "split_bed" ) { &script_split_bed( $in, $out, $options ) }
- elsif ( $script eq "align_seq" ) { &script_align_seq( $in, $out, $options ) }
- elsif ( $script eq "tile_seq" ) { &script_tile_seq( $in, $out, $options ) }
- elsif ( $script eq "invert_align" ) { &script_invert_align( $in, $out, $options ) }
- elsif ( $script eq "patscan_seq" ) { &script_patscan_seq( $in, $out, $options ) }
- elsif ( $script eq "create_blast_db" ) { &script_create_blast_db( $in, $out, $options ) }
- elsif ( $script eq "blast_seq" ) { &script_blast_seq( $in, $out, $options ) }
- elsif ( $script eq "blat_seq" ) { &script_blat_seq( $in, $out, $options ) }
- elsif ( $script eq "match_seq" ) { &script_match_seq( $in, $out, $options ) }
- elsif ( $script eq "create_vmatch_index" ) { &script_create_vmatch_index( $in, $out, $options ) }
- elsif ( $script eq "vmatch_seq" ) { &script_vmatch_seq( $in, $out, $options ) }
- elsif ( $script eq "write_fasta" ) { &script_write_fasta( $in, $out, $options, $options ) }
- elsif ( $script eq "write_align" ) { &script_write_align( $in, $out, $options ) }
- elsif ( $script eq "write_blast" ) { &script_write_blast( $in, $out, $options ) }
- elsif ( $script eq "write_tab" ) { &script_write_tab( $in, $out, $options ) }
- elsif ( $script eq "write_bed" ) { &script_write_bed( $in, $out, $options ) }
- elsif ( $script eq "write_psl" ) { &script_write_psl( $in, $out, $options ) }
- elsif ( $script eq "write_2bit" ) { &script_write_2bit( $in, $out, $options, $options ) }
- elsif ( $script eq "write_solid" ) { &script_write_solid( $in, $out, $options, $options ) }
- elsif ( $script eq "head_records" ) { &script_head_records( $in, $out, $options ) }
- elsif ( $script eq "remove_keys" ) { &script_remove_keys( $in, $out, $options ) }
- elsif ( $script eq "rename_keys" ) { &script_rename_keys( $in, $out, $options ) }
- elsif ( $script eq "uniq_vals" ) { &script_uniq_vals( $in, $out, $options ) }
- elsif ( $script eq "merge_vals" ) { &script_merge_vals( $in, $out, $options ) }
- elsif ( $script eq "grab" ) { &script_grab( $in, $out, $options ) }
- elsif ( $script eq "compute" ) { &script_compute( $in, $out, $options ) }
- elsif ( $script eq "flip_tab" ) { &script_flip_tab( $in, $out, $options ) }
- elsif ( $script eq "add_ident" ) { &script_add_ident( $in, $out, $options ) }
- elsif ( $script eq "count_records" ) { &script_count_records( $in, $out, $options ) }
- elsif ( $script eq "random_records" ) { &script_random_records( $in, $out, $options ) }
- elsif ( $script eq "sort_records" ) { &script_sort_records( $in, $out, $options ) }
- elsif ( $script eq "count_vals" ) { &script_count_vals( $in, $out, $options ) }
- elsif ( $script eq "plot_histogram" ) { &script_plot_histogram( $in, $out, $options ) }
- elsif ( $script eq "plot_lendist" ) { &script_plot_lendist( $in, $out, $options ) }
- elsif ( $script eq "plot_chrdist" ) { &script_plot_chrdist( $in, $out, $options ) }
- elsif ( $script eq "plot_karyogram" ) { &script_plot_karyogram( $in, $out, $options ) }
- elsif ( $script eq "plot_matches" ) { &script_plot_matches( $in, $out, $options ) }
- elsif ( $script eq "plot_seqlogo" ) { &script_plot_seqlogo( $in, $out, $options ) }
- elsif ( $script eq "plot_phastcons_profiles" ) { &script_plot_phastcons_profiles( $in, $out, $options ) }
- elsif ( $script eq "analyze_bed" ) { &script_analyze_bed( $in, $out, $options ) }
- elsif ( $script eq "analyze_vals" ) { &script_analyze_vals( $in, $out, $options ) }
- elsif ( $script eq "length_vals" ) { &script_length_vals( $in, $out, $options ) }
- elsif ( $script eq "sum_vals" ) { &script_sum_vals( $in, $out, $options ) }
- elsif ( $script eq "mean_vals" ) { &script_mean_vals( $in, $out, $options ) }
- elsif ( $script eq "median_vals" ) { &script_median_vals( $in, $out, $options ) }
- elsif ( $script eq "max_vals" ) { &script_max_vals( $in, $out, $options ) }
- elsif ( $script eq "min_vals" ) { &script_min_vals( $in, $out, $options ) }
- elsif ( $script eq "upload_to_ucsc" ) { &script_upload_to_ucsc( $in, $out, $options ) }
+ script_list_biopieces( $ENV{ 'INST_DIR'} . "/biopieces/usage/" ) if $script eq "list_biopieces";
+
+ script_print_usage( $ENV{ 'INST_DIR'} . "/biopieces/usage/$script" ) if -t STDIN and not @ARGV;
+
+ $options = get_options( $script );
+
+ $in = read_stream( $options->{ "stream_in" } );
+ $out = write_stream( $options->{ "stream_out" } );
+
+ if ( $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 ) }
+ elsif ( $script eq "read_bed" ) { script_read_bed( $in, $out, $options ) }
+ elsif ( $script eq "read_blast_tab" ) { script_read_blast_tab( $in, $out, $options ) }
+ elsif ( $script eq "read_embl" ) { script_read_embl( $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_soft" ) { script_read_soft( $in, $out, $options ) }
+ elsif ( $script eq "read_gff" ) { script_read_gff( $in, $out, $options ) }
+ elsif ( $script eq "read_2bit" ) { script_read_2bit( $in, $out, $options ) }
+ elsif ( $script eq "read_solexa" ) { script_read_solexa( $in, $out, $options ) }
+ elsif ( $script eq "read_solid" ) { script_read_solid( $in, $out, $options ) }
+ elsif ( $script eq "read_mysql" ) { script_read_mysql( $in, $out, $options ) }
+ elsif ( $script eq "length_seq" ) { script_length_seq( $in, $out, $options ) }
+ elsif ( $script eq "uppercase_seq" ) { script_uppercase_seq( $in, $out, $options ) }
+ elsif ( $script eq "shuffle_seq" ) { script_shuffle_seq( $in, $out, $options ) }
+ elsif ( $script eq "analyze_seq" ) { script_analyze_seq( $in, $out, $options ) }
+ elsif ( $script eq "analyze_tags" ) { script_analyze_tags( $in, $out, $options ) }
+ elsif ( $script eq "complexity_seq" ) { script_complexity_seq( $in, $out, $options ) }
+ elsif ( $script eq "oligo_freq" ) { script_oligo_freq( $in, $out, $options ) }
+ elsif ( $script eq "create_weight_matrix" ) { script_create_weight_matrix( $in, $out, $options ) }
+ elsif ( $script eq "calc_bit_scores" ) { script_calc_bit_scores( $in, $out, $options ) }
+ elsif ( $script eq "reverse_seq" ) { script_reverse_seq( $in, $out, $options ) }
+ elsif ( $script eq "complement_seq" ) { script_complement_seq( $in, $out, $options ) }
+ elsif ( $script eq "remove_indels" ) { script_remove_indels( $in, $out, $options ) }
+ elsif ( $script eq "transliterate_seq" ) { script_transliterate_seq( $in, $out, $options ) }
+ elsif ( $script eq "transliterate_vals" ) { script_transliterate_vals( $in, $out, $options ) }
+ elsif ( $script eq "translate_seq" ) { script_translate_seq( $in, $out, $options ) }
+ elsif ( $script eq "extract_seq" ) { script_extract_seq( $in, $out, $options ) }
+ elsif ( $script eq "get_genome_seq" ) { script_get_genome_seq( $in, $out, $options ) }
+ elsif ( $script eq "get_genome_align" ) { script_get_genome_align( $in, $out, $options ) }
+ elsif ( $script eq "get_genome_phastcons" ) { script_get_genome_phastcons( $in, $out, $options ) }
+ elsif ( $script eq "fold_seq" ) { script_fold_seq( $in, $out, $options ) }
+ elsif ( $script eq "split_seq" ) { script_split_seq( $in, $out, $options ) }
+ elsif ( $script eq "split_bed" ) { script_split_bed( $in, $out, $options ) }
+ elsif ( $script eq "align_seq" ) { script_align_seq( $in, $out, $options ) }
+ elsif ( $script eq "tile_seq" ) { script_tile_seq( $in, $out, $options ) }
+ elsif ( $script eq "invert_align" ) { script_invert_align( $in, $out, $options ) }
+ elsif ( $script eq "patscan_seq" ) { script_patscan_seq( $in, $out, $options ) }
+ elsif ( $script eq "create_blast_db" ) { script_create_blast_db( $in, $out, $options ) }
+ elsif ( $script eq "blast_seq" ) { script_blast_seq( $in, $out, $options ) }
+ elsif ( $script eq "blat_seq" ) { script_blat_seq( $in, $out, $options ) }
+ elsif ( $script eq "match_seq" ) { script_match_seq( $in, $out, $options ) }
+ elsif ( $script eq "create_vmatch_index" ) { script_create_vmatch_index( $in, $out, $options ) }
+ elsif ( $script eq "vmatch_seq" ) { script_vmatch_seq( $in, $out, $options ) }
+ elsif ( $script eq "write_fasta" ) { script_write_fasta( $in, $out, $options, $options ) }
+ elsif ( $script eq "write_align" ) { script_write_align( $in, $out, $options ) }
+ elsif ( $script eq "write_blast" ) { script_write_blast( $in, $out, $options ) }
+ elsif ( $script eq "write_tab" ) { script_write_tab( $in, $out, $options ) }
+ elsif ( $script eq "write_bed" ) { script_write_bed( $in, $out, $options ) }
+ elsif ( $script eq "write_psl" ) { script_write_psl( $in, $out, $options ) }
+ elsif ( $script eq "write_2bit" ) { script_write_2bit( $in, $out, $options, $options ) }
+ elsif ( $script eq "write_solid" ) { script_write_solid( $in, $out, $options, $options ) }
+ elsif ( $script eq "head_records" ) { script_head_records( $in, $out, $options ) }
+ elsif ( $script eq "remove_keys" ) { script_remove_keys( $in, $out, $options ) }
+ elsif ( $script eq "rename_keys" ) { script_rename_keys( $in, $out, $options ) }
+ elsif ( $script eq "uniq_vals" ) { script_uniq_vals( $in, $out, $options ) }
+ elsif ( $script eq "merge_vals" ) { script_merge_vals( $in, $out, $options ) }
+ elsif ( $script eq "grab" ) { script_grab( $in, $out, $options ) }
+ elsif ( $script eq "compute" ) { script_compute( $in, $out, $options ) }
+ elsif ( $script eq "flip_tab" ) { script_flip_tab( $in, $out, $options ) }
+ elsif ( $script eq "add_ident" ) { script_add_ident( $in, $out, $options ) }
+ elsif ( $script eq "count_records" ) { script_count_records( $in, $out, $options ) }
+ elsif ( $script eq "random_records" ) { script_random_records( $in, $out, $options ) }
+ elsif ( $script eq "sort_records" ) { script_sort_records( $in, $out, $options ) }
+ elsif ( $script eq "count_vals" ) { script_count_vals( $in, $out, $options ) }
+ elsif ( $script eq "plot_histogram" ) { script_plot_histogram( $in, $out, $options ) }
+ elsif ( $script eq "plot_lendist" ) { script_plot_lendist( $in, $out, $options ) }
+ elsif ( $script eq "plot_chrdist" ) { script_plot_chrdist( $in, $out, $options ) }
+ elsif ( $script eq "plot_karyogram" ) { script_plot_karyogram( $in, $out, $options ) }
+ elsif ( $script eq "plot_matches" ) { script_plot_matches( $in, $out, $options ) }
+ elsif ( $script eq "plot_seqlogo" ) { script_plot_seqlogo( $in, $out, $options ) }
+ elsif ( $script eq "plot_phastcons_profiles" ) { script_plot_phastcons_profiles( $in, $out, $options ) }
+ elsif ( $script eq "analyze_bed" ) { script_analyze_bed( $in, $out, $options ) }
+ elsif ( $script eq "analyze_vals" ) { script_analyze_vals( $in, $out, $options ) }
+ elsif ( $script eq "length_vals" ) { script_length_vals( $in, $out, $options ) }
+ elsif ( $script eq "sum_vals" ) { script_sum_vals( $in, $out, $options ) }
+ elsif ( $script eq "mean_vals" ) { script_mean_vals( $in, $out, $options ) }
+ elsif ( $script eq "median_vals" ) { script_median_vals( $in, $out, $options ) }
+ elsif ( $script eq "max_vals" ) { script_max_vals( $in, $out, $options ) }
+ elsif ( $script eq "min_vals" ) { script_min_vals( $in, $out, $options ) }
+ elsif ( $script eq "upload_to_ucsc" ) { script_upload_to_ucsc( $in, $out, $options ) }
close $in if defined $in;
close $out;
num|n=s
);
}
- elsif ( $script eq "read_align" )
- {
- @options = qw(
- data_in|i=s
- num|n=s
- );
- }
elsif ( $script eq "read_tab" )
{
@options = qw(
password|p=s
);
}
- elsif ( $script eq "count_seq" )
- {
- @options = qw(
- no_stream|x
- data_out|o=s
- );
- }
elsif ( $script eq "length_seq" )
{
@options = qw(
if ( $options{ 'data_in' } )
{
- $options{ "files" } = &getopt_files( $options{ 'data_in' } );
+ $options{ "files" } = getopt_files( $options{ 'data_in' } );
- &Maasha::Common::error( qq(Argument to --data_in must be a valid file or fileglob expression) ) if scalar @{ $options{ "files" } } == 0;
+ Maasha::Common::error( qq(Argument to --data_in must be a valid file or fileglob expression) ) if scalar @{ $options{ "files" } } == 0;
}
- map { &Maasha::Common::error( qq(Argument to --cols must be a whole numbers - not "$_") ) if $_ !~ /^\d+$/ } @{ $options{ "cols" } } if $options{ "cols" };
+ map { Maasha::Common::error( qq(Argument to --cols must be a whole numbers - not "$_") ) if $_ !~ /^\d+$/ } @{ $options{ "cols" } } if $options{ "cols" };
# print STDERR Dumper( \%options );
{
if ( $opt =~ /stream_in|pattern_in|exact_in/ and not -f $options{ $opt } )
{
- &Maasha::Common::error( qq(Argument to --$opt must be a valid file or fileglob expression - not "$options{ $opt }") );
+ Maasha::Common::error( qq(Argument to --$opt must be a valid file or fileglob expression - not "$options{ $opt }") );
}
elsif ( $opt =~ /beg|end|word_size|wrap|chunk_size|tile_size|len|prefix_length|num|skip|cpus|window_size|step_size/ and $options{ $opt } !~ /^\d+$/ )
{
- &Maasha::Common::error( qq(Argument to --$opt must be a whole number - not "$options{ $opt }") );
+ Maasha::Common::error( qq(Argument to --$opt must be a whole number - not "$options{ $opt }") );
}
elsif ( $opt =~ /max_hits|max_hits|max_misses|dist|edit_dist|flank|gap|hamming_dist|priority/ and $options{ $opt } !~ /^-?\d+$/ )
{
- &Maasha::Common::error( qq(Argument to --$opt must be an integer - not "$options{ $opt }") );
+ Maasha::Common::error( qq(Argument to --$opt must be an integer - not "$options{ $opt }") );
}
elsif ( $opt =~ /identity|threshold/ and $options{ $opt } !~ /^-?(?:\d+(?:\.\d*)?|\.\d+)$/ )
{
- &Maasha::Common::error( qq(Argument to --$opt must be a decimal number - not "$options{ $opt }") );
+ Maasha::Common::error( qq(Argument to --$opt must be a decimal number - not "$options{ $opt }") );
}
elsif ( $opt =~ /e_val/ and $options{ $opt } !~ /^([+-]?)(?=\d|\.\d)\d*(\.\d*)?([Ee]([+-]?\d+))?$/ )
{
- &Maasha::Common::error( qq(Argument to --$opt must be a float - not "$options{ $opt }") );
+ Maasha::Common::error( qq(Argument to --$opt must be a float - not "$options{ $opt }") );
}
elsif ( $opt =~ /strand/ and $options{ $opt } !~ /^(\+|-)$/ )
{
- &Maasha::Common::error( qq(Argument to --$opt must be "+" or "-" - not "$options{ $opt }") );
+ Maasha::Common::error( qq(Argument to --$opt must be "+" or "-" - not "$options{ $opt }") );
}
elsif ( $opt eq "genome" )
{
- @genomes = &Maasha::Config::genomes();
+ @genomes = Maasha::Config::genomes();
if ( not grep $options{ $opt }, @genomes ) {
- &Maasha::Common::error( qq(Genome $options{ $opt } not found in "$ENV{ 'INST_DIR' }/conf/genomes.conf") );
+ Maasha::Common::error( qq(Genome $options{ $opt } not found in "$ENV{ 'INST_DIR' }/conf/genomes.conf") );
}
}
elsif ( $opt eq "terminal" and not $options{ $opt } =~ /^(svg|post|dumb)/ )
{
- &Maasha::Common::error( qq(Bad --$opt argument "$options{ $opt }") );
+ Maasha::Common::error( qq(Bad --$opt argument "$options{ $opt }") );
}
elsif ( $opt eq "table" and $options{ $opt } =~ /-\./ )
{
- &Maasha::Common::error( qq(Character '$options{ $opt }' is not allowed in table names) );
+ Maasha::Common::error( qq(Character '$options{ $opt }' is not allowed in table names) );
}
}
- &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 eq "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" };
- &Maasha::Common::error( qq(both --database and --genome specified) ) if $script eq "blast_seq" and $options{ "genome" } and $options{ "database" };
- &Maasha::Common::error( qq(no --index_name or --genome specified) ) if $script eq "vmatch_seq" and not $options{ "genome" } and not $options{ "index_name" };
- &Maasha::Common::error( qq(both --index and --genome specified) ) if $script eq "vmatch_seq" and $options{ "genome" } and $options{ "index" };
- &Maasha::Common::error( qq(no --genome specified) ) if $script =~ /get_genome_seq|get_genome_align|get_genome_phastcons|blat_seq|plot_phastcons_profiles|plot_karyogram/ and not $options{ "genome" };
- &Maasha::Common::error( qq(no --key specified) ) if $script =~ /plot_lendist|plot_histogram/ and not $options{ "key" };
- &Maasha::Common::error( qq(no --keys speficied) ) if $script =~ /sort_records|count_vals|sum_vals|mean_vals|median_vals|length_vals/ and not $options{ "keys" };
+ 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 eq "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" };
+ Maasha::Common::error( qq(both --database and --genome specified) ) if $script eq "blast_seq" and $options{ "genome" } and $options{ "database" };
+ Maasha::Common::error( qq(no --index_name or --genome specified) ) if $script eq "vmatch_seq" and not $options{ "genome" } and not $options{ "index_name" };
+ Maasha::Common::error( qq(both --index and --genome specified) ) if $script eq "vmatch_seq" and $options{ "genome" } and $options{ "index" };
+ Maasha::Common::error( qq(no --genome specified) ) if $script =~ /get_genome_seq|get_genome_align|get_genome_phastcons|blat_seq|plot_phastcons_profiles|plot_karyogram/ and not $options{ "genome" };
+ Maasha::Common::error( qq(no --key specified) ) if $script =~ /plot_lendist|plot_histogram/ and not $options{ "key" };
+ Maasha::Common::error( qq(no --keys speficied) ) if $script =~ /sort_records|count_vals|sum_vals|mean_vals|median_vals|length_vals/ and not $options{ "keys" };
if ( $script eq "upload_to_ucsc" )
{
- &Maasha::Common::error( qq(no --database specified) ) if not $options{ "database" };
- &Maasha::Common::error( qq(no --table specified) ) if not $options{ "table" };
+ Maasha::Common::error( qq(no --database specified) ) if not $options{ "database" };
+ Maasha::Common::error( qq(no --table specified) ) if not $options{ "table" };
}
return wantarray ? %options : \%options;
$script = ( split "/", $path )[ -1 ];
- $fh = &Maasha::Common::read_open( $path );
+ $fh = Maasha::Common::read_open( $path );
push @list, "Program name";
{
if ( scalar @{ $hash{ $key } } == 1 )
{
- @lines = &Maasha::Common::wrap_line( $hash{ $key }->[ 0 ], 80 );
+ @lines = Maasha::Common::wrap_line( $hash{ $key }->[ 0 ], 80 );
printf( "%-15s%s\n", "$key:", shift @lines );
my ( @files, $file, $fh, $line, @lines, $program );
- @files = &Maasha::Common::ls_files( $path );
+ @files = Maasha::Common::ls_files( $path );
foreach $file ( sort @files )
{
$program = ( split "/", $file )[ -1 ];
- $fh = &Maasha::Common::read_open( $file );
+ $fh = Maasha::Common::read_open( $file );
while ( $line = <$fh> )
{
if ( $line =~ /^Description:\s+(.+)/ )
{
- @lines = &Maasha::Common::wrap_line( $1, 60 );
+ @lines = Maasha::Common::wrap_line( $1, 60 );
printf( "%-30s%s\n", $program, shift @lines );
my ( $record, $file, $data_in, $entry, $num );
- while ( $record = &get_record( $in ) ) {
- &put_record( $record, $out );
+ while ( $record = get_record( $in ) ) {
+ put_record( $record, $out );
}
$num = 1;
foreach $file ( @{ $options->{ "files" } } )
{
- $data_in = &Maasha::Common::read_open( $file );
+ $data_in = Maasha::Common::read_open( $file );
- while ( $entry = &Maasha::Fasta::get_entry( $data_in ) )
+ while ( $entry = Maasha::Fasta::get_entry( $data_in ) )
{
if ( defined $entry->[ SEQ_NAME ] and $entry->[ SEQ ] )
{
SEQ_LEN => length $entry->[ SEQ ],
};
- &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_align
-{
- # Martin A. Hansen, August 2007.
-
- # Read aligned sequences from FASTA file.
-
- my ( $in, # handle to in stream
- $out, # handle to out stream
- $options, # options hash
- ) = @_;
-
- # Returns nothing.
-
- my ( $entry, $record, $file, $data_in, $num );
-
- while ( $record = &get_record( $in ) ) {
- &put_record( $record, $out );
- }
-
- $num = 1;
-
- foreach $file ( @{ $options->{ "files" } } )
- {
- $data_in = &Maasha::Common::read_open( $file );
-
- while ( $entry = &Maasha::Fasta::get_entry( $data_in ) )
- {
- if ( $entry->[ SEQ_NAME ] and $entry->[ SEQ ] )
- {
- $record = {
- ALIGN => 1,
- SEQ_NAME => $entry->[ SEQ_NAME ],
- SEQ => $entry->[ SEQ ],
- ALIGN_LEN => length $entry->[ SEQ ],
- };
-
- &put_record( $record, $out );
+ put_record( $record, $out );
}
goto NUM if $options->{ "num" } and $num == $options->{ "num" };
$options->{ 'delimit' } ||= '\s+';
- while ( $record = &get_record( $in ) ) {
- &put_record( $record, $out );
+ while ( $record = get_record( $in ) ) {
+ put_record( $record, $out );
}
$skip = $options->{ 'skip' } ||= 0;
foreach $file ( @{ $options->{ "files" } } )
{
- $data_in = &Maasha::Common::read_open( $file );
+ $data_in = Maasha::Common::read_open( $file );
while ( $line = <$data_in> )
{
}
}
- &put_record( $record, $out );
+ put_record( $record, $out );
goto NUM if $options->{ "num" } and $num == $options->{ "num" };
my ( $record, @files, $file, $entries, $entry, $num );
- while ( $record = &get_record( $in ) ) {
- &put_record( $record, $out );
+ while ( $record = get_record( $in ) ) {
+ put_record( $record, $out );
}
$num = 1;
foreach $file ( @{ $options->{ "files" } } )
{
- $entries = &Maasha::UCSC::psl_get_entries( $file );
+ $entries = Maasha::UCSC::psl_get_entries( $file );
foreach $entry ( @{ $entries } )
{
- &put_record( $entry, $out );
+ put_record( $entry, $out );
goto NUM if $options->{ "num" } and $num == $options->{ "num" };
my ( $file, $record, $entry, $data_in, $num );
- while ( $record = &get_record( $in ) ) {
- &put_record( $record, $out );
+ while ( $record = get_record( $in ) ) {
+ put_record( $record, $out );
}
$num = 1;
foreach $file ( @{ $options->{ "files" } } )
{
- $data_in = &Maasha::Common::read_open( $file );
+ $data_in = Maasha::Common::read_open( $file );
- while ( $entry = &Maasha::UCSC::bed_get_entry( $data_in ) )
+ while ( $entry = Maasha::UCSC::bed_get_entry( $data_in ) )
{
- &put_record( $entry, $out );
+ put_record( $entry, $out );
goto NUM if $options->{ "num" } and $num == $options->{ "num" };
my ( $file, $line, @fields, $strand, $record, $data_in, $num );
- while ( $record = &get_record( $in ) ) {
- &put_record( $record, $out );
+ while ( $record = get_record( $in ) ) {
+ put_record( $record, $out );
}
$num = 1;
foreach $file ( @{ $options->{ "files" } } )
{
- $data_in = &Maasha::Common::read_open( $file );
+ $data_in = Maasha::Common::read_open( $file );
while ( $line = <$data_in> )
{
$record->{ "STRAND" } = '+';
}
- &put_record( $record, $out );
+ put_record( $record, $out );
goto NUM if $options->{ "num" } and $num == $options->{ "num" };
map { $options2{ "feats" }{ $_ } = 1 } @{ $options->{ "feats" } };
map { $options2{ "quals" }{ $_ } = 1 } @{ $options->{ "quals" } };
- while ( $record = &get_record( $in ) ) {
- &put_record( $record, $out );
+ while ( $record = get_record( $in ) ) {
+ put_record( $record, $out );
}
$num = 1;
foreach $file ( @{ $options->{ "files" } } )
{
- $data_in = &Maasha::Common::read_open( $file );
+ $data_in = Maasha::Common::read_open( $file );
- while ( $entry = &Maasha::EMBL::get_embl_entry( $data_in ) )
+ while ( $entry = Maasha::EMBL::get_embl_entry( $data_in ) )
{
- $record = &Maasha::EMBL::parse_embl_entry( $entry, \%options2 );
+ $record = Maasha::EMBL::parse_embl_entry( $entry, \%options2 );
my ( $feat, $feat2, $qual, $qual_val, $record_copy );
delete $record_copy->{ "FT" };
- &put_record( $record_copy, $out );
+ put_record( $record_copy, $out );
delete $record_copy->{ "SEQ" };
$record_copy->{ $qual } = $qual_val;
}
- &put_record( $record_copy, $out );
+ put_record( $record_copy, $out );
}
}
my ( $data_in, $file, $num, $entry, $record, $record_anno, $record_align, $key, $seq );
- while ( $record = &get_record( $in ) ) {
- &put_record( $record, $out );
+ while ( $record = get_record( $in ) ) {
+ put_record( $record, $out );
}
$num = 1;
foreach $file ( @{ $options->{ "files" } } )
{
- $data_in = &Maasha::Common::read_open( $file );
+ $data_in = Maasha::Common::read_open( $file );
- while ( $entry = &Maasha::Stockholm::get_stockholm_entry( $data_in ) )
+ while ( $entry = Maasha::Stockholm::get_stockholm_entry( $data_in ) )
{
- $record = &Maasha::Stockholm::parse_stockholm_entry( $entry );
+ $record = Maasha::Stockholm::parse_stockholm_entry( $entry );
undef $record_anno;
$record_anno->{ "ALIGN" } = $num;
- &put_record( $record_anno, $out );
+ put_record( $record_anno, $out );
foreach $seq ( @{ $record->{ "ALIGN" } } )
{
undef $record_align;
$record_align = {
- ALIGN => $num,
SEQ_NAME => $seq->[ 0 ],
SEQ => $seq->[ 1 ],
};
- &put_record( $record_align, $out );
+ put_record( $record_align, $out );
}
goto NUM if $options->{ "num" } and $num == $options->{ "num" };
$options->{ "threshold" } ||= 0.8;
$options->{ "gap" } ||= 5;
- while ( $record = &get_record( $in ) ) {
- &put_record( $record, $out );
+ while ( $record = get_record( $in ) ) {
+ put_record( $record, $out );
}
$num = 1;
foreach $file ( @{ $options->{ "files" } } )
{
- $data_in = &Maasha::Common::read_open( $file );
+ $data_in = Maasha::Common::read_open( $file );
- while ( $entry = &Maasha::UCSC::phastcons_get_entry( $data_in ) )
+ while ( $entry = Maasha::UCSC::phastcons_get_entry( $data_in ) )
{
- @records = &Maasha::UCSC::phastcons_parse_entry( $entry, $options );
+ @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;
- &put_record( $record, $out );
+ put_record( $record, $out );
goto NUM if $options->{ "num" } and $num == $options->{ "num" };
my ( $data_in, $file, $num, $records, $record, $soft_index, $fh, @platforms, $plat_table, @samples, $sample, $old_end );
- while ( $record = &get_record( $in ) ) {
- &put_record( $record, $out );
+ while ( $record = get_record( $in ) ) {
+ put_record( $record, $out );
}
$num = 1;
foreach $file ( @{ $options->{ "files" } } )
{
- $soft_index = &Maasha::NCBI::soft_index_file( $file );
+ $soft_index = Maasha::NCBI::soft_index_file( $file );
- $fh = &Maasha::Common::read_open( $file );
+ $fh = Maasha::Common::read_open( $file );
@platforms = grep { $_->[ 0 ] =~ /PLATFORM/ } @{ $soft_index };
- $plat_table = &Maasha::NCBI::soft_get_platform( $fh, $platforms[ 0 ]->[ 1 ], $platforms[ -1 ]->[ 2 ] );
+ $plat_table = Maasha::NCBI::soft_get_platform( $fh, $platforms[ 0 ]->[ 1 ], $platforms[ -1 ]->[ 2 ] );
@samples = grep { $_->[ 0 ] =~ /SAMPLE/ } @{ $soft_index };
foreach $sample ( @samples )
{
- $records = &Maasha::NCBI::soft_get_sample( $fh, $plat_table, $sample->[ 1 ] - $old_end - 1, $sample->[ 2 ] - $old_end - 1 );
+ $records = Maasha::NCBI::soft_get_sample( $fh, $plat_table, $sample->[ 1 ] - $old_end - 1, $sample->[ 2 ] - $old_end - 1 );
foreach $record ( @{ $records } )
{
- &put_record( $record, $out );
+ put_record( $record, $out );
goto NUM if $options->{ "num" } and $num == $options->{ "num" };
my ( $data_in, $file, $fh, $num, $record, $entry );
- while ( $record = &get_record( $in ) ) {
- &put_record( $record, $out );
+ while ( $record = get_record( $in ) ) {
+ put_record( $record, $out );
}
$num = 1;
foreach $file ( @{ $options->{ "files" } } )
{
- $fh = &Maasha::Common::read_open( $file );
+ $fh = Maasha::Common::read_open( $file );
- while ( $entry = &Maasha::GFF::get_entry( $fh ) )
+ while ( $entry = Maasha::GFF::get_entry( $fh ) )
{
- &put_record( $entry, $out );
+ put_record( $entry, $out );
goto NUM if $options->{ "num" } and $num == $options->{ "num" };
$mask = 1 if not $options->{ "no_mask" };
- while ( $record = &get_record( $in ) ) {
- &put_record( $record, $out );
+ while ( $record = get_record( $in ) ) {
+ put_record( $record, $out );
}
$num = 1;
foreach $file ( @{ $options->{ "files" } } )
{
- $data_in = &Maasha::Common::read_open( $file );
+ $data_in = Maasha::Common::read_open( $file );
- $toc = &Maasha::TwoBit::twobit_get_TOC( $data_in );
+ $toc = Maasha::TwoBit::twobit_get_TOC( $data_in );
foreach $line ( @{ $toc } )
{
$record->{ "SEQ_NAME" } = $line->[ 0 ];
- $record->{ "SEQ" } = &Maasha::TwoBit::twobit_get_seq( $data_in, $line->[ 1 ], undef, undef, $mask );
+ $record->{ "SEQ" } = Maasha::TwoBit::twobit_get_seq( $data_in, $line->[ 1 ], undef, undef, $mask );
$record->{ "SEQ_LEN" } = length $record->{ "SEQ" };
- &put_record( $record, $out );
+ put_record( $record, $out );
goto NUM if $options->{ "num" } and $num == $options->{ "num" };
$options->{ "quality" } ||= 20;
- while ( $record = &get_record( $in ) ) {
- &put_record( $record, $out );
+ while ( $record = get_record( $in ) ) {
+ put_record( $record, $out );
}
$num = 1;
foreach $file ( @{ $options->{ "files" } } )
{
- $data_in = &Maasha::Common::read_open( $file );
- $base_name = &Maasha::Common::get_basename( $file );
+ $data_in = Maasha::Common::read_open( $file );
+ $base_name = Maasha::Common::get_basename( $file );
$base_name =~ s/\..*//;
$seq_count = 0;
$record->{ "SEQ_NAME" } = sprintf( "%s_ID%08d", $base_name, $seq_count );
$record->{ "SEQ" } = $seq;
$record->{ "SEQ_LEN" } = length $seq;
- $record->{ "SCORE_MEAN" } = sprintf ( "%.2f", &Maasha::Calc::mean( \@scores ) );
+ $record->{ "SCORE_MEAN" } = sprintf ( "%.2f", Maasha::Calc::mean( \@scores ) );
- &put_record( $record, $out );
+ put_record( $record, $out );
goto NUM if $options->{ "num" } and $num == $options->{ "num" };
$options->{ "quality" } ||= 15;
- while ( $record = &get_record( $in ) ) {
- &put_record( $record, $out );
+ while ( $record = get_record( $in ) ) {
+ put_record( $record, $out );
}
$num = 1;
foreach $file ( @{ $options->{ "files" } } )
{
- $data_in = &Maasha::Common::read_open( $file );
+ $data_in = Maasha::Common::read_open( $file );
while ( $line = <$data_in> )
{
( $seq_name, $seq_cs, $seq_qual ) = split /\t/, $line;
@scores = split /,/, $seq_qual;
- @seqs = split //, &Maasha::Solid::color_space2seq( $seq_cs );
+ @seqs = split //, Maasha::Solid::color_space2seq( $seq_cs );
for ( $i = 0; $i < @seqs; $i++ ) {
$seqs[ $i ] = lc $seqs[ $i ] if $scores[ $i ] < $options->{ "quality" };
SEQ_QUAL => $seq_qual,
SEQ_LEN => length $seq_cs,
SEQ => join( "", @seqs ),
- SCORE_MEAN => sprintf( "%.2f", &Maasha::Calc::mean( \@scores ) ),
+ SCORE_MEAN => sprintf( "%.2f", Maasha::Calc::mean( \@scores ) ),
};
- &put_record( $record, $out );
+ put_record( $record, $out );
goto NUM if $options->{ "num" } and $num == $options->{ "num" };
my ( $record, $dbh, $results );
- $options->{ "user" } ||= &Maasha::UCSC::ucsc_get_user();
- $options->{ "password" } ||= &Maasha::UCSC::ucsc_get_password();
+ $options->{ "user" } ||= Maasha::UCSC::ucsc_get_user();
+ $options->{ "password" } ||= Maasha::UCSC::ucsc_get_password();
- while ( $record = &get_record( $in ) ) {
- &put_record( $record, $out );
+ while ( $record = get_record( $in ) ) {
+ put_record( $record, $out );
}
- $dbh = &Maasha::SQL::connect( $options->{ "database" }, $options->{ "user" }, $options->{ "password" } );
+ $dbh = Maasha::SQL::connect( $options->{ "database" }, $options->{ "user" }, $options->{ "password" } );
- $results = &Maasha::SQL::query_hashref_list( $dbh, $options->{ "query" } );
+ $results = Maasha::SQL::query_hashref_list( $dbh, $options->{ "query" } );
- &Maasha::SQL::disconnect( $dbh );
+ Maasha::SQL::disconnect( $dbh );
- map { &put_record( $_ ) } @{ $results };
-}
-
-
-sub script_count_seq
-{
- # Martin A. Hansen, August 2007.
-
- # Count sequences in stream.
-
- my ( $in, # handle to in stream
- $out, # handle to out stream
- $options, # options hash
- ) = @_;
-
- # Returns nothing.
-
- my ( $record, $count, $result, $fh );
-
- $count = 0;
-
- while ( $record = &get_record( $in ) )
- {
- $count++ if $record->{ "SEQ" };
-
- &put_record( $record, $out ) if not $options->{ "no_stream" };
- }
-
- $result = { "count_seq" => $count };
-
- $fh = &write_stream( $options->{ "data_out" } );
-
- &put_record( $result, $fh );
-
- close $fh;
+ map { put_record( $_ ) } @{ $results };
}
my ( $record, $total );
- while ( $record = &get_record( $in ) )
+ while ( $record = get_record( $in ) )
{
if ( $record->{ "SEQ" } )
{
$total += $record->{ "SEQ_LEN" };
}
- &put_record( $record, $out ) if not $options->{ "no_stream" };
+ put_record( $record, $out ) if not $options->{ "no_stream" };
}
- &put_record( { TOTAL_SEQ_LEN => $total }, $out );
+ put_record( { TOTAL_SEQ_LEN => $total }, $out );
}
my ( $record );
- while ( $record = &get_record( $in ) )
+ while ( $record = get_record( $in ) )
{
$record->{ "SEQ" } = uc $record->{ "SEQ" } if $record->{ "SEQ" };
- &put_record( $record, $out );
+ put_record( $record, $out );
}
}
my ( $record );
- while ( $record = &get_record( $in ) )
+ while ( $record = get_record( $in ) )
{
- $record->{ "SEQ" } = &Maasha::Seq::seq_shuffle( $record->{ "SEQ" } ) if $record->{ "SEQ" };
+ $record->{ "SEQ" } = Maasha::Seq::seq_shuffle( $record->{ "SEQ" } ) if $record->{ "SEQ" };
- &put_record( $record, $out );
+ put_record( $record, $out );
}
}
my ( $record, $analysis );
- while ( $record = &get_record( $in ) )
+ while ( $record = get_record( $in ) )
{
if ( $record->{ "SEQ" } )
{
- $analysis = &Maasha::Seq::seq_analyze( $record->{ "SEQ" } );
+ $analysis = Maasha::Seq::seq_analyze( $record->{ "SEQ" } );
map { $record->{ $_ } = $analysis->{ $_ } } keys %{ $analysis };
}
- &put_record( $record, $out );
+ put_record( $record, $out );
}
}
my ( $record, $analysis, %len_hash, %clone_hash, $clones, $key, $tag_record );
- while ( $record = &get_record( $in ) )
+ while ( $record = get_record( $in ) )
{
if ( $record->{ "SEQ_NAME" } and $record->{ "SEQ" } )
{
$tag_record->{ "TAG_COUNT" } = $len_hash{ $key };
$tag_record->{ "TAG_CLONES" } = $clone_hash{ $key };
- &put_record( $tag_record, $out );
+ put_record( $tag_record, $out );
}
}
my ( $record, $index );
- while ( $record = &get_record( $in ) )
+ while ( $record = get_record( $in ) )
{
- $record->{ "SEQ_COMPLEXITY" } = sprintf( "%.2f", &Maasha::Seq::seq_complexity( $record->{ "SEQ" } ) ) if $record->{ "SEQ" };
+ $record->{ "SEQ_COMPLEXITY" } = sprintf( "%.2f", Maasha::Seq::seq_complexity( $record->{ "SEQ" } ) ) if $record->{ "SEQ" };
- &put_record( $record, $out );
+ put_record( $record, $out );
}
}
$options->{ "word_size" } ||= 7;
- while ( $record = &get_record( $in ) )
+ while ( $record = get_record( $in ) )
{
if ( $record->{ "SEQ" } )
{
- map { $oligos{ $_ }++ } &Maasha::Seq::seq2oligos( \$record->{ "SEQ" }, $options->{ "word_size" } );
+ map { $oligos{ $_ }++ } Maasha::Seq::seq2oligos( \$record->{ "SEQ" }, $options->{ "word_size" } );
if ( not $options->{ "all" } )
{
- @freq_table = &Maasha::Seq::oligo_freq( \%oligos );
+ @freq_table = Maasha::Seq::oligo_freq( \%oligos );
- map { &put_record( $_, $out ) } @freq_table;
+ map { put_record( $_, $out ) } @freq_table;
undef %oligos;
}
}
- &put_record( $record, $out );
+ put_record( $record, $out );
}
if ( $options->{ "all" } )
{
- @freq_table = &Maasha::Seq::oligo_freq( \%oligos );
+ @freq_table = Maasha::Seq::oligo_freq( \%oligos );
- map { &put_record( $_, $out ) } @freq_table;
+ map { put_record( $_, $out ) } @freq_table;
}
}
$count = 0;
- while ( $record = &get_record( $in ) )
+ while ( $record = get_record( $in ) )
{
if ( $record->{ "SEQ" } )
{
}
else
{
- &put_record( $record, $out );
+ put_record( $record, $out );
}
}
$record->{ "V" . ( $i + 1 ) } = $freq;
}
- &put_record( $record, $out );
+ put_record( $record, $out );
}
}
$count = 0;
- while ( $record = &get_record( $in ) )
+ while ( $record = get_record( $in ) )
{
if ( $record->{ "SEQ" } )
{
- $type = &Maasha::Seq::seq_guess_type( $record->{ "SEQ" } ) if not $type;
+ $type = Maasha::Seq::seq_guess_type( $record->{ "SEQ" } ) if not $type;
for ( $i = 0; $i < length $record->{ "SEQ" }; $i++ )
{
}
else
{
- &put_record( $record, $out );
+ put_record( $record, $out );
}
}
for ( $i = 0; $i < keys %freq_hash; $i++ )
{
- $bit_height = &Maasha::Seq::seqlogo_calc_bit_height( $freq_hash{ $i }, $count );
+ $bit_height = Maasha::Seq::seqlogo_calc_bit_height( $freq_hash{ $i }, $count );
$bit_diff = $bit_max - $bit_height;
$record->{ "V" . ( $i ) } = sprintf( "%.2f", $bit_diff );
}
- &put_record( $record, $out );
+ put_record( $record, $out );
}
my ( $record );
- while ( $record = &get_record( $in ) )
+ while ( $record = get_record( $in ) )
{
if ( $record->{ "SEQ" } ) {
$record->{ "SEQ" } = reverse $record->{ "SEQ" };
}
- &put_record( $record, $out );
+ put_record( $record, $out );
}
}
my ( $record, $type );
- while ( $record = &get_record( $in ) )
+ while ( $record = get_record( $in ) )
{
if ( $record->{ "SEQ" } )
{
if ( not $type ) {
- $type = &Maasha::Seq::seq_guess_type( $record->{ "SEQ" } );
+ $type = Maasha::Seq::seq_guess_type( $record->{ "SEQ" } );
}
if ( $type eq "rna" ) {
- &Maasha::Seq::rna_comp( \$record->{ "SEQ" } );
+ Maasha::Seq::rna_comp( \$record->{ "SEQ" } );
} elsif ( $type eq "dna" ) {
- &Maasha::Seq::dna_comp( \$record->{ "SEQ" } );
+ Maasha::Seq::dna_comp( \$record->{ "SEQ" } );
}
}
- &put_record( $record, $out );
+ put_record( $record, $out );
}
}
my ( $record );
- while ( $record = &get_record( $in ) )
+ while ( $record = get_record( $in ) )
{
$record->{ 'SEQ' } =~ tr/-~.//d if $record->{ "SEQ" };
- &put_record( $record, $out );
+ put_record( $record, $out );
}
}
$replace = $options->{ "replace" } || "";
$delete = $options->{ "delete" } || "";
- while ( $record = &get_record( $in ) )
+ while ( $record = get_record( $in ) )
{
if ( $record->{ "SEQ" } )
{
}
}
- &put_record( $record, $out );
+ put_record( $record, $out );
}
}
$replace = $options->{ "replace" } || "";
$delete = $options->{ "delete" } || "";
- while ( $record = &get_record( $in ) )
+ while ( $record = get_record( $in ) )
{
foreach $key ( @{ $options->{ "keys" } } )
{
}
}
- &put_record( $record, $out );
+ put_record( $record, $out );
}
}
$options->{ "frames" } ||= [ 1, 2, 3, -1, -2, -3 ];
- while ( $record = &get_record( $in ) )
+ while ( $record = get_record( $in ) )
{
if ( $record->{ "SEQ" } )
{
- if ( &Maasha::Seq::seq_guess_type( $record->{ "SEQ" } ) eq "dna" )
+ if ( Maasha::Seq::seq_guess_type( $record->{ "SEQ" } ) eq "dna" )
{
foreach $frame ( @{ $options->{ "frames" } } )
{
%new_record = %{ $record };
- $new_record{ "SEQ" } = &Maasha::Seq::translate( $record->{ "SEQ" }, $frame );
+ $new_record{ "SEQ" } = Maasha::Seq::translate( $record->{ "SEQ" }, $frame );
$new_record{ "SEQ_LEN" } = length $record->{ "SEQ" };
$new_record{ "FRAME" } = $frame;
- &put_record( \%new_record, $out );
+ put_record( \%new_record, $out );
}
}
}
else
{
- &put_record( $record, $out );
+ put_record( $record, $out );
}
}
}
# print "beg->$beg, end->$end, len->$len\n";
- while ( $record = &get_record( $in ) )
+ while ( $record = get_record( $in ) )
{
if ( $record->{ "SEQ" } )
{
}
}
- &put_record( $record, $out );
+ put_record( $record, $out );
}
}
if ( $options->{ "genome" } )
{
- $genome_file = &Maasha::Config::genome_fasta( $options->{ 'genome' } );
- $index_file = &Maasha::Config::genome_fasta_index( $options->{ 'genome' } );
+ $genome_file = Maasha::Config::genome_fasta( $options->{ 'genome' } );
+ $index_file = Maasha::Config::genome_fasta_index( $options->{ 'genome' } );
- $fh = &Maasha::Common::read_open( $genome_file );
- $index = &Maasha::Fasta::index_retrieve( $index_file );
+ $fh = Maasha::Common::read_open( $genome_file );
+ $index = Maasha::Fasta::index_retrieve( $index_file );
shift @{ $index }; # Get rid of the file size info
$record->{ "CHR_BEG" } = $beg - $index_beg;
$record->{ "CHR_END" } = $record->{ "CHR_BEG" } + $len - 1;
- $record->{ "SEQ" } = &Maasha::Common::file_read( $fh, $beg, $len );
+ $record->{ "SEQ" } = Maasha::Common::file_read( $fh, $beg, $len );
$record->{ "SEQ_LEN" } = $len;
- &put_record( $record, $out );
+ put_record( $record, $out );
}
}
- while ( $record = &get_record( $in ) )
+ while ( $record = get_record( $in ) )
{
if ( $options->{ "genome" } and not $record->{ "SEQ" } )
{
$record->{ "CHR_BEG" } = $beg - $index_beg;
$record->{ "CHR_END" } = $record->{ "CHR_BEG" } + $len - 1;
- $record->{ "SEQ" } = &Maasha::Common::file_read( $fh, $beg, $len );
+ $record->{ "SEQ" } = Maasha::Common::file_read( $fh, $beg, $len );
if ( $record->{ "STRAND" } and $record->{ "STRAND" } eq "-" )
{
- &Maasha::Seq::dna_comp( \$record->{ "SEQ" } );
+ Maasha::Seq::dna_comp( \$record->{ "SEQ" } );
$record->{ "SEQ" } = reverse $record->{ "SEQ" };
}
}
}
- &put_record( $record, $out );
+ put_record( $record, $out );
}
close $fh if $fh;
$align_num = 1;
- $maf_track = &Maasha::Config::maf_track( $options->{ "genome" } );
+ $maf_track = Maasha::Config::maf_track( $options->{ "genome" } );
if ( $options->{ "chr" } and $options->{ "beg" } and ( $options->{ "end" } or $options->{ "len" } ) )
{
$end = $beg + $options->{ "len" };
}
- $align = &Maasha::UCSC::maf_extract( $BP_TMP, $options->{ "genome" }, $maf_track, $options->{ "chr" }, $beg, $end, $options->{ "strand" } );
+ $align = Maasha::UCSC::maf_extract( $BP_TMP, $options->{ "genome" }, $maf_track, $options->{ "chr" }, $beg, $end, $options->{ "strand" } );
foreach $entry ( @{ $align } )
{
- $entry->{ "ALIGN" } = $align_num;
$entry->{ "CHR" } = $record->{ "CHR" };
$entry->{ "CHR_BEG" } = $record->{ "CHR_BEG" };
$entry->{ "CHR_END" } = $record->{ "CHR_END" };
$entry->{ "Q_ID" } = $record->{ "Q_ID" };
$entry->{ "SCORE" } = $record->{ "SCORE" };
- &put_record( $entry, $out );
+ put_record( $entry, $out );
}
}
- while ( $record = &get_record( $in ) )
+ while ( $record = get_record( $in ) )
{
if ( $record->{ "REC_TYPE" } eq "BED" )
{
- $align = &Maasha::UCSC::maf_extract( $BP_TMP, $options->{ "genome" }, $maf_track, $record->{ "CHR" }, $record->{ "CHR_BEG" }, $record->{ "CHR_END" }, $record->{ "STRAND" } );
+ $align = Maasha::UCSC::maf_extract( $BP_TMP, $options->{ "genome" }, $maf_track, $record->{ "CHR" }, $record->{ "CHR_BEG" }, $record->{ "CHR_END" }, $record->{ "STRAND" } );
}
elsif ( $record->{ "REC_TYPE" } eq "PSL" )
{
- $align = &Maasha::UCSC::maf_extract( $BP_TMP, $options->{ "genome" }, $maf_track, $record->{ "S_ID" }, $record->{ "S_BEG" }, $record->{ "S_END" }, $record->{ "STRAND" } );
+ $align = Maasha::UCSC::maf_extract( $BP_TMP, $options->{ "genome" }, $maf_track, $record->{ "S_ID" }, $record->{ "S_BEG" }, $record->{ "S_END" }, $record->{ "STRAND" } );
}
elsif ( $record->{ "REC_TYPE" } eq "BLAST" )
{
- $align = &Maasha::UCSC::maf_extract( $BP_TMP, $options->{ "genome" }, $maf_track, $record->{ "S_ID" }, $record->{ "S_BEG" }, $record->{ "S_END" }, $record->{ "STRAND" } );
+ $align = Maasha::UCSC::maf_extract( $BP_TMP, $options->{ "genome" }, $maf_track, $record->{ "S_ID" }, $record->{ "S_BEG" }, $record->{ "S_END" }, $record->{ "STRAND" } );
}
foreach $entry ( @{ $align } )
{
- $entry->{ "ALIGN" } = $align_num;
$entry->{ "CHR" } = $record->{ "CHR" };
$entry->{ "CHR_BEG" } = $record->{ "CHR_BEG" };
$entry->{ "CHR_END" } = $record->{ "CHR_END" };
$entry->{ "Q_ID" } = $record->{ "Q_ID" };
$entry->{ "SCORE" } = $record->{ "SCORE" };
- &put_record( $entry, $out );
+ put_record( $entry, $out );
}
$align_num++;
$options->{ "flank" } ||= 0;
- $phastcons_file = &Maasha::Config::genome_phastcons( $options->{ "genome" } );
- $phastcons_index = &Maasha::Config::genome_phastcons_index( $options->{ "genome" } );
+ $phastcons_file = Maasha::Config::genome_phastcons( $options->{ "genome" } );
+ $phastcons_index = Maasha::Config::genome_phastcons_index( $options->{ "genome" } );
- $index = &Maasha::UCSC::phastcons_index_retrieve( $phastcons_index );
- $fh_phastcons = &Maasha::Common::read_open( $phastcons_file );
+ $index = Maasha::UCSC::phastcons_index_retrieve( $phastcons_index );
+ $fh_phastcons = Maasha::Common::read_open( $phastcons_file );
if ( defined $options->{ "chr" } and defined $options->{ "beg" } and ( defined $options->{ "end" } or defined $options->{ "len" } ) )
{
$options->{ "end" } = $options->{ "beg" } + $options->{ "len" } - 1;
}
- $scores = &Maasha::UCSC::phastcons_index_lookup( $index, $fh_phastcons, $options->{ "chr" }, $options->{ "beg" }, $options->{ "end" }, $options->{ "flank" } );
+ $scores = Maasha::UCSC::phastcons_index_lookup( $index, $fh_phastcons, $options->{ "chr" }, $options->{ "beg" }, $options->{ "end" }, $options->{ "flank" } );
$record->{ "CHR" } = $options->{ "chr" };
$record->{ "CHR_BEG" } = $options->{ "beg" } - $options->{ "flank" };
$record->{ "PHASTCONS" } = join ",", @{ $scores };
$record->{ "PHAST_COUNT" } = scalar @{ $scores }; # DEBUG
- &put_record( $record, $out );
+ put_record( $record, $out );
}
- while ( $record = &get_record( $in ) )
+ while ( $record = get_record( $in ) )
{
if ( $record->{ "REC_TYPE" } eq "BED" )
{
- $scores = &Maasha::UCSC::phastcons_index_lookup( $index, $fh_phastcons, $record->{ "CHR" }, $record->{ "CHR_BEG" }, $record->{ "CHR_END" }, $options->{ "flank" } );
+ $scores = Maasha::UCSC::phastcons_index_lookup( $index, $fh_phastcons, $record->{ "CHR" }, $record->{ "CHR_BEG" }, $record->{ "CHR_END" }, $options->{ "flank" } );
}
elsif ( $record->{ "REC_TYPE" } eq "PSL" )
{
- $scores = &Maasha::UCSC::phastcons_index_lookup( $index, $fh_phastcons, $record->{ "S_ID" }, $record->{ "S_BEG" }, $record->{ "S_END" }, $options->{ "flank" } );
+ $scores = Maasha::UCSC::phastcons_index_lookup( $index, $fh_phastcons, $record->{ "S_ID" }, $record->{ "S_BEG" }, $record->{ "S_END" }, $options->{ "flank" } );
}
elsif ( $record->{ "REC_TYPE" } eq "BLAST" )
{
- $scores = &Maasha::UCSC::phastcons_index_lookup( $index, $fh_phastcons, $record->{ "S_ID" }, $record->{ "S_BEG" }, $record->{ "S_END" }, $options->{ "flank" } );
+ $scores = Maasha::UCSC::phastcons_index_lookup( $index, $fh_phastcons, $record->{ "S_ID" }, $record->{ "S_BEG" }, $record->{ "S_END" }, $options->{ "flank" } );
}
$record->{ "PHASTCONS" } = join ",", @{ $scores } if @{ $scores };
# $record->{ "PHAST_COUNT" } = @{ $scores } if @{ $scores }; # DEBUG
- &put_record( $record, $out );
+ put_record( $record, $out );
}
close $fh_phastcons if $fh_phastcons;
my ( $record, $type, $struct, $index );
- while ( $record = &get_record( $in ) )
+ while ( $record = get_record( $in ) )
{
if ( $record->{ "SEQ" } )
{
if ( not $type ) {
- $type = &Maasha::Seq::seq_guess_type( $record->{ "SEQ" } );
+ $type = Maasha::Seq::seq_guess_type( $record->{ "SEQ" } );
}
if ( $type ne "protein" )
{
- ( $struct, $index ) = &Maasha::Seq::fold_struct_rnafold( $record->{ "SEQ" } );
+ ( $struct, $index ) = Maasha::Seq::fold_struct_rnafold( $record->{ "SEQ" } );
$record->{ "SEC_STRUCT" } = $struct;
$record->{ "FREE_ENERGY" } = $index;
$record->{ "SCORE" } = abs int $index;
}
}
- &put_record( $record, $out );
+ put_record( $record, $out );
}
}
$options->{ "word_size" } ||= 7;
- while ( $record = &get_record( $in ) )
+ while ( $record = get_record( $in ) )
{
if ( $record->{ "SEQ_NAME" } and $record->{ "SEQ" } )
{
$new_record->{ "SEQ_NAME" } = $record->{ "SEQ_NAME" } . "[" . ( $i + 1 ) . "-" . ( $i + $options->{ "word_size" } ) . "]";
$new_record->{ "SEQ" } = $subseq;
- &put_record( $new_record, $out );
+ put_record( $new_record, $out );
$lookup{ $subseq } = 1;
}
$new_record->{ "SEQ_NAME" } = $record->{ "SEQ_NAME" } . "[" . ( $i + 1 ) . "-" . ( $i + $options->{ "word_size" } ) . "]";
$new_record->{ "SEQ" } = $subseq;
- &put_record( $new_record, $out );
+ put_record( $new_record, $out );
}
}
}
else
{
- &put_record( $record, $out );
+ put_record( $record, $out );
}
}
}
$options->{ "window_size" } ||= 20;
$options->{ "step_size" } ||= 1;
- while ( $record = &get_record( $in ) )
+ while ( $record = get_record( $in ) )
{
if ( $record->{ "CHR" } and $record->{ "CHR_BEG" } and $record->{ "CHR_END" } )
{
$new_record->{ "SCORE" } = $record->{ "SCORE" };
$new_record->{ "STRAND" } = $record->{ "STRAND" };
- &put_record( $new_record, $out );
+ put_record( $new_record, $out );
}
}
else
{
- &put_record( $record, $out );
+ put_record( $record, $out );
}
}
}
my ( $record, @entries, $entry );
- while ( $record = &get_record( $in ) )
+ while ( $record = get_record( $in ) )
{
if ( $record->{ "SEQ_NAME" } and $record->{ "SEQ" } ) {
push @entries, [ $record->{ "SEQ_NAME" }, $record->{ "SEQ" } ];
} elsif ( $record->{ "Q_ID" } and $record->{ "SEQ" } ) {
push @entries, [ $record->{ "Q_ID" }, $record->{ "SEQ" } ];
} else {
- &put_record( $record, $out );
+ put_record( $record, $out );
}
}
- @entries = &Maasha::Align::align( \@entries );
+ @entries = Maasha::Align::align( \@entries );
foreach $entry ( @entries )
{
if ( $entry->[ SEQ_NAME ] and $entry->[ SEQ ] )
{
$record = {
- ALIGN => 1,
SEQ_NAME => $entry->[ SEQ_NAME ],
SEQ => $entry->[ SEQ ],
};
- &put_record( $record, $out );
+ put_record( $record, $out );
}
}
}
$first = 1;
- while ( $record = &get_record( $in ) )
+ while ( $record = get_record( $in ) )
{
if ( $record->{ "SEQ_NAME" } and $record->{ "SEQ" } )
{
}
else
{
- &put_record( $record, $out );
+ put_record( $record, $out );
}
}
- @entries = &Maasha::Align::align_tile( $ref_entry, \@entries, $options );
+ @entries = Maasha::Align::align_tile( $ref_entry, \@entries, $options );
- map { &put_record( { SEQ_NAME => $_->[ SEQ_NAME ], SEQ => $_->[ SEQ ], ALIGN => 1 }, $out ) } @entries;
+ map { put_record( { SEQ_NAME => $_->[ SEQ_NAME ], SEQ => $_->[ SEQ ] }, $out ) } @entries;
}
my ( $record, @entries );
- while ( $record = &get_record( $in ) )
+ while ( $record = get_record( $in ) )
{
- if ( $record->{ "SEQ_NAME" } and $record->{ "SEQ" } and $record->{ "ALIGN" } )
+ if ( $record->{ "SEQ_NAME" } and $record->{ "SEQ" } )
{
push @entries, [ $record->{ "SEQ_NAME" }, $record->{ "SEQ" } ];
}
else
{
- &put_record( $record, $out );
+ put_record( $record, $out );
}
}
- &Maasha::Align::align_invert( \@entries, $options->{ "soft" } );
+ Maasha::Align::align_invert( \@entries, $options->{ "soft" } );
- map { &put_record( { SEQ_NAME => $_->[ SEQ_NAME ], SEQ => $_->[ SEQ ], ALIGN => 1 }, $out ) } @entries;
+ map { put_record( { SEQ_NAME => $_->[ SEQ_NAME ], SEQ => $_->[ SEQ ] }, $out ) } @entries;
}
my ( $genome_file, @args, $arg, $type, $seq_file, $pat_file, $out_file, $fh_in, $fh_out, $record, $patterns, $pattern, $entry, $result, %head_hash, $i );
if ( $options->{ "patterns" } ) {
- $patterns = &Maasha::Patscan::parse_patterns( $options->{ "patterns" } );
+ $patterns = Maasha::Patscan::parse_patterns( $options->{ "patterns" } );
} elsif ( -f $options->{ "patterns_in" } ) {
- $patterns = &Maasha::Patscan::read_patterns( $options->{ "patterns_in" } );
+ $patterns = Maasha::Patscan::read_patterns( $options->{ "patterns_in" } );
}
- $genome_file = &Maasha::Config::genome_fasta( $options->{ 'genome' } ) if $options->{ 'genome' };
+ $genome_file = Maasha::Config::genome_fasta( $options->{ 'genome' } ) if $options->{ 'genome' };
push @args, "-c" if $options->{ "comp" };
push @args, "-m $options->{ 'max_hits' }" if $options->{ 'max_hits' };
$pat_file = "$BP_TMP/patscan.pat";
$out_file = "$BP_TMP/patscan.out";
- $fh_out = &Maasha::Common::write_open( $seq_file );
+ $fh_out = Maasha::Common::write_open( $seq_file );
$i = 0;
- while ( $record = &get_record( $in ) )
+ while ( $record = get_record( $in ) )
{
if ( $record->{ "SEQ" } and $record->{ "SEQ_NAME" } )
{
- $type = &Maasha::Seq::seq_guess_type( $record->{ "SEQ" } ) if not $type;
+ $type = Maasha::Seq::seq_guess_type( $record->{ "SEQ" } ) if not $type;
- &Maasha::Fasta::put_entry( [ $i, $record->{ "SEQ" } ], $fh_out );
+ Maasha::Fasta::put_entry( [ $i, $record->{ "SEQ" } ], $fh_out );
$head_hash{ $i } = $record->{ "SEQ_NAME" };
$i++;
}
-# &put_record( $record, $out );
+# put_record( $record, $out );
}
close $fh_out;
foreach $pattern ( @{ $patterns } )
{
- $fh_out = &Maasha::Common::write_open( $pat_file );
+ $fh_out = Maasha::Common::write_open( $pat_file );
print $fh_out "$pattern\n";
if ( $options->{ 'genome' } ) {
`scan_for_matches $arg $pat_file < $genome_file > $out_file`;
- # &Maasha::Common::run( "scan_for_matches", "$arg $pat_file < $genome_file > $out_file" );
+ # Maasha::Common::run( "scan_for_matches", "$arg $pat_file < $genome_file > $out_file" );
} else {
`scan_for_matches $arg $pat_file < $seq_file > $out_file`;
- # &Maasha::Common::run( "scan_for_matches", "$arg $pat_file < $seq_file > $out_file" );
+ # Maasha::Common::run( "scan_for_matches", "$arg $pat_file < $seq_file > $out_file" );
}
- $fh_in = &Maasha::Common::read_open( $out_file );
+ $fh_in = Maasha::Common::read_open( $out_file );
- while ( $entry = &Maasha::Fasta::get_entry( $fh_in ) )
+ while ( $entry = Maasha::Fasta::get_entry( $fh_in ) )
{
- $result = &Maasha::Patscan::parse_scan_result( $entry, $pattern );
+ $result = Maasha::Patscan::parse_scan_result( $entry, $pattern );
if ( $options->{ 'genome' } )
{
$result->{ "S_ID" } = $head_hash{ $result->{ "S_ID" } };
}
- &put_record( $result, $out );
+ put_record( $result, $out );
}
close $fh_in;
$path = $options->{ "database" };
- $fh = &Maasha::Common::write_open( $path );
+ $fh = Maasha::Common::write_open( $path );
- while ( $record = &get_record( $in ) )
+ while ( $record = get_record( $in ) )
{
- &put_record( $record, $out ) if not $options->{ "no_stream" };
+ put_record( $record, $out ) if not $options->{ "no_stream" };
if ( $record->{ "SEQ" } and $record->{ "SEQ_NAME" } )
{
- $seq_type = &Maasha::Seq::seq_guess_type( $record->{ "SEQ" } ) if not $seq_type;
+ $seq_type = Maasha::Seq::seq_guess_type( $record->{ "SEQ" } ) if not $seq_type;
- &Maasha::Fasta::put_entry( [ $record->{ "SEQ_NAME" }, $record->{ "SEQ" } ], $fh );
+ Maasha::Fasta::put_entry( [ $record->{ "SEQ_NAME" }, $record->{ "SEQ" } ], $fh );
}
}
close $fh;
if ( $seq_type eq "protein" ) {
- &Maasha::Common::run( "formatdb", "-p T -i $path -t $options->{ 'database' }" );
+ Maasha::Common::run( "formatdb", "-p T -i $path -t $options->{ 'database' }" );
} else {
- &Maasha::Common::run( "formatdb", "-p F -i $path -t $options->{ 'database' }" );
+ Maasha::Common::run( "formatdb", "-p F -i $path -t $options->{ 'database' }" );
}
unlink $path;
$options->{ "filter" } = "T" if $options->{ "filter" };
$options->{ "cpus" } ||= 1;
- $options->{ "database" } = &Maasha::Config::genome_blast( $options->{ 'genome' } ) if $options->{ 'genome' };
+ $options->{ "database" } = Maasha::Config::genome_blast( $options->{ 'genome' } ) if $options->{ 'genome' };
$tmp_in = "$BP_TMP/blast_query.seq";
$tmp_out = "$BP_TMP/blast.result";
- $fh_out = &Maasha::Common::write_open( $tmp_in );
+ $fh_out = Maasha::Common::write_open( $tmp_in );
- while ( $record = &get_record( $in ) )
+ while ( $record = get_record( $in ) )
{
if ( $record->{ "SEQ_NAME" } and $record->{ "SEQ" } )
{
- $q_type = &Maasha::Seq::seq_guess_type( $record->{ "SEQ" } ) if not $q_type;
+ $q_type = Maasha::Seq::seq_guess_type( $record->{ "SEQ" } ) if not $q_type;
- &Maasha::Fasta::put_entry( [ $record->{ "SEQ_NAME" }, $record->{ "SEQ" } ], $fh_out );
+ Maasha::Fasta::put_entry( [ $record->{ "SEQ_NAME" }, $record->{ "SEQ" } ], $fh_out );
}
- &put_record( $record, $out );
+ put_record( $record, $out );
}
close $fh_out;
}
}
- &Maasha::Common::run( "blastall", "-p $options->{ 'program' } -e $options->{ 'e_val' } -a $options->{ 'cpus' } -m 8 -i $tmp_in -d $options->{ 'database' } -F $options->{ 'filter' } -o $tmp_out > /dev/null 2>&1", 1 );
+ Maasha::Common::run( "blastall", "-p $options->{ 'program' } -e $options->{ 'e_val' } -a $options->{ 'cpus' } -m 8 -i $tmp_in -d $options->{ 'database' } -F $options->{ 'filter' } -o $tmp_out > /dev/null 2>&1", 1 );
unlink $tmp_in;
- $fh_out = &Maasha::Common::read_open( $tmp_out );
+ $fh_out = Maasha::Common::read_open( $tmp_out );
undef $record;
$record->{ "STRAND" } = '+';
}
- &put_record( $record, $out );
+ put_record( $record, $out );
}
close $fh_out;
my ( $blat_args, $genome_file, $query_file, $fh_in, $fh_out, $type, $record, $result_file, $entries );
- $genome_file = &Maasha::Config::genome_fasta( $options->{ "genome" } );
+ $genome_file = Maasha::Config::genome_fasta( $options->{ "genome" } );
$options->{ 'tile_size' } ||= 11;
$options->{ 'one_off' } ||= 0;
$blat_args .= " -minIdentity=$options->{ 'min_identity' }";
$blat_args .= " -minScore=$options->{ 'min_score' }";
$blat_args .= " -stepSize=$options->{ 'step_size' }";
- $blat_args .= " -ooc=" . &Maasha::Config::genome_blat_ooc( $options->{ "genome" }, 11 ) if $options->{ 'ooc' };
+ $blat_args .= " -ooc=" . Maasha::Config::genome_blat_ooc( $options->{ "genome" }, 11 ) if $options->{ 'ooc' };
$query_file = "$BP_TMP/blat.seq";
- $fh_out = &Maasha::Common::write_open( $query_file );
+ $fh_out = Maasha::Common::write_open( $query_file );
- while ( $record = &get_record( $in ) )
+ while ( $record = get_record( $in ) )
{
if ( $record->{ "SEQ_NAME" } and $record->{ "SEQ" } )
{
- &Maasha::Fasta::put_entry( [ $record->{ "SEQ_NAME" }, $record->{ "SEQ" } ], $fh_out, 80 );
- $type = &Maasha::Seq::seq_guess_type( $record->{ "SEQ" } ) if not $type;
+ Maasha::Fasta::put_entry( [ $record->{ "SEQ_NAME" }, $record->{ "SEQ" } ], $fh_out, 80 );
+ $type = Maasha::Seq::seq_guess_type( $record->{ "SEQ" } ) if not $type;
}
- &put_record( $record, $out );
+ put_record( $record, $out );
}
close $fh_out;
$result_file = "$BP_TMP/blat.psl";
- &Maasha::Common::run( "blat", "$genome_file $query_file $blat_args $result_file > /dev/null 2>&1" );
+ Maasha::Common::run( "blat", "$genome_file $query_file $blat_args $result_file > /dev/null 2>&1" );
unlink $query_file;
- $entries = &Maasha::UCSC::psl_get_entries( $result_file );
+ $entries = Maasha::UCSC::psl_get_entries( $result_file );
- map { &put_record( $_, $out ) } @{ $entries };
+ map { put_record( $_, $out ) } @{ $entries };
unlink $result_file;
}
$options->{ "word_size" } ||= 20;
$options->{ "direction" } ||= "both";
- while ( $record = &get_record( $in ) )
+ while ( $record = get_record( $in ) )
{
if ( $record->{ "SEQ_NAME" } and $record->{ "SEQ" } ) {
push @entries, [ $record->{ "SEQ_NAME" }, $record->{ "SEQ" } ];
}
- &put_record( $record, $out );
+ put_record( $record, $out );
}
if ( @entries == 1 )
{
- $results = &Maasha::Match::match_mummer( [ $entries[ 0 ] ], [ $entries[ 0 ] ], $options, $BP_TMP );
+ $results = Maasha::Match::match_mummer( [ $entries[ 0 ] ], [ $entries[ 0 ] ], $options, $BP_TMP );
- map { &put_record( $_, $out ) } @{ $results };
+ map { put_record( $_, $out ) } @{ $results };
}
elsif ( @entries == 2 )
{
- $results = &Maasha::Match::match_mummer( [ $entries[ 0 ] ], [ $entries[ 1 ] ], $options, $BP_TMP );
+ $results = Maasha::Match::match_mummer( [ $entries[ 0 ] ], [ $entries[ 1 ] ], $options, $BP_TMP );
- map { &put_record( $_, $out ) } @{ $results };
+ map { put_record( $_, $out ) } @{ $results };
}
}
if ( $options->{ "index_name" } )
{
$file_tmp = $options->{ 'index_name' };
- $fh_tmp = &Maasha::Common::write_open( $file_tmp );
+ $fh_tmp = Maasha::Common::write_open( $file_tmp );
}
- while ( $record = &get_record( $in ) )
+ while ( $record = get_record( $in ) )
{
if ( $options->{ "index_name" } and $record->{ "SEQ_NAME" } and $record->{ "SEQ" } )
{
- &Maasha::Fasta::put_entry( [ $record->{ "SEQ_NAME" }, $record->{ "SEQ" } ], $fh_tmp );
+ Maasha::Fasta::put_entry( [ $record->{ "SEQ_NAME" }, $record->{ "SEQ" } ], $fh_tmp );
- $type = &Maasha::Seq::seq_guess_type( $record->{ "SEQ" } ) if not $type;
+ $type = Maasha::Seq::seq_guess_type( $record->{ "SEQ" } ) if not $type;
}
- &put_record( $record, $out ) if not $options->{ "no_stream" };
+ put_record( $record, $out ) if not $options->{ "no_stream" };
}
if ( $options->{ "index_name" } )
close $fh_tmp;
if ( $type eq "protein" ) {
- &Maasha::Common::run( "mkvtree", "-db $file_tmp -protein -pl $options->{ 'prefix_length' } -allout -indexname $file_tmp > /dev/null 2>&1" );
+ Maasha::Common::run( "mkvtree", "-db $file_tmp -protein -pl $options->{ 'prefix_length' } -allout -indexname $file_tmp > /dev/null 2>&1" );
} else {
- &Maasha::Common::run( "mkvtree", "-db $file_tmp -dna -pl $options->{ 'prefix_length' } -allout -indexname $file_tmp > /dev/null 2>&1" );
+ Maasha::Common::run( "mkvtree", "-db $file_tmp -dna -pl $options->{ 'prefix_length' } -allout -indexname $file_tmp > /dev/null 2>&1" );
}
unlink $file_tmp;
if ( $options->{ "index_name" } ) {
@index_files = $options->{ "index_name" };
} else {
- @index_files = &Maasha::Config::genome_vmatch( $options->{ "genome" } );
+ @index_files = Maasha::Config::genome_vmatch( $options->{ "genome" } );
}
- while ( $record = &get_record( $in ) )
+ while ( $record = get_record( $in ) )
{
push @records, $record;
- &put_record( $record, $out );
+ put_record( $record, $out );
}
- $result_file = &Maasha::Match::match_vmatch( $BP_TMP, \@records, \@index_files, $options );
+ $result_file = Maasha::Match::match_vmatch( $BP_TMP, \@records, \@index_files, $options );
undef @records;
- $fh_in = &Maasha::Common::read_open( $result_file );
+ $fh_in = Maasha::Common::read_open( $result_file );
- while ( $record = &Maasha::Match::vmatch_get_entry( $fh_in ) ) {
- &put_record( $record, $out );
+ while ( $record = Maasha::Match::vmatch_get_entry( $fh_in ) ) {
+ put_record( $record, $out );
}
close $fh_in;
my ( $record, $fh );
- $fh = &write_stream( $options->{ "data_out" }, $options->{ "compress" } );
+ $fh = write_stream( $options->{ "data_out" }, $options->{ "compress" } );
- while ( $record = &get_record( $in ) )
+ while ( $record = get_record( $in ) )
{
if ( $record->{ "SEQ_NAME" } and $record->{ "SEQ" } ) {
- &Maasha::Fasta::put_entry( [ $record->{ "SEQ_NAME" }, $record->{ "SEQ" } ], $fh, $options->{ "wrap" } );
+ Maasha::Fasta::put_entry( [ $record->{ "SEQ_NAME" }, $record->{ "SEQ" } ], $fh, $options->{ "wrap" } );
}
- &put_record( $record, $out ) if not $options->{ "no_stream" };
+ put_record( $record, $out ) if not $options->{ "no_stream" };
}
close $fh;
# Returns nothing.
- my ( $fh, $record, $align, $old_align, @entries );
+ my ( $fh, $record, @entries );
- $fh = &write_stream( $options->{ "data_out" } ) ;
+ $fh = write_stream( $options->{ "data_out" } ) ;
- while ( $record = &get_record( $in ) )
+ while ( $record = get_record( $in ) )
{
- if ( $record->{ "ALIGN" } and $record->{ "SEQ_NAME" } and $record->{ "SEQ" } )
- {
- $align = $record->{ "ALIGN" };
-
- if ( not $old_align )
- {
- push @entries, [ $record->{ "SEQ_NAME" }, $record->{ "SEQ" } ];
-
- $old_align = $align;
- }
- elsif ( $align == $old_align )
- {
- push @entries, [ $record->{ "SEQ_NAME" }, $record->{ "SEQ" } ];
- }
- else
- {
- if ( scalar( @entries ) == 2 ) {
- &Maasha::Align::align_print_pairwise( $entries[ 0 ], $entries[ 1 ], $fh, $options->{ "wrap" } );
- } elsif ( scalar ( @entries ) > 2 ) {
- &Maasha::Align::align_print_multi( \@entries, $fh, $options->{ "wrap" }, $options->{ "no_ruler" }, $options->{ "no_consensus" } );
- }
-
- undef @entries;
- $old_align = $align;
- }
+ if ( $record->{ "SEQ_NAME" } and $record->{ "SEQ" } ) {
+ push @entries, [ $record->{ "SEQ_NAME" }, $record->{ "SEQ" } ];
}
- &put_record( $record, $out ) if not $options->{ "no_stream" };
+ put_record( $record, $out ) if not $options->{ "no_stream" };
}
if ( scalar( @entries ) == 2 ) {
- &Maasha::Align::align_print_pairwise( $entries[ 0 ], $entries[ 1 ], $fh, $options->{ "wrap" } );
+ Maasha::Align::align_print_pairwise( $entries[ 0 ], $entries[ 1 ], $fh, $options->{ "wrap" } );
} elsif ( scalar ( @entries ) > 2 ) {
- &Maasha::Align::align_print_multi( \@entries, $fh, $options->{ "wrap" }, $options->{ "no_ruler" }, $options->{ "no_consensus" } );
+ Maasha::Align::align_print_multi( \@entries, $fh, $options->{ "wrap" }, $options->{ "no_ruler" }, $options->{ "no_consensus" } );
}
close $fh if $fh;
my ( $fh, $record, $first );
- $fh = &write_stream( $options->{ "data_out" }, $options->{ "compress" } ) ;
+ $fh = write_stream( $options->{ "data_out" }, $options->{ "compress" } ) ;
$first = 1;
- while ( $record = &get_record( $in ) )
+ while ( $record = get_record( $in ) )
{
if ( $record->{ "REC_TYPE" } eq "BLAST" )
{
), "\n";
}
- &put_record( $record, $out ) if not $options->{ "no_stream" };
+ put_record( $record, $out ) if not $options->{ "no_stream" };
}
close $fh;
map { $no_keys{ $_ } = 1 } @{ $options->{ "no_keys" } };
- $fh = &write_stream( $options->{ "data_out" }, $options->{ "compress" } );
+ $fh = write_stream( $options->{ "data_out" }, $options->{ "compress" } );
- while ( $record = &get_record( $in ) )
+ while ( $record = get_record( $in ) )
{
undef @vals;
$ok = 1;
print $fh join( $options->{ "delimit" }, @vals ), "\n" if @vals;
- &put_record( $record, $out ) if not $options->{ "no_stream" };
+ put_record( $record, $out ) if not $options->{ "no_stream" };
}
close $fh;
my ( $fh, $record, $new_record );
- $fh = &write_stream( $options->{ "data_out" }, $options->{ "compress" } );
+ $fh = write_stream( $options->{ "data_out" }, $options->{ "compress" } );
- while ( $record = &get_record( $in ) )
+ while ( $record = get_record( $in ) )
{
if ( $record->{ "REC_TYPE" } eq "BED" ) # ---- Hits from BED ----
{
- &Maasha::UCSC::bed_put_entry( $record, $fh, $record->{ "BED_COLS" } );
+ Maasha::UCSC::bed_put_entry( $record, $fh, $record->{ "BED_COLS" } );
}
elsif ( $record->{ "REC_TYPE" } eq "PSL" and $record->{ "S_ID" } =~ /^chr/i ) # ---- Hits from BLAT (PSL) ----
{
$new_record->{ "SCORE" } = $record->{ "SCORE" } || 999;
$new_record->{ "STRAND" } = $record->{ "STRAND" };
- &Maasha::UCSC::bed_put_entry( $new_record, $fh, 6 );
+ Maasha::UCSC::bed_put_entry( $new_record, $fh, 6 );
}
elsif ( $record->{ "REC_TYPE" } eq "PATSCAN" and $record->{ "CHR" } ) # ---- Hits from patscan_seq ----
{
- &Maasha::UCSC::bed_put_entry( $record, $fh, 6 );
+ Maasha::UCSC::bed_put_entry( $record, $fh, 6 );
}
elsif ( $record->{ "REC_TYPE" } eq "BLAST" and $record->{ "S_ID" } =~ /^chr/i ) # ---- Hits from BLAST ----
{
$new_record->{ "SCORE" } = $record->{ "SCORE" } || 999; # or use E_VAL somehow
$new_record->{ "STRAND" } = $record->{ "STRAND" };
- &Maasha::UCSC::bed_put_entry( $new_record, $fh, 6 );
+ Maasha::UCSC::bed_put_entry( $new_record, $fh, 6 );
}
elsif ( $record->{ "REC_TYPE" } eq "VMATCH" and $record->{ "S_ID" } =~ /^chr/i ) # ---- Hits from Vmatch ----
{
$new_record->{ "SCORE" } = $record->{ "SCORE" } || 999; # or use E_VAL somehow
$new_record->{ "STRAND" } = $record->{ "STRAND" };
- &Maasha::UCSC::bed_put_entry( $new_record, $fh, 6 );
+ Maasha::UCSC::bed_put_entry( $new_record, $fh, 6 );
}
elsif ( $record->{ "CHR" } and defined $record->{ "CHR_BEG" } and $record->{ "CHR_END" } ) # ---- Generic data from tables ----
{
- &Maasha::UCSC::bed_put_entry( $record, $fh );
+ Maasha::UCSC::bed_put_entry( $record, $fh );
}
- &put_record( $record, $out ) if not $options->{ "no_stream" };
+ put_record( $record, $out ) if not $options->{ "no_stream" };
}
close $fh;
$first = 1;
- $fh = &write_stream( $options->{ "data_out" }, $options->{ "compress" } );
+ $fh = write_stream( $options->{ "data_out" }, $options->{ "compress" } );
- while ( $record = &get_record( $in ) )
+ while ( $record = get_record( $in ) )
{
- &put_record( $record, $out ) if not $options->{ "no_stream" };
+ put_record( $record, $out ) if not $options->{ "no_stream" };
if ( $record->{ "REC_TYPE" } and $record->{ "REC_TYPE" } eq "PSL" )
{
- &Maasha::UCSC::psl_put_header( $fh ) if $first;
- &Maasha::UCSC::psl_put_entry( $record, $fh );
+ Maasha::UCSC::psl_put_header( $fh ) if $first;
+ Maasha::UCSC::psl_put_entry( $record, $fh );
$first = 0;
}
}
$mask = 1 if not $options->{ "no_mask" };
$tmp_file = "$BP_TMP/write_2bit.fna";
- $fh_tmp = &Maasha::Common::write_open( $tmp_file );
+ $fh_tmp = Maasha::Common::write_open( $tmp_file );
- $fh_out = &write_stream( $options->{ "data_out" } );
+ $fh_out = write_stream( $options->{ "data_out" } );
- while ( $record = &get_record( $in ) )
+ while ( $record = get_record( $in ) )
{
if ( $record->{ "SEQ_NAME" } and $record->{ "SEQ" } ) {
- &Maasha::Fasta::put_entry( [ $record->{ "SEQ_NAME" }, $record->{ "SEQ" } ], $fh_tmp );
+ Maasha::Fasta::put_entry( [ $record->{ "SEQ_NAME" }, $record->{ "SEQ" } ], $fh_tmp );
}
- &put_record( $record, $out ) if not $options->{ "no_stream" };
+ put_record( $record, $out ) if not $options->{ "no_stream" };
}
close $fh_tmp;
- $fh_in = &Maasha::Common::read_open( $tmp_file );
+ $fh_in = Maasha::Common::read_open( $tmp_file );
- &Maasha::TwoBit::fasta2twobit( $fh_in, $fh_out, $mask );
+ Maasha::TwoBit::fasta2twobit( $fh_in, $fh_out, $mask );
close $fh_in;
close $fh_out;
my ( $record, $fh, $seq_cs );
- $fh = &write_stream( $options->{ "data_out" }, $options->{ "compress" } );
+ $fh = write_stream( $options->{ "data_out" }, $options->{ "compress" } );
- while ( $record = &get_record( $in ) )
+ while ( $record = get_record( $in ) )
{
if ( $record->{ "SEQ_NAME" } and $record->{ "SEQ" } )
{
- $seq_cs = &Maasha::Solid::seq2color_space( $record->{ "SEQ" } );
+ $seq_cs = Maasha::Solid::seq2color_space( $record->{ "SEQ" } );
- &Maasha::Fasta::put_entry( [ $record->{ "SEQ_NAME" }, $seq_cs ], $fh, $options->{ "wrap" } );
+ Maasha::Fasta::put_entry( [ $record->{ "SEQ_NAME" }, $seq_cs ], $fh, $options->{ "wrap" } );
}
- &put_record( $record, $out ) if not $options->{ "no_stream" };
+ put_record( $record, $out ) if not $options->{ "no_stream" };
}
close $fh;
my ( $record, @entries, $logo, $fh );
- while ( $record = &get_record( $in ) )
+ while ( $record = get_record( $in ) )
{
if ( $record->{ "SEQ_NAME" } and $record->{ "SEQ" } ) {
push @entries, [ $record->{ "SEQ_NAME" }, $record->{ "SEQ" } ];
}
- &put_record( $record, $out ) if not $options->{ "no_stream" };
+ put_record( $record, $out ) if not $options->{ "no_stream" };
}
- $logo = &Maasha::Plot::seq_logo( \@entries );
+ $logo = Maasha::Plot::seq_logo( \@entries );
- $fh = &write_stream( $options->{ "data_out" } );
+ $fh = write_stream( $options->{ "data_out" } );
print $fh $logo;
$options->{ "title" } ||= "PhastCons Profiles";
- $phastcons_file = &Maasha::Config::genome_phastcons( $options->{ "genome" } );
- $phastcons_index = &Maasha::Config::genome_phastcons_index( $options->{ "genome" } );
+ $phastcons_file = Maasha::Config::genome_phastcons( $options->{ "genome" } );
+ $phastcons_index = Maasha::Config::genome_phastcons_index( $options->{ "genome" } );
- $index = &Maasha::UCSC::phastcons_index_retrieve( $phastcons_index );
- $fh_phastcons = &Maasha::Common::read_open( $phastcons_file );
+ $index = Maasha::UCSC::phastcons_index_retrieve( $phastcons_index );
+ $fh_phastcons = Maasha::Common::read_open( $phastcons_file );
- while ( $record = &get_record( $in ) )
+ while ( $record = get_record( $in ) )
{
if ( $record->{ "CHR" } and $record->{ "CHR_BEG" } and $record->{ "CHR_END" } )
{
- $scores = &Maasha::UCSC::phastcons_index_lookup( $index, $fh_phastcons, $record->{ "CHR" }, $record->{ "CHR_BEG" }, $record->{ "CHR_END" }, $options->{ "flank" } );
+ $scores = Maasha::UCSC::phastcons_index_lookup( $index, $fh_phastcons, $record->{ "CHR" }, $record->{ "CHR_BEG" }, $record->{ "CHR_END" }, $options->{ "flank" } );
push @{ $AoA }, [ @{ $scores } ];
}
- &put_record( $record, $out ) if not $options->{ "no_stream" };
+ put_record( $record, $out ) if not $options->{ "no_stream" };
}
- &Maasha::UCSC::phastcons_normalize( $AoA );
+ Maasha::UCSC::phastcons_normalize( $AoA );
- $AoA = [ [ &Maasha::UCSC::phastcons_mean( $AoA ) ] ] if $options->{ "mean" };
- $AoA = [ [ &Maasha::UCSC::phastcons_median( $AoA ) ] ] if $options->{ "median" };
+ $AoA = [ [ Maasha::UCSC::phastcons_mean( $AoA ) ] ] if $options->{ "mean" };
+ $AoA = [ [ Maasha::UCSC::phastcons_median( $AoA ) ] ] if $options->{ "median" };
- $AoA = &Maasha::Matrix::matrix_flip( $AoA );
+ $AoA = Maasha::Matrix::matrix_flip( $AoA );
- $plot = &Maasha::Plot::lineplot_simple( $AoA, $options, $BP_TMP );
+ $plot = Maasha::Plot::lineplot_simple( $AoA, $options, $BP_TMP );
- $fh = &write_stream( $options->{ "data_out" } );
+ $fh = write_stream( $options->{ "data_out" } );
print $fh "$_\n" foreach @{ $plot };
my ( $record );
- while ( $record = &get_record( $in ) )
+ while ( $record = get_record( $in ) )
{
- $record = &Maasha::UCSC::bed_analyze( $record ) if $record->{ "REC_TYPE" } eq "BED";
+ $record = Maasha::UCSC::bed_analyze( $record ) if $record->{ "REC_TYPE" } eq "BED";
- &put_record( $record, $out );
+ put_record( $record, $out );
}
}
map { $key_hash{ $_ } = 1 } @{ $options->{ "keys" } };
- while ( $record = &get_record( $in ) )
+ while ( $record = get_record( $in ) )
{
foreach $key ( keys %{ $record } )
{
$analysis->{ $key }->{ "COUNT" }++;
- if ( &Maasha::Calc::is_a_number( $record->{ $key } ) )
+ if ( Maasha::Calc::is_a_number( $record->{ $key } ) )
{
$analysis->{ $key }->{ "TYPE" } = "num";
$analysis->{ $key }->{ "SUM" } += $record->{ $key };
}
}
- &put_record( $record, $out ) if not $options->{ "no_stream" };
+ put_record( $record, $out ) if not $options->{ "no_stream" };
}
foreach $key ( keys %{ $analysis } )
$count = 0;
- while ( $record = &get_record( $in ) )
+ while ( $record = get_record( $in ) )
{
$count++;
- &put_record( $record, $out );
+ put_record( $record, $out );
last if $count == $options->{ "num" };
}
my ( $record, $new_record );
- while ( $record = &get_record( $in ) )
+ while ( $record = get_record( $in ) )
{
if ( $options->{ "keys" } )
{
$record = $new_record;
}
- &put_record( $record, $out ) if keys %{ $record };
+ put_record( $record, $out ) if keys %{ $record };
}
}
my ( $record );
- while ( $record = &get_record( $in ) )
+ while ( $record = get_record( $in ) )
{
if ( exists $record->{ $options->{ "keys" }->[ 0 ] } )
{
delete $record->{ $options->{ "keys" }->[ 0 ] };
}
- &put_record( $record, $out );
+ put_record( $record, $out );
}
}
my ( %hash, $record );
- while ( $record = &get_record( $in ) )
+ while ( $record = get_record( $in ) )
{
if ( $record->{ $options->{ "key" } } )
{
if ( not $hash{ $record->{ $options->{ "key" } } } and not $options->{ "invert" } )
{
- &put_record( $record, $out );
+ put_record( $record, $out );
$hash{ $record->{ $options->{ "key" } } } = 1;
}
elsif ( $hash{ $record->{ $options->{ "key" } } } and $options->{ "invert" } )
{
- &put_record( $record, $out );
+ put_record( $record, $out );
}
else
{
}
else
{
- &put_record( $record, $out );
+ put_record( $record, $out );
}
}
}
$options->{ "delimit" } ||= '_';
- while ( $record = &get_record( $in ) )
+ while ( $record = get_record( $in ) )
{
if ( exists $record->{ $options->{ "keys" }->[ 0 ] } )
{
$record->{ $options->{ "keys" }->[ 0 ] } = join $options->{ "delimit" }, @join;
}
- &put_record( $record, $out );
+ put_record( $record, $out );
}
}
}
elsif ( -f $options->{ "patterns_in" } )
{
- $patterns = &Maasha::Patscan::read_patterns( $options->{ "patterns_in" } );
+ $patterns = Maasha::Patscan::read_patterns( $options->{ "patterns_in" } );
}
elsif ( -f $options->{ "exact_in" } )
{
- $patterns = &Maasha::Patscan::read_patterns( $options->{ "exact_in" } );
+ $patterns = Maasha::Patscan::read_patterns( $options->{ "exact_in" } );
map { $lookup_hash{ $_ } = 1 } @{ $patterns };
}
}
- while ( $record = &get_record( $in ) )
+ while ( $record = get_record( $in ) )
{
$pos = -1;
FOUND:
if ( $pos >= 0 and not $options->{ "invert" } ) {
- &put_record( $record, $out );
+ put_record( $record, $out );
} elsif ( $pos < 0 and $options->{ "invert" } ) {
- &put_record( $record, $out );
+ put_record( $record, $out );
}
}
}
my ( $record, $eval_key, $eval_val, $check, @keys );
- while ( $record = &get_record( $in ) )
+ while ( $record = get_record( $in ) )
{
if ( $options->{ "eval" } )
{
map { $eval_val =~ s/$_/$record->{ $_ }/g } @keys;
- $record->{ $eval_key } = eval "$eval_val" or &Maasha::Common::error( "eval failed -> $@" );
+ $record->{ $eval_key } = eval "$eval_val" or Maasha::Common::error( "eval failed -> $@" );
}
- &put_record( $record, $out );
+ put_record( $record, $out );
}
}
my ( $record, $key, $A, $B, @rows, @matrix, $row, $i );
- while ( $record = &get_record( $in ) )
+ while ( $record = get_record( $in ) )
{
undef @rows;
undef $record;
- @matrix = &Maasha::Matrix::matrix_flip( \@matrix );
+ @matrix = Maasha::Matrix::matrix_flip( \@matrix );
foreach $row ( @matrix )
{
$record->{ "V$i" } = $row->[ $i ];
}
- &put_record( $record, $out );
+ put_record( $record, $out );
}
}
$i = 0;
- while ( $record = &get_record( $in ) )
+ while ( $record = get_record( $in ) )
{
$record->{ $key } = sprintf( "$prefix%08d", $i );
- &put_record( $record, $out );
+ put_record( $record, $out );
$i++;
}
}
else
{
- while ( $record = &get_record( $in ) )
+ while ( $record = get_record( $in ) )
{
- &put_record( $record, $out );
+ put_record( $record, $out );
$count++;
}
$result = { "count_records" => $count };
- $fh = &write_stream( $options->{ "data_out" } );
+ $fh = write_stream( $options->{ "data_out" } );
- &put_record( $result, $fh );
+ put_record( $result, $fh );
close $fh;
}
$tmp_file = "$BP_TMP/random_records.tmp";
- $fh_out = &Maasha::Common::write_open( $tmp_file );
+ $fh_out = Maasha::Common::write_open( $tmp_file );
$count = 0;
- while ( $record = &get_record( $in ) )
+ while ( $record = get_record( $in ) )
{
- &put_record( $record, $fh_out );
+ put_record( $record, $fh_out );
$count++;
}
$max = 0;
$i = 0;
- &Maasha::Common::error( qq(Requested random records > records in stream) ) if $options->{ "num" } > $count;
+ Maasha::Common::error( qq(Requested random records > records in stream) ) if $options->{ "num" } > $count;
while ( $i < $options->{ "num" } )
{
}
}
- $fh_in = &Maasha::Common::read_open( $tmp_file );
+ $fh_in = Maasha::Common::read_open( $tmp_file );
$count = 0;
- while ( $record = &get_record( $fh_in ) )
+ while ( $record = get_record( $fh_in ) )
{
- &put_record( $record, $out ) if exists $rand_hash{ $count };
+ put_record( $record, $out ) if exists $rand_hash{ $count };
last if $count == $max;
$sort_str = join " or ", @sort_cmd;
$sort_sub = eval "sub { $sort_str }"; # NB security issue!
- while ( $record = &get_record( $in ) ) {
+ while ( $record = get_record( $in ) ) {
push @records, $record;
}
if ( $options->{ "reverse" } )
{
for ( $i = scalar @records - 1; $i >= 0; $i-- ) {
- &put_record( $records[ $i ], $out );
+ put_record( $records[ $i ], $out );
}
}
else
{
for ( $i = 0; $i < scalar @records; $i++ ) {
- &put_record( $records[ $i ], $out );
+ put_record( $records[ $i ], $out );
}
}
}
$tmp_file = "$BP_TMP/count_cache.tmp";
- $fh_out = &Maasha::Common::write_open( $tmp_file );
+ $fh_out = Maasha::Common::write_open( $tmp_file );
$num = 0;
- while ( $record = &get_record( $in ) )
+ while ( $record = get_record( $in ) )
{
map { $count_hash{ $_ }{ $record->{ $_ } }++ if exists $record->{ $_ } } @{ $options->{ "keys" } };
if ( scalar @records > 5_000_000 ) # too many records to hold in memory - use disk cache
{
- map { &put_record( $_, $fh_out ) } @records;
+ map { put_record( $_, $fh_out ) } @records;
undef @records;
{
$num = 0;
- $fh_in = &Maasha::Common::read_open( $tmp_file );
+ $fh_in = Maasha::Common::read_open( $tmp_file );
- while ( $record = &get_record( $fh_in ) )
+ while ( $record = get_record( $fh_in ) )
{
map { $record->{ $_ . "_COUNT" } = $count_hash{ $_ }{ $record->{ $_ } } if exists $record->{ $_ } } @{ $options->{ "keys" } };
- &put_record( $record, $out );
+ put_record( $record, $out );
print STDERR "verbose: cache read $num\n" if ( $options->{ 'verbose' } and ( $num % 1_000_000 ) == 0 );
{
map { $record->{ $_ . "_COUNT" } = $count_hash{ $_ }{ $record->{ $_ } } if exists $record->{ $_ } } @{ $options->{ "keys" } };
- &put_record( $record, $out );
+ put_record( $record, $out );
}
unlink $tmp_file;
$options->{ "title" } ||= "Histogram";
$options->{ "sort" } ||= "num";
- while ( $record = &get_record( $in ) )
+ while ( $record = get_record( $in ) )
{
$data_hash{ $record->{ $options->{ "key" } } }++ if $record->{ $options->{ "key" } };
- &put_record( $record, $out ) if not $options->{ "no_stream" };
+ put_record( $record, $out ) if not $options->{ "no_stream" };
}
if ( $options->{ "sort" } eq "num" ) {
map { push @data_list, [ $_, $data_hash{ $_ } ] } sort keys %data_hash;
}
- $result = &Maasha::Plot::histogram_simple( \@data_list, $options );
+ $result = Maasha::Plot::histogram_simple( \@data_list, $options );
- $fh = &write_stream( $options->{ "data_out" } );
+ $fh = write_stream( $options->{ "data_out" } );
print $fh "$_\n" foreach @{ $result };
$options->{ "title" } ||= "Length Distribution";
- while ( $record = &get_record( $in ) )
+ while ( $record = get_record( $in ) )
{
$data_hash{ $record->{ $options->{ "key" } } }++ if $record->{ $options->{ "key" } };
- &put_record( $record, $out ) if not $options->{ "no_stream" };
+ put_record( $record, $out ) if not $options->{ "no_stream" };
}
- $max = &Maasha::Calc::list_max( [ keys %data_hash ] );
+ $max = Maasha::Calc::list_max( [ keys %data_hash ] );
for ( $i = 0; $i < $max; $i++ ) {
push @data_list, [ $i, $data_hash{ $i } || 0 ];
}
- $result = &Maasha::Plot::histogram_lendist( \@data_list, $options );
+ $result = Maasha::Plot::histogram_lendist( \@data_list, $options );
- $fh = &write_stream( $options->{ "data_out" } );
+ $fh = write_stream( $options->{ "data_out" } );
print $fh "$_\n" foreach @{ $result };
$options->{ "title" } ||= "Chromosome Distribution";
- while ( $record = &get_record( $in ) )
+ while ( $record = get_record( $in ) )
{
if ( $record->{ "CHR" } ) { # generic
$data_hash{ $record->{ "CHR" } }++;
$data_hash{ $record->{ "S_ID" } }++;
}
- &put_record( $record, $out ) if not $options->{ "no_stream" };
+ put_record( $record, $out ) if not $options->{ "no_stream" };
}
foreach $elem ( keys %data_hash )
@data_list = sort { $a->[ 2 ] <=> $b->[ 2 ] } @data_list;
- $result = &Maasha::Plot::histogram_chrdist( \@data_list, $options );
+ $result = Maasha::Plot::histogram_chrdist( \@data_list, $options );
- $fh = &write_stream( $options->{ "data_out" } );
+ $fh = write_stream( $options->{ "data_out" } );
print $fh "$_\n" foreach @{ $result };
$options->{ "genome" } ||= "human";
$options->{ "feat_color" } ||= "black";
- while ( $record = &get_record( $in ) )
+ while ( $record = get_record( $in ) )
{
if ( $record->{ "CHR" } and $record->{ "CHR_BEG" } and $record->{ "CHR_END" } )
{
push @{ $data_hash{ $record->{ "CHR" } } }, [ $record->{ "CHR_BEG" }, $record->{ "CHR_END" }, $options->{ "feat_color" } ];
}
- &put_record( $record, $out ) if not $options->{ "no_stream" };
+ put_record( $record, $out ) if not $options->{ "no_stream" };
}
- $result = &Maasha::Plot::karyogram( \%data_hash, \%options );
+ $result = Maasha::Plot::karyogram( \%data_hash, \%options );
- $fh = &write_stream( $options->{ "data_out" } );
+ $fh = write_stream( $options->{ "data_out" } );
print $fh $result;
$options->{ "direction" } ||= "both";
- while ( $record = &get_record( $in ) )
+ while ( $record = get_record( $in ) )
{
if ( defined $record->{ "Q_BEG" } and defined $record->{ "S_BEG" } and $record->{ "Q_END" } and $record->{ "S_END" } ) {
push @data, $record;
}
- &put_record( $record, $out ) if not $options->{ "no_stream" };
+ put_record( $record, $out ) if not $options->{ "no_stream" };
}
$options->{ "title" } ||= "plot_matches";
$options->{ "xlabel" } ||= $data[ 0 ]->{ "Q_ID" };
$options->{ "ylabel" } ||= $data[ 0 ]->{ "S_ID" };
- $result = &Maasha::Plot::dotplot_matches( \@data, $options, $BP_TMP );
+ $result = Maasha::Plot::dotplot_matches( \@data, $options, $BP_TMP );
- $fh = &write_stream( $options->{ "data_out" } );
+ $fh = write_stream( $options->{ "data_out" } );
print $fh "$_\n" foreach @{ $result };
my ( $record, $key );
- while ( $record = &get_record( $in ) )
+ while ( $record = get_record( $in ) )
{
foreach $key ( @{ $options->{ "keys" } } )
{
}
}
- &put_record( $record, $out );
+ put_record( $record, $out );
}
}
my ( $record, $key, %sum_hash, $fh );
- while ( $record = &get_record( $in ) )
+ while ( $record = get_record( $in ) )
{
foreach $key ( @{ $options->{ "keys" } } )
{
}
}
- &put_record( $record, $out ) if not $options->{ "no_stream" };
+ put_record( $record, $out ) if not $options->{ "no_stream" };
}
- $fh = &write_stream( $options->{ "data_out" } );
+ $fh = write_stream( $options->{ "data_out" } );
foreach $key ( @{ $options->{ "keys" } } ) {
- &put_record( { $key . "_SUM" => $sum_hash{ $key } || 0 } , $fh );
+ put_record( { $key . "_SUM" => $sum_hash{ $key } || 0 } , $fh );
}
close $fh;
my ( $record, $key, %sum_hash, %count_hash, $mean, $fh );
- while ( $record = &get_record( $in ) )
+ while ( $record = get_record( $in ) )
{
foreach $key ( @{ $options->{ "keys" } } )
{
}
}
- &put_record( $record, $out ) if not $options->{ "no_stream" };
+ put_record( $record, $out ) if not $options->{ "no_stream" };
}
- $fh = &write_stream( $options->{ "data_out" } );
+ $fh = write_stream( $options->{ "data_out" } );
foreach $key ( @{ $options->{ "keys" } } )
{
$mean = "N/A";
}
- &put_record( { $key . "_MEAN" => $mean } , $fh );
+ put_record( { $key . "_MEAN" => $mean } , $fh );
}
close $fh;
my ( $record, $key, %median_hash, $median, $fh );
- while ( $record = &get_record( $in ) )
+ while ( $record = get_record( $in ) )
{
foreach $key ( @{ $options->{ "keys" } } ) {
push @{ $median_hash{ $key } }, $record->{ $key } if defined $record->{ $key };
}
- &put_record( $record, $out ) if not $options->{ "no_stream" };
+ put_record( $record, $out ) if not $options->{ "no_stream" };
}
- $fh = &write_stream( $options->{ "data_out" } );
+ $fh = write_stream( $options->{ "data_out" } );
foreach $key ( @{ $options->{ "keys" } } )
{
if ( $median_hash{ $key } ) {
- $median = &Maasha::Calc::median( $median_hash{ $key } );
+ $median = Maasha::Calc::median( $median_hash{ $key } );
} else {
$median = "N/A";
}
- &put_record( { $key . "_MEDIAN" => $median } , $fh );
+ put_record( { $key . "_MEDIAN" => $median } , $fh );
}
close $fh;
my ( $record, $key, $fh, %max_hash, $max_record );
- while ( $record = &get_record( $in ) )
+ while ( $record = get_record( $in ) )
{
foreach $key ( @{ $options->{ "keys" } } )
{
}
}
- &put_record( $record, $out ) if not $options->{ "no_stream" };
+ put_record( $record, $out ) if not $options->{ "no_stream" };
}
- $fh = &write_stream( $options->{ "data_out" } );
+ $fh = write_stream( $options->{ "data_out" } );
foreach $key ( @{ $options->{ "keys" } } )
{
$max_record->{ $key . "_MAX" } = $max_hash{ $key };
}
- &put_record( $max_record, $fh );
+ put_record( $max_record, $fh );
close $fh;
}
my ( $record, $key, $fh, %min_hash, $min_record );
- while ( $record = &get_record( $in ) )
+ while ( $record = get_record( $in ) )
{
foreach $key ( @{ $options->{ "keys" } } )
{
}
}
- &put_record( $record, $out ) if not $options->{ "no_stream" };
+ put_record( $record, $out ) if not $options->{ "no_stream" };
}
- $fh = &write_stream( $options->{ "data_out" } );
+ $fh = write_stream( $options->{ "data_out" } );
foreach $key ( @{ $options->{ "keys" } } )
{
$min_record->{ $key . "_MIN" } = $min_hash{ $key };
}
- &put_record( $min_record, $fh );
+ put_record( $min_record, $fh );
close $fh;
}
{
$options->{ "visibility" } = "full";
- while ( $record = &get_record( $in ) )
+ while ( $record = get_record( $in ) )
{
- &put_record( $record, $out ) if not $options->{ "no_stream" };
+ put_record( $record, $out ) if not $options->{ "no_stream" };
$record->{ "CHR" } = $record->{ "S_ID" } if not defined $record->{ "CHR" };
$record->{ "CHR_BEG" } = $record->{ "S_BEG" } if not defined $record->{ "CHR_BEG" };
$record->{ "CHR_END" } = $record->{ "S_END" } if not defined $record->{ "CHR_END" };
- $fh_hash{ $record->{ "CHR" } } = &Maasha::Common::write_open( "$BP_TMP/$record->{ 'CHR' }" ) if not exists $fh_hash{ $record->{ "CHR" } };
+ $fh_hash{ $record->{ "CHR" } } = Maasha::Common::write_open( "$BP_TMP/$record->{ 'CHR' }" ) if not exists $fh_hash{ $record->{ "CHR" } };
$fh_out = $fh_hash{ $record->{ "CHR" } };
- &Maasha::UCSC::bed_put_entry( $record, $fh_out, 5 );
+ Maasha::UCSC::bed_put_entry( $record, $fh_out, 5 );
}
map { close $_ } keys %fh_hash;
- $fh_out = &Maasha::Common::write_open( $file );
+ $fh_out = Maasha::Common::write_open( $file );
foreach $chr ( sort keys %fh_hash )
{
- &Maasha::Common::run( "bedSort", "$BP_TMP/$chr $BP_TMP/$chr" );
+ Maasha::Common::run( "bedSort", "$BP_TMP/$chr $BP_TMP/$chr" );
- $fh_in = &Maasha::Common::read_open( "$BP_TMP/$chr" );
+ $fh_in = Maasha::Common::read_open( "$BP_TMP/$chr" );
undef $block;
- while ( $entry = &Maasha::UCSC::bed_get_entry( $fh_in, 5 ) )
+ while ( $entry = Maasha::UCSC::bed_get_entry( $fh_in, 5 ) )
{
$chr = $entry->{ 'CHR' };
$beg = $entry->{ 'CHR_BEG' };
{
if ( $beg > $max )
{
- &Maasha::UCSC::fixedstep_put_entry( $chr, $beg_block, $block, $fh_out );
+ Maasha::UCSC::fixedstep_put_entry( $chr, $beg_block, $block, $fh_out );
undef $block;
}
else
$block->[ $i ] += $clones;
}
- $max = &Maasha::Calc::max( $max, $end );
+ $max = Maasha::Calc::max( $max, $end );
}
}
close $fh_in;
- &Maasha::UCSC::fixedstep_put_entry( $chr, $beg_block, $block, $fh_out );
+ Maasha::UCSC::fixedstep_put_entry( $chr, $beg_block, $block, $fh_out );
unlink "$BP_TMP/$chr";
}
$wib_dir = "$ENV{ 'BP_DATA' }/genomes/$options->{ 'database' }/wib";
- &Maasha::Common::dir_create_if_not_exists( $wib_dir );
+ Maasha::Common::dir_create_if_not_exists( $wib_dir );
- # &Maasha::Common::run( "wigEncode", "$file $wig_file $wib_file > /dev/null 2>&1" );
+ # Maasha::Common::run( "wigEncode", "$file $wig_file $wib_file > /dev/null 2>&1" );
`cd $BP_TMP && wigEncode $file $wig_file $wib_file > /dev/null 2>&1`;
- &Maasha::Common::run( "mv", "$BP_TMP/$wib_file $wib_dir" );
+ Maasha::Common::run( "mv", "$BP_TMP/$wib_file $wib_dir" );
unlink $file;
}
else
{
- $fh_out = &Maasha::Common::write_open( $file );
+ $fh_out = Maasha::Common::write_open( $file );
- while ( $record = &get_record( $in ) )
+ while ( $record = get_record( $in ) )
{
- &put_record( $record, $out ) if not $options->{ "no_stream" };
+ put_record( $record, $out ) if not $options->{ "no_stream" };
if ( $record->{ "REC_TYPE" } eq "PSL" )
{
- &Maasha::UCSC::psl_put_header( $fh_out ) if $first;
- &Maasha::UCSC::psl_put_entry( $record, $fh_out );
+ Maasha::UCSC::psl_put_header( $fh_out ) if $first;
+ Maasha::UCSC::psl_put_entry( $record, $fh_out );
$first = 0;
}
elsif ( $record->{ "REC_TYPE" } eq "BED" )
{
- &Maasha::UCSC::bed_put_entry( $record, $fh_out, $record->{ "BED_COLS" } );
+ Maasha::UCSC::bed_put_entry( $record, $fh_out, $record->{ "BED_COLS" } );
$format = "BED" if not $format;
$columns = $record->{ "BED_COLS" } if not $columns;
}
elsif ( $record->{ "REC_TYPE" } eq "PATSCAN" and $record->{ "CHR" } )
{
- &Maasha::UCSC::bed_put_entry( $record, $fh_out, 6 );
+ Maasha::UCSC::bed_put_entry( $record, $fh_out, 6 );
$format = "BED" if not $format;
$columns = 6 if not $columns;
$format = "BED" if not $format;
$columns = 6 if not $columns;
- &Maasha::UCSC::bed_put_entry( $record, $fh_out );
+ Maasha::UCSC::bed_put_entry( $record, $fh_out );
}
elsif ( $record->{ "REC_TYPE" } eq "VMATCH" and $record->{ "S_ID" } =~ /^chr/i )
{
$format = "BED" if not $format;
$columns = 6 if not $columns;
- &Maasha::UCSC::bed_put_entry( $record, $fh_out, 6 );
+ Maasha::UCSC::bed_put_entry( $record, $fh_out, 6 );
}
if ( $i == $options->{ "chunk_size" } )
close $fh_out;
if ( $format eq "BED" ) {
- &Maasha::UCSC::bed_upload_to_ucsc( $BP_TMP, $file, $options, $append );
+ Maasha::UCSC::bed_upload_to_ucsc( $BP_TMP, $file, $options, $append );
} elsif ( $format eq "PSL" ) {
- &Maasha::UCSC::psl_upload_to_ucsc( $file, $options, $append );
+ Maasha::UCSC::psl_upload_to_ucsc( $file, $options, $append );
}
unlink $file;
$append = 1;
- $fh_out = &Maasha::Common::write_open( $file );
+ $fh_out = Maasha::Common::write_open( $file );
}
$i++;
{
$type = "bed $columns";
- &Maasha::UCSC::bed_upload_to_ucsc( $BP_TMP, $file, $options, $append );
+ Maasha::UCSC::bed_upload_to_ucsc( $BP_TMP, $file, $options, $append );
}
elsif ( $format eq "BED_SS" )
{
$type = "sec_struct";
- &Maasha::UCSC::bed_upload_to_ucsc( $BP_TMP, $file, $options, $append );
+ Maasha::UCSC::bed_upload_to_ucsc( $BP_TMP, $file, $options, $append );
}
elsif ( $format eq "PSL" )
{
$type = "psl";
- &Maasha::UCSC::psl_upload_to_ucsc( $file, $options, $append );
+ Maasha::UCSC::psl_upload_to_ucsc( $file, $options, $append );
}
elsif ( $format eq "WIGGLE" )
{
$type = "wig 0";
- &Maasha::UCSC::wiggle_upload_to_ucsc( $BP_TMP, $wib_dir, $file, $options );
+ Maasha::UCSC::wiggle_upload_to_ucsc( $BP_TMP, $wib_dir, $file, $options );
}
unlink $file;
- &Maasha::UCSC::update_my_tracks( $options, $type );
+ Maasha::UCSC::update_my_tracks( $options, $type );
}
}
my ( $fh );
if ( not -t STDIN ) {
- $fh = &Maasha::Common::read_stdin();
+ $fh = Maasha::Common::read_stdin();
} elsif ( not $path ) {
- &Maasha::Common::error( qq(no data stream) );
+ Maasha::Common::error( qq(no data stream) );
} else {
- $fh = &Maasha::Common::read_open( $path );
+ $fh = Maasha::Common::read_open( $path );
}
# $fh->autoflush(1) if $fh; # Disable file buffer for debugging.
my ( $fh );
if ( $path ) {
- $fh = &Maasha::Common::write_open( $path, $gzip );
+ $fh = Maasha::Common::write_open( $path, $gzip );
} else {
- $fh = &Maasha::Common::write_stdout();
+ $fh = Maasha::Common::write_stdout();
}
return $fh;
# This is a really bad solution, potentially, anyone can include this module and set
# the BP_TMP to point at any dir and thus take out the machine !!!
- &Maasha::Common::dir_remove( $BP_TMP );
+ Maasha::Common::dir_remove( $BP_TMP );
}
exit( 0 );
# This is a really bad solution, potentially, anyone can include this module and set
# the BP_TMP to point at any dir and thus take out the machine !!!
- &Maasha::Common::dir_remove( $BP_TMP );
+ Maasha::Common::dir_remove( $BP_TMP );
}
my ( $data_in, $file, $num, $records, $record );
- while ( $record = &get_record( $in ) ) {
- &put_record( $record, $out );
+ while ( $record = get_record( $in ) ) {
+ put_record( $record, $out );
}
$num = 1;
foreach $file ( @{ $options->{ "files" } } )
{
- $records = &Maasha::NCBI::soft_parse( $file );
+ $records = Maasha::NCBI::soft_parse( $file );
foreach $record ( @{ $records } )
{
- &put_record( $record, $out );
+ put_record( $record, $out );
goto NUM if $options->{ "num" } and $num == $options->{ "num" };