}
-# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> DOTPLOT <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-
-
-sub dotplot_matches
-{
- # Martin A. Hansen, August 2007.
-
- # Generates a dotplot from a list of matches using Gnuplot.
-
- my ( $matches, # list of hashrefs.
- $options, # options hash
- $tmp_dir, # temporary directory
- ) = @_;
-
- # Returns list.
-
- my ( $forward_file, $backward_file, $pid, $fh_forward, $fh_backward,
- $fh_in, $fh_out, $cmd, $match, $line, @lines, $q_max, $s_max );
-
- $tmp_dir ||= $ENV{ 'BP_TMP' };
-
- $forward_file = "$tmp_dir/match_f.tab";
- $backward_file = "$tmp_dir/match_r.tab";
-
- $fh_forward = Maasha::Filesys::file_write_open( $forward_file );
- $fh_backward = Maasha::Filesys::file_write_open( $backward_file );
-
- $q_max = 0;
- $s_max = 0;
-
- foreach $match ( @{ $matches } )
- {
- if ( $match->{ "DIR" } =~ /^f/ )
- {
- print $fh_forward join( "\t", $match->{ "Q_BEG" } + 1, $match->{ "S_BEG" } + 1 ), "\n";
- print $fh_forward join( "\t", $match->{ "Q_END" } + 1, $match->{ "S_END" } + 1 ), "\n";
- print $fh_forward "\n\n";
- }
- else
- {
- print $fh_backward join( "\t", $match->{ "Q_BEG" } + 1, $match->{ "S_END" } + 1 ), "\n";
- print $fh_backward join( "\t", $match->{ "Q_END" } + 1, $match->{ "S_BEG" } + 1 ), "\n";
- print $fh_backward "\n\n";
- }
-
- $q_max = $match->{ "Q_END" } if $match->{ "Q_END" } > $q_max;
- $s_max = $match->{ "S_END" } if $match->{ "S_END" } > $s_max;
- }
-
- $q_max++;
- $s_max++;
-
- close $fh_forward;
- close $fh_backward;
-
- $options->{ "terminal" } ||= "dumb";
-
- $cmd = "gnuplot";
-
- $pid = open2( $fh_out, $fh_in, $cmd );
-
- print $fh_in "set terminal $options->{ 'terminal' }\n";
- print $fh_in "set xrange [1:$q_max]\n";
- print $fh_in "set yrange [1:$s_max]\n";
- print $fh_in "set title \"$options->{ 'title' }\"\n" if $options->{ "title" };
- print $fh_in "set xlabel \"$options->{ 'xlabel' }\"\n" if $options->{ "xlabel" };
- print $fh_in "set ylabel \"$options->{ 'ylabel' }\"\n" if $options->{ "ylabel" };
- print $fh_in "unset key\n";
-
- if ( $options->{ "terminal" } ne "dumb" )
- {
- print $fh_in "set style line 1 linetype 1 linecolor rgb \"green\" linewidth 2 pointtype 6 pointsize default\n";
- print $fh_in "set style line 2 linetype 1 linecolor rgb \"red\" linewidth 2 pointtype 6 pointsize default\n";
- }
-
- print $fh_in "set xtics border out\n";
- print $fh_in "set ytics border out\n";
- print $fh_in "set grid\n";
-
- if ( $options->{ "direction" } =~ /^b/ ) {
- print $fh_in qq(plot "$forward_file" with lines ls 1, "$backward_file" with lines ls 2\n);
- } elsif ( $options->{ "direction" } =~ /^f/ ) {
- print $fh_in qq(plot "$forward_file" with lines ls 1\n);
- } elsif ( $options->{ "direction" } =~ /^r/ ) {
- print $fh_in qq(plot "$backward_file" with lines ls 2\n);
- }
-
- close $fh_in;
-
- while ( $line = <$fh_out> )
- {
- chomp $line;
-
- push @lines, $line;
- }
-
- close $fh_out;
-
- waitpid $pid, 0;
-
- unlink $forward_file;
- unlink $backward_file;
-
- return wantarray ? @lines : \@lines;
-}
-
-
# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> KARYOGRAM <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
my ( $karyo_file, $svg, $features, $karyo );
- if ( $options->{ "genome" } eq "human" )
+ if ( $options->{ "genome" } eq "hg18" )
{
- $karyo_file = "/Users/m.hansen/maasha/perl_scripts/biopieces/karyo_data/human_cytobands.txt";
-# $karyo_file = "/home/m.hansen/maasha/perl_scripts/biopieces/karyo_data/human_cytobands.txt";
+ $karyo_file = $ENV{ 'BP_DIR' } . "/bp_data/human_cytobands.txt";
}
- else
+ elsif( $options->{ "genome" } eq "mm9" )
{
- $karyo_file = "/Users/m.hansen/maasha/perl_scripts/biopieces/karyo_data/mouse_cytobands.txt";
- # $karyo_file = "/home/m.hansen/maasha/perl_scripts/biopieces/karyo_data/mouse_cytobands.txt";
+ $karyo_file = $ENV{ 'BP_DIR' } . "/bp_data/mouse_cytobands.txt";
}
$karyo = parse_karyo_data( $karyo_file );
map { $_->[ 0 ] *= $factor; $_->[ 1 ] *= $factor } @{ $feat_list->{ $feat } };
}
- @list = sort { $A = $a; $B = $b; $A =~ s/chr//; $B =~ s/chr//; $A <=> $B } keys %{ $karyo_list };
+# @list = sort { $A = $a; $B = $b; $A =~ s/chr//; $B =~ s/chr//; $A <=> $B } keys %{ $karyo_list };
- splice @list, 0, 2;
- push @list, "chrX", "chrY";
+# splice @list, 0, 2;
+# push @list, "chrX", "chrY";
$i = 0;