-#!/usr/bin/env perl
+#!/usr/bin/env perl -w
+
+# Copyright (C) 2007-2009 Martin A. Hansen.
+
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+# http://www.gnu.org/copyleft/gpl.html
+
+
+# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> DESCRIPTION <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
+
+# Extract alignments from a multiple genome alignment.
+
+# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
+
-use warnings;
use strict;
+use Maasha::Biopieces;
+use Maasha::Common;
+use Maasha::UCSC;
+use Maasha::Filesys;
+
+
+# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
+
+
+my ( $run_time_beg, $run_time_end, $options, $in, $out, $record, $tmp_dir, $maf_track, $align, $align_num, $beg, $end, $len, $entry );
+
+$options = Maasha::Biopieces::parse_options(
+ [
+ { long => 'genome', short => 'g', type => 'genome', mandatory => 'yes', default => undef, allowed => undef, disallowed => undef },
+ { long => 'chr', short => 'c', type => 'string', mandatory => 'no', default => undef, allowed => undef, disallowed => undef },
+ { long => 'beg', short => 'b', type => 'uint', mandatory => 'no', default => undef, allowed => undef, disallowed => 0 },
+ { long => 'end', short => 'e', type => 'uint', mandatory => 'no', default => undef, allowed => undef, disallowed => 0 },
+ { long => 'len', short => 'l', type => 'uint', mandatory => 'no', default => undef, allowed => undef, disallowed => 0 },
+ { long => 'strand', short => 's', type => 'string', mandatory => 'no', default => '+', allowed => '+,-', disallowed => undef },
+ ]
+);
+
+$in = Maasha::Biopieces::read_stream( $options->{ "stream_in" } );
+$out = Maasha::Biopieces::write_stream( $options->{ "stream_out" } );
+
+$tmp_dir = Maasha::Biopieces::get_tmpdir();
+
+$align_num = 1;
+
+$maf_track = maf_track( $options->{ "genome" } );
+
+if ( $options->{ "chr" } and $options->{ "beg" } and ( $options->{ "end" } or $options->{ "len" } ) )
+{
+ $beg = $options->{ "beg" } - 1;
+
+ if ( $options->{ "end" } ) {
+ $end = $options->{ "end" };
+ } elsif ( $options->{ "len" } ) {
+ $end = $beg + $options->{ "len" };
+ }
+
+ $align = Maasha::UCSC::maf_extract( $tmp_dir, $options->{ "genome" }, $maf_track, $options->{ "chr" }, $beg, $end, $options->{ "strand" } );
+
+ foreach $entry ( @{ $align } )
+ {
+ $entry->{ "CHR" } = $record->{ "CHR" };
+ $entry->{ "CHR_BEG" } = $record->{ "CHR_BEG" };
+ $entry->{ "CHR_END" } = $record->{ "CHR_END" };
+ $entry->{ "STRAND" } = $record->{ "STRAND" } || '+';
+ $entry->{ "Q_ID" } = $record->{ "Q_ID" };
+ $entry->{ "SCORE" } = $record->{ "SCORE" };
+
+ Maasha::Biopieces::put_record( $entry, $out );
+ }
+}
+
+while ( $record = Maasha::Biopieces::get_record( $in ) )
+{
+ if ( $record->{ "REC_TYPE" } eq "BED" )
+ {
+ $align = Maasha::UCSC::maf_extract( $tmp_dir, $options->{ "genome" }, $maf_track, $record->{ "CHR" }, $record->{ "CHR_BEG" }, $record->{ "CHR_END" }, $record->{ "STRAND" } );
+ }
+ elsif ( $record->{ "REC_TYPE" } eq "VMATCH" )
+ {
+ $align = Maasha::UCSC::maf_extract( $tmp_dir, $options->{ "genome" }, $maf_track, $record->{ "S_ID" }, $record->{ "S_BEG" }, $record->{ "S_END" } + 1, $record->{ "STRAND" } );
+ }
+ elsif ( $record->{ "REC_TYPE" } eq "PSL" )
+ {
+ $align = Maasha::UCSC::maf_extract( $tmp_dir, $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( $tmp_dir, $options->{ "genome" }, $maf_track, $record->{ "S_ID" }, $record->{ "S_BEG" }, $record->{ "S_END" }, $record->{ "STRAND" } );
+ }
+
+ foreach $entry ( @{ $align } )
+ {
+ $entry->{ "CHR" } = $record->{ "CHR" };
+ $entry->{ "CHR_BEG" } = $record->{ "CHR_BEG" };
+ $entry->{ "CHR_END" } = $record->{ "CHR_END" };
+ $entry->{ "STRAND" } = $record->{ "STRAND" };
+ $entry->{ "Q_ID" } = $record->{ "Q_ID" };
+ $entry->{ "SCORE" } = $record->{ "SCORE" };
+
+ Maasha::Biopieces::put_record( $entry, $out );
+ }
+
+ $align_num++;
+}
+
+Maasha::Filesys::dir_remove( $tmp_dir );
+
+
+# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> SUBROUTINES <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
+
+
+sub maf_track
+{
+ # Martin A. Hansen, April 2008.
+
+ # Given a genome returns the corresponding mafTrack database table name.
+
+ my ( $genome, # genome to lookup.
+ ) = @_;
+
+ # Returns a string.
+
+ my ( %hash );
+
+ # The below has should be in a config file - fix later.
+
+ %hash = (
+ danRer4 => 'multiz7way',
+ dm2 => 'multiz15way',
+ dm3 => 'multiz15way',
+ fr2 => 'multiz7way',
+ galGal3 => 'multiz7way',
+ gasAcu1 => 'multiz7way',
+ hg18 => 'multiz17way',
+ mm8 => 'multiz17way',
+ mm9 => 'multiz17way',
+ oryLat1 => 'multiz7way',
+ panTro2 => 'multiz17way',
+ tetNig1 => 'multiz7way',
+ );
+
+ Maasha::Common::error( qw(multiz track not found) ) if not exists $hash{ $genome };
+
+ return $hash{ $genome };
+}
+
+
+# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
+
+
+BEGIN
+{
+ $run_time_beg = Maasha::Biopieces::run_time();
+
+ Maasha::Biopieces::log_biopiece();
+}
+
+
+END
+{
+ Maasha::Biopieces::close_stream( $in );
+ Maasha::Biopieces::close_stream( $out );
+
+ $run_time_end = Maasha::Biopieces::run_time();
+
+ Maasha::Biopieces::run_time_print( $run_time_beg, $run_time_end, $options );
+}
+
+
+# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
+
+
+__END__
-use Maasha::BioRun;
-#!/usr/bin/env perl
+#!/usr/bin/env perl -w
+
+# Copyright (C) 2007-2009 Martin A. Hansen.
+
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+# http://www.gnu.org/copyleft/gpl.html
+
+
+# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> DESCRIPTION <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
+
+# Extract phastcons scores from a specified genome.
+
+# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
+
-use warnings;
use strict;
+use Maasha::Biopieces;
+use Maasha::Filesys;
+use Maasha::UCSC;
+
+
+# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
+
+
+my ( $run_time_beg, $run_time_end, $options, $in, $out, $phastcons_file, $phastcons_index, $index, $fh_phastcons, $scores, $record );
+
+$options = Maasha::Biopieces::parse_options(
+ [
+ { long => 'genome', short => 'g', type => 'genome', mandatory => 'yes', default => undef, allowed => undef, disallowed => undef },
+ { long => 'chr', short => 'c', type => 'string', mandatory => 'no', default => undef, allowed => undef, disallowed => undef },
+ { long => 'beg', short => 'b', type => 'uint', mandatory => 'no', default => undef, allowed => undef, disallowed => 0 },
+ { long => 'end', short => 'e', type => 'uint', mandatory => 'no', default => undef, allowed => undef, disallowed => 0 },
+ { long => 'len', short => 'l', type => 'uint', mandatory => 'no', default => undef, allowed => undef, disallowed => 0 },
+ { long => 'flank', short => 'f', type => 'uint', mandatory => 'no', default => 0, allowed => undef, disallowed => undef },
+ ]
+);
+
+$in = Maasha::Biopieces::read_stream( $options->{ "stream_in" } );
+$out = Maasha::Biopieces::write_stream( $options->{ "stream_out" } );
+
+$phastcons_file = "$ENV{ 'BP_DATA' }/genomes/$options->{ 'genome' }/phastcons/$options->{ 'genome' }.pp";
+$phastcons_index = "$ENV{ 'BP_DATA' }/genomes/$options->{ 'genome' }/phastcons/$options->{ 'genome' }.pp.index";
+
+$index = Maasha::UCSC::fixedstep_index_retrieve( $phastcons_index );
+$fh_phastcons = Maasha::Filesys::file_read_open( $phastcons_file );
+
+if ( defined $options->{ "chr" } and defined $options->{ "beg" } and ( defined $options->{ "end" } or defined $options->{ "len" } ) )
+{
+ $options->{ "beg" } -= 1; # request is 1-based
+ $options->{ "end" } -= 1; # request is 1-based
+
+ if ( $options->{ "len" } ) {
+ $options->{ "end" } = $options->{ "beg" } + $options->{ "len" } - 1;
+ }
+
+ $scores = Maasha::UCSC::fixedstep_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->{ "CHR_END" } = $options->{ "end" } + $options->{ "flank" };
+
+ $record->{ "PHASTCONS" } = join ",", @{ $scores };
+ $record->{ "PHAST_COUNT" } = scalar @{ $scores }; # DEBUG
+
+ Maasha::Biopieces::put_record( $record, $out );
+}
+
+while ( $record = Maasha::Biopieces::get_record( $in ) )
+{
+ if ( $record->{ "REC_TYPE" } eq "BED" )
+ {
+ $scores = Maasha::UCSC::fixedstep_index_lookup( $index, $fh_phastcons, $record->{ "CHR" }, $record->{ "CHR_BEG" }, $record->{ "CHR_END" }, $options->{ "flank" } );
+ }
+ elsif ( $record->{ "REC_TYPE" } eq "PSL" )
+ {
+ $scores = Maasha::UCSC::fixedstep_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::fixedstep_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
+
+ Maasha::Biopieces::put_record( $record, $out );
+}
+
+close $fh_phastcons if $fh_phastcons;
+
+
+# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
+
+
+BEGIN
+{
+ $run_time_beg = Maasha::Biopieces::run_time();
+
+ Maasha::Biopieces::log_biopiece();
+}
+
+
+END
+{
+ Maasha::Biopieces::close_stream( $in );
+ Maasha::Biopieces::close_stream( $out );
+
+ $run_time_end = Maasha::Biopieces::run_time();
+
+ Maasha::Biopieces::run_time_print( $run_time_beg, $run_time_end, $options );
+}
+
+
+# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
+
+
+__END__
-use Maasha::BioRun;
$options = Maasha::Biopieces::parse_options(
[
- { long => 'genome', short => 'g', type => 'genome', mandatory => 'no', default => undef, allowed => undef, disallowed => undef },
- { long => 'chr', short => 'c', type => 'string', mandatory => 'no', default => undef, allowed => undef, disallowed => undef },
- { long => 'beg', short => 'b', type => 'uint', mandatory => 'no', default => undef, allowed => undef, disallowed => 0 },
- { long => 'end', short => 'e', type => 'uint', mandatory => 'no', default => undef, allowed => undef, disallowed => 0 },
- { long => 'len', short => 'l', type => 'uint', mandatory => 'no', default => undef, allowed => undef, disallowed => 0 },
- { long => 'flank', short => 'f', type => 'uint', mandatory => 'no', default => 0, allowed => undef, disallowed => undef },
- { long => 'mask', short => 'm', type => 'flag', mandatory => 'no', default => undef, allowed => undef, disallowed => undef },
- { long => 'splice', short => 's', type => 'flag', mandatory => 'no', default => undef, allowed => undef, disallowed => undef },
+ { long => 'genome', short => 'g', type => 'genome', mandatory => 'yes', default => undef, allowed => undef, disallowed => undef },
+ { long => 'chr', short => 'c', type => 'string', mandatory => 'no', default => undef, allowed => undef, disallowed => undef },
+ { long => 'beg', short => 'b', type => 'uint', mandatory => 'no', default => undef, allowed => undef, disallowed => 0 },
+ { long => 'end', short => 'e', type => 'uint', mandatory => 'no', default => undef, allowed => undef, disallowed => 0 },
+ { long => 'len', short => 'l', type => 'uint', mandatory => 'no', default => undef, allowed => undef, disallowed => 0 },
+ { long => 'flank', short => 'f', type => 'uint', mandatory => 'no', default => 0, allowed => undef, disallowed => undef },
+ { long => 'mask', short => 'm', type => 'flag', mandatory => 'no', default => undef, allowed => undef, disallowed => undef },
+ { long => 'splice', short => 's', type => 'flag', mandatory => 'no', default => undef, allowed => undef, disallowed => undef },
]
);
if ( $script eq "print_usage" ) { script_print_usage( $in, $out, $options ) }
elsif ( $script eq "complexity_seq" ) { script_complexity_seq( $in, $out, $options ) }
- elsif ( $script eq "get_genome_align" ) { script_get_genome_align( $in, $out, $options ) }
- elsif ( $script eq "get_genome_phastcons" ) { script_get_genome_phastcons( $in, $out, $options ) }
close $in if defined $in;
close $out;
data_in|i=s
);
}
- elsif ( $script eq "get_genome_align" )
- {
- @options = qw(
- genome|g=s
- chr|c=s
- beg|b=s
- end|e=s
- len|l=s
- strand|s=s
- );
- }
- elsif ( $script eq "get_genome_phastcons" )
- {
- @options = qw(
- genome|g=s
- chr|c=s
- beg|b=s
- end|e=s
- len|l=s
- flank|f=s
- );
- }
push @options, qw(
stream_in|I=s
}
}
- Maasha::Common::error( qq(no --genome specified) ) if $script =~ /get_genome_align|get_genome_phastcons/ and not $options{ "genome" };
return wantarray ? %options : \%options;
}
}
-sub script_get_genome_align
-{
- # Martin A. Hansen, April 2008.
-
- # Gets a subalignment from a multiple genome alignment.
-
- my ( $in, # handle to in stream
- $out, # handle to out stream
- $options, # options hash
- ) = @_;
-
- # Returns nothing.
-
- my ( $record, $maf_track, $align, $align_num, $beg, $end, $len, $entry );
-
- $options->{ "strand" } ||= "+";
-
- $align_num = 1;
-
- $maf_track = Maasha::Config::maf_track( $options->{ "genome" } );
-
- if ( $options->{ "chr" } and $options->{ "beg" } and ( $options->{ "end" } or $options->{ "len" } ) )
- {
- $beg = $options->{ "beg" } - 1;
-
- if ( $options->{ "end" } ) {
- $end = $options->{ "end" };
- } elsif ( $options->{ "len" } ) {
- $end = $beg + $options->{ "len" };
- }
-
- $align = Maasha::UCSC::maf_extract( $BP_TMP, $options->{ "genome" }, $maf_track, $options->{ "chr" }, $beg, $end, $options->{ "strand" } );
-
- foreach $entry ( @{ $align } )
- {
- $entry->{ "CHR" } = $record->{ "CHR" };
- $entry->{ "CHR_BEG" } = $record->{ "CHR_BEG" };
- $entry->{ "CHR_END" } = $record->{ "CHR_END" };
- $entry->{ "STRAND" } = $record->{ "STRAND" } || '+';
- $entry->{ "Q_ID" } = $record->{ "Q_ID" };
- $entry->{ "SCORE" } = $record->{ "SCORE" };
-
- Maasha::Biopieces::put_record( $entry, $out );
- }
- }
-
- while ( $record = Maasha::Biopieces::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" } );
- }
- elsif ( $record->{ "REC_TYPE" } eq "VMATCH" )
- {
- $align = Maasha::UCSC::maf_extract( $BP_TMP, $options->{ "genome" }, $maf_track, $record->{ "S_ID" }, $record->{ "S_BEG" }, $record->{ "S_END" } + 1, $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" } );
- }
- 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" } );
- }
-
- foreach $entry ( @{ $align } )
- {
- $entry->{ "CHR" } = $record->{ "CHR" };
- $entry->{ "CHR_BEG" } = $record->{ "CHR_BEG" };
- $entry->{ "CHR_END" } = $record->{ "CHR_END" };
- $entry->{ "STRAND" } = $record->{ "STRAND" };
- $entry->{ "Q_ID" } = $record->{ "Q_ID" };
- $entry->{ "SCORE" } = $record->{ "SCORE" };
-
- Maasha::Biopieces::put_record( $entry, $out );
- }
-
- $align_num++;
- }
-}
-
-
-sub script_get_genome_phastcons
-{
- # Martin A. Hansen, February 2008.
-
- # Get phastcons scores from genome intervals.
-
- my ( $in, # handle to in stream
- $out, # handle to out stream
- $options, # options hash
- ) = @_;
-
- # Returns nothing.
-
- my ( $phastcons_file, $phastcons_index, $index, $fh_phastcons, $scores, $record );
-
- $options->{ "flank" } ||= 0;
-
- $phastcons_file = Maasha::Config::genome_phastcons( $options->{ "genome" } );
- $phastcons_index = Maasha::Config::genome_phastcons_index( $options->{ "genome" } );
-
- $index = Maasha::UCSC::fixedstep_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->{ "beg" } -= 1; # request is 1-based
- $options->{ "end" } -= 1; # request is 1-based
-
- if ( $options->{ "len" } ) {
- $options->{ "end" } = $options->{ "beg" } + $options->{ "len" } - 1;
- }
-
- $scores = Maasha::UCSC::fixedstep_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->{ "CHR_END" } = $options->{ "end" } + $options->{ "flank" };
-
- $record->{ "PHASTCONS" } = join ",", @{ $scores };
- $record->{ "PHAST_COUNT" } = scalar @{ $scores }; # DEBUG
-
- Maasha::Biopieces::put_record( $record, $out );
- }
-
- while ( $record = Maasha::Biopieces::get_record( $in ) )
- {
- if ( $record->{ "REC_TYPE" } eq "BED" )
- {
- $scores = Maasha::UCSC::fixedstep_index_lookup( $index, $fh_phastcons, $record->{ "CHR" }, $record->{ "CHR_BEG" }, $record->{ "CHR_END" }, $options->{ "flank" } );
- }
- elsif ( $record->{ "REC_TYPE" } eq "PSL" )
- {
- $scores = Maasha::UCSC::fixedstep_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::fixedstep_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
-
- Maasha::Biopieces::put_record( $record, $out );
- }
-
- close $fh_phastcons if $fh_phastcons;
-}
-
-
# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
1;
}
-sub genome_phastcons
-{
- # Martin A. Hansen, January 2008.
-
- # Returns the full path to the location of a concatenated
- # PhastCons file for a given genome.
-
- my ( $genome, # requested genome
- ) = @_;
-
- # Returns a string.
-
- my $file = "$BP_DATA/genomes/$genome/phastcons/$genome.pp";
-
- return $file;
-}
-
-
-sub genome_phastcons_index
-{
- # Martin A. Hansen, January 2008.
-
- # Returns the full path to the location of a PhastCons index
- # for a given genome.
-
- my ( $genome, # requested genome
- ) = @_;
-
- # Returns a string.
-
- my $file = "$BP_DATA/genomes/$genome/phastcons/$genome.pp.index";
-
- return $file;
-}
-
-
sub genomes
{
# Martin A. Hansen, February 2008.
}
-sub maf_track
-{
- # Martin A. Hansen, April 2008.
-
- # Given a genome returns the corresponding mafTrack database table name.
-
- my ( $genome, # genome to lookup.
- ) = @_;
-
- # Returns a string.
-
- my ( %hash );
-
- # The below has should be in a config file - fix later.
-
- %hash = (
- danRer4 => 'multiz7way',
- dm2 => 'multiz15way',
- dm3 => 'multiz15way',
- fr2 => 'multiz7way',
- galGal3 => 'multiz7way',
- gasAcu1 => 'multiz7way',
- hg18 => 'multiz17way',
- mm8 => 'multiz17way',
- mm9 => 'multiz17way',
- oryLat1 => 'multiz7way',
- panTro2 => 'multiz17way',
- tetNig1 => 'multiz7way',
- );
-
- Maasha::Common::error( qw(multiz track not found) ) if not exists $hash{ $genome };
-
- return $hash{ $genome };
-}
-
-
# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
1;