CLIPSeqTools
view release on metacpan or search on metacpan
lib/CLIPSeqTools/PlotApp/nucleotide_composition.pm view on Meta::CPAN
=head1 NAME
CLIPSeqTools::PlotApp::nucleotide_composition - Create plots for script
nucleotide_composition.
=head1 SYNOPSIS
clipseqtools-plot nucleotide_composition [options/parameters]
=head1 DESCRIPTION
Create plots for script nucleotide_composition.
=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::nucleotide_composition;
$CLIPSeqTools::PlotApp::nucleotide_composition::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 => 'file with long gaps distribution.',
);
#######################################################################
########################## 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 . 'nucleotide_composition.pdf';
# Start R
my $R = Statistics::R->new();
# Pass arguments to R
$R->set('ifile', $self->file);
$R->set('figfile', $figfile);
# Disable scientific notation
$R->run(q{options(scipen=999)});
( run in 0.516 second using v1.01-cache-2.11-cpan-39bf76dae61 )