CLIPSeqTools
view release on metacpan or search on metacpan
lib/CLIPSeqTools/PlotApp/libraries_relative_read_density.pm view on Meta::CPAN
=head1 NAME
CLIPSeqTools::PlotApp::libraries_relative_read_density - Create plots for
script libraries_relative_read_density.
=head1 SYNOPSIS
clipseqtools-plot libraries_relative_read_density [options/parameters]
=head1 DESCRIPTION
Create plots for script libraries_relative_read_density.
=head1 OPTIONS
Input.
--file <Str> input file.
Output
--o_prefix <Str> output path prefix. Script will create and add
extension to path. [Default: ./]
-v --verbose print progress lines and extra information.
-h -? --usage --help print help message
=cut
package CLIPSeqTools::PlotApp::libraries_relative_read_density;
$CLIPSeqTools::PlotApp::libraries_relative_read_density::VERSION = '1.0.0';
# Make it an app command
use MooseX::App::Command;
extends 'CLIPSeqTools::PlotApp';
#######################################################################
####################### Load External modules #####################
#######################################################################
use Modern::Perl;
use autodie;
use namespace::autoclean;
use Statistics::R;
#######################################################################
####################### Command line options ######################
#######################################################################
option 'file' => (
is => 'rw',
isa => 'Str',
required => 1,
documentation => 'input file.',
);
#######################################################################
########################## Consume Roles ##########################
#######################################################################
with
"CLIPSeqTools::Role::Option::OutputPrefix" => {
-alias => { validate_args => '_validate_args_for_output_prefix' },
-excludes => 'validate_args',
};
#######################################################################
######################## Interface Methods ########################
#######################################################################
sub validate_args {
my ($self) = @_;
$self->_validate_args_for_output_prefix;
}
sub run {
my ($self) = @_;
warn "Validating arguments\n" if $self->verbose;
$self->validate_args();
warn "Creating output path\n" if $self->verbose;
$self->make_path_for_output_prefix();
warn "Creating plots with R\n" if $self->verbose;
$self->run_R;
}
sub run_R {
my ($self) = @_;
my $figfile = $self->o_prefix . 'libraries_relative_read_density.pdf';
# Start R
my $R = Statistics::R->new();
# Pass arguments to R
$R->set('ifile', $self->file);
$R->set('figfile', $figfile);
# Read table with data
$R->run(q{idata = read.delim(ifile)});
( run in 0.587 second using v1.01-cache-2.11-cpan-39bf76dae61 )