Bio-SeqAlignment-Applications-SequencingSimulators-RNASeq-Polyester

 view release on metacpan or  search on metacpan

README  view on Meta::CPAN

    version 0.02

SYNOPSIS
    polyester_polyA.pl [options]

DESCRIPTION
    The purpose of the application is to enhance the polyester RNA
    sequencing simulation tool by including polyA tails in the reference RNA
    being used to generate the simulated sequencing data. The application is
    a wrapper around the R package polyester, which only accounts for the
    processes of fragmentation, reverse complementation and sequencing when
    generating data. Note that the Perl application does not (at this
    moment) include the possibility of passing logspline R objects as
    parameters to the R script and the the polyester "simulate_experiment"
    function. The command line options are the same as the ones in the
    polyester R package, with the exception of: * The addition of the
    --taildist option, which is mandatory and specifies the tail
    distribution to be used. * The addition of the --distparams option,
    which is mandatory and specifies the parameters of the distribution. *
    The addition of the --maxseqs option, which is optional and specifies
    whether to break the single fasta file generated by the application into

README  view on Meta::CPAN


    --errorrate, -E [FLOAT]
        Error probability (optional).

    --fastafile, -f [PATH]
        Fasta file path (mandatory).

    --fcfile, -c [PATH]
        Fold change file path (optional).

    --fraglen, -F [INTEGER]
        Fragment length (average) (optional).

    --fragsd, -S [INTEGER]
        Fragment length (standard deviation) (optional).

    --gcbias, -g [INTEGER]
        GC bias (optional).

    --modformat, -m [INTEGER]
        Case insensitive format for storing modifications (one of JSON,
        YAML, or MessagePack) (optional).

    --maxseqs, -m [INTEGER]

README  view on Meta::CPAN

        Strand specificity (optional).

    --taildist, -t [STRING]
        Tail distribution (mandatory).

    --writeinfo, -w [INTEGER]
        Save simulation info (optional).

EXAMPLES
      polyester_polyA.pl --fastafile myseq.fasta --taildist gamma \
      --distparams 125.0 1.0 0.0 250.0 --fraglen 100 --fragsd 10 \
      --numreps 1 --strandspec TRUE --readlen 75 --paired F \
      --maxseqs 1000 --modformat YAML --outdir /path/to/output

TODO
    *   Add the possibility of passing logspline R objects as parameters to
        the R script and the polyester "simulate_experiment" function.

    *   Add the possibility of adding UMI tags to sequences.

    *   Add the possibility of adding sequencing adapters to sequences.

SEE ALSO
    *   polyester <https://github.com/alyssafrazee/polyester>

        Polyester is an R package designed to simulate RNA sequencing
        experiments with differential transcript expression.Given a set of
        annotated transcripts, Polyester will simulate the steps of an
        RNA-seq experiment (fragmentation, reverse-complementing, and
        sequencing) and produce files containing simulated RNA-seq reads.
        Simulated reads can be analyzed using your choice of downstream
        analysis tools. Polyester has a built-in wrapper function to
        simulate a case/control experiment with differential transcript
        expression and biological replicates. Users are able to set the
        levels of differential expression at transcripts of their choosing.
        This means they know which transcripts are differentially expressed
        in the simulated dataset, so accuracy of statistical methods for
        differential expression detection can be analyzed.

bin/polyester.R  view on Meta::CPAN

library(utils)

################################################################################
## Specify command line arguments
spec = matrix(c( 
## Column 1  : long option name
## Column 2  : short option name
## Column 3  : 0 : no argument, 1 : required argument 2 : optional argument
## Column 4  : one of logical, integer, double, complex, character
  
  'bias'       , 'b' , 2,  'character' ,  ## fragment selection bias
  'errormodel' , 'e' , 2 , 'character' ,  ## error model
  'errorrate'  , 'E' , 2 , 'double'    ,  ## error probability
  'fastafile'  , 'f' , 1 , 'character' ,  ## fasta file (path)
  'fcfile'     , 'c' , 2 , 'character' ,  ## fold change (path)
  'gcbias'     , 'g' , 2 , 'integer'   ,  ## gc bias
  'numreps'    , 'n' , 2 , 'character' ,  ## num of replicates in each group
  'outdir'     , 'o' , 2 , 'character' ,  ## path to output directory
  'paired'     , 'p' , 2 , 'logical' ,    ## paired reads
  'readsfile'  , 'r' , 1 , 'character' ,  ## reads_per_transcript (path)
  'readlen'    , 'R' , 2 , 'integer'   ,  ## read length
  'fraglen'    , 'F' , 2 , 'integer'   ,  ## fragment length (avg)
  'fragsd'     , 'S' , 2 , 'integer'   ,  ## fragment length (sd)
  'seed'       , 'd' , 2 , 'integer'   ,  ## random seed
  'strandspec' , 's' , 2 , 'logical'   ,  ## strand specificity
  'writeinfo'  , 'w' , 2 , 'logical'      ## save simulation info? 
),byrow=TRUE,ncol = 4)

################################################################################
## process commandline arguments

opt = getopt(spec)

bin/polyester.R  view on Meta::CPAN

}
if(is.null(opt$readsfile)) {
  cat("No transcript read count file provided. Will exit now.")
  quit(save="no",status=1)
}

## (sensible?) default for some optional parameters
if(is.null(opt$bias)) opt$bias <- 'none'
if(is.null(opt$errormodel)) opt$errormodel <- 'uniform'
if(is.null(opt$errorrate))  opt$errorrate <- 0.005
if(is.null(opt$fraglen))    opt$fraglen <-250
if(is.null(opt$fragsd))     opt$fragsd <-25
if(is.null(opt$gcbias))     opt$gcbias <- 0
if(is.null(opt$outdir))     opt$outdir <- '.'
if(is.null(opt$paired))     opt$paired <- FALSE
if(is.null(opt$readlen))    opt$readlen <- 100
if(is.null(opt$seed))       opt$seed <- 12345
if(is.null(opt$strandspec)) opt$strandspec <- FALSE
if(is.null(opt$writeinfo))  opt$writeinfo <- TRUE
## defaults for some options that may be included in the future
if(is.null(opt$distr))      opt$distr <- 'normal'
if(is.null(opt$meanmodel))  opt$meanmodel <- FALSE

bin/polyester.R  view on Meta::CPAN

  fold_changes = fold_changes,
  paired = opt$paired,
  error_rate = opt$errorrate,
  gcbias = opt$gcbias,
  strand_specific = opt$strandspec,
  meanmodel = opt$meanmodel,
  writeinfo = opt$writeinfo,
  seed = opt$seed,
  readlen = opt$readlen,
  distr = opt$distr,
  fraglen = opt$fraglen,
  fragsd = opt$fragsd
)

bin/polyester_polyA.pl  view on Meta::CPAN

my $fastafile;
my $fcfile;
my $gcbias;
my $max_sequences_per_file = 0;         ## default is to not split the files
my $modformat              = 'YAML';    ## default format is 'YAML
my @numreps;
my $outdir;
my $paired;
my $readsfile;
my $readlen;
my $fraglen;
my $fragsd;
my $seed;
my $strandspec;
my $taildist;
my $writeinfo;

# Configure Getopt::Long
GetOptions(
    'bias|b:s'           => \$bias, # fragment selection bias (optional, string)
    'distparams|P=f{1,}' => \@distparams
    ,    # distribution parameters (mandatory, list of numeric values)
    'errormodel|e:s' => \$errormodel,   # error model (optional, string)
    'errorrate|E:f'  => \$errorrate,    # error probability (optional, float)
    'fastafile|f=s'  => \$fastafile,    # fasta file (path) (mandatory, strings)
    'fcfile|c:s'     => \$fcfile,       # fold change (path) (optional, string)
    'fraglen|F:i'    => \$fraglen,   # fragment length (avg) (optional, integer)
    'fragsd|S:i'     => \$fragsd,    # fragment length (sd) (optional, integer)
    'gcbias|g:i'     => \$gcbias,    # gc bias (optional, integer)
    'maxseqs|m:i'    => \$max_sequences_per_file,    # max sequences per file
    'modformat|M:s'  => \$modformat
    , # case insensitive format for storing modifications (one of JSON, YAML, or MessagePack)
    'numreps|n:i{,}' =>
      \@numreps,    # num of replicates in each group (optional, list)
    'outdir|o:s' => \$outdir,  # path to output directory (optional, string)
    'paired|p:s' => \$paired,  # paired reads (TRUE or FALSE) (optional, string)
    'readlen|R:i'   => \$readlen,    # read length (optional, integer)
    'readsfile|r:s' =>

bin/polyester_polyA.pl  view on Meta::CPAN

    errormodel => $errormodel,
    errorrate  => $errorrate,
    fastafile  => $fastafile,
    fcfile     => $fcfile,
    gcbias     => $gcbias,
    numreps    => \@numreps,
    outdir     => $outdir,
    paired     => $paired,
    readsfile  => $readsfile,
    readlen    => $readlen,
    fraglen    => $fraglen,
    fragsd     => $fragsd,
    seed       => $seed,
    strandspec => $strandspec,
    writeinfo  => $writeinfo
);

## Pipeline Segment 6 : store the modifications into a file for future use
my $mod_fname = store_modifications(
    mods        => $modifications_HoH,
    bioseq_file => $fastafile,
    format      => $modformat

bin/polyester_polyA.pl  view on Meta::CPAN

    my $errormodel         = $polyester_params{errormodel};
    my $errorrate          = $polyester_params{errorrate};
    my $fastafile          = $polyester_params{fastafile};
    my $fcfile             = $polyester_params{fcfile};
    my $gcbias             = $polyester_params{gcbias};
    my $numreps            = $polyester_params{numreps};
    my $outdir             = $polyester_params{outdir};
    my $paired             = $polyester_params{paired};
    my $readsfile          = $polyester_params{readsfile};
    my $readlen            = $polyester_params{readlen};
    my $fraglen            = $polyester_params{fraglen};
    my $fragsd             = $polyester_params{fragsd};
    my $seed               = $polyester_params{seed};
    my $strandspec         = $polyester_params{strandspec};
    my $writeinfo          = $polyester_params{writeinfo};

    my $r_command =
      "Rscript --vanilla --slave --default-packages=getopt,polyester,utils "
      . File::Spec->catfile( $Bin, "polyester.R" );

## Add the options to the R command
    $r_command .= " --bias \"$bias\""             if defined $bias;
    $r_command .= " --errormodel \"$errormodel\"" if defined $errormodel;
    $r_command .= " --errorrate $errorrate"       if defined $errorrate;
    $r_command .= " --fastafile \"$fastafile\"";
    $r_command .= " --fcfile \"$fcfile\""      if defined $fcfile;
    $r_command .= " --gcbias $gcbias"          if defined $gcbias;
    $r_command .= " --numreps \"@{$numreps}\"" if $numreps;
    $r_command .= " --outdir \"$outdir\""      if defined $outdir;
    $r_command .= " --paired $paired"          if defined $paired;
    $r_command .= " --readsfile \"$readsfile\"";
    $r_command .= " --readlen $readlen"       if defined $readlen;
    $r_command .= " --fraglen $fraglen"       if defined $fraglen;
    $r_command .= " --fragsd $fragsd"         if defined $fragsd;
    $r_command .= " --seed $seed"             if defined $seed;
    $r_command .= " --strandspec $strandspec" if defined $strandspec;
    $r_command .= " --writeinfo $writeinfo"   if defined $writeinfo;

## Execute the R command
    system($r_command);
}

__END__

lib/Bio/SeqAlignment/Applications/SequencingSimulators/RNASeq/Polyester.pm  view on Meta::CPAN


=head1 SYNOPSIS

polyester_polyA.pl [options]

=head1 DESCRIPTION

The purpose of the application is to enhance the polyester RNA sequencing
simulation tool by including polyA tails in the reference RNA being used to
generate the simulated  sequencing data. The application is a wrapper around
the R package polyester, which only accounts for the processes of fragmentation,
reverse complementation and sequencing when generating data. 
Note that the Perl application does not (at this moment) include the possibility
of passing logspline R objects as parameters to the R script and the the 
polyester "simulate_experiment" function.
The command line options are the same as the ones in the polyester R package,
with the exception of:
* The addition of the --taildist option, which is mandatory and specifies
the tail distribution to be used.
* The addition of the --distparams option, which is mandatory and specifies
the parameters of the distribution.

lib/Bio/SeqAlignment/Applications/SequencingSimulators/RNASeq/Polyester.pm  view on Meta::CPAN

Error probability (optional).

=item B<--fastafile, -f> [PATH]

Fasta file path (mandatory).

=item B<--fcfile, -c> [PATH]

Fold change file path (optional).

=item B<--fraglen, -F> [INTEGER]

Fragment length (average) (optional).

=item B<--fragsd, -S> [INTEGER]

Fragment length (standard deviation) (optional).

=item B<--gcbias, -g> [INTEGER]

GC bias (optional).

=item B<--modformat, -m> [INTEGER]

Case insensitive format for storing modifications 

lib/Bio/SeqAlignment/Applications/SequencingSimulators/RNASeq/Polyester.pm  view on Meta::CPAN


=item B<--writeinfo, -w> [INTEGER]

Save simulation info (optional).

=back

=head1 EXAMPLES

  polyester_polyA.pl --fastafile myseq.fasta --taildist gamma \
  --distparams 125.0 1.0 0.0 250.0 --fraglen 100 --fragsd 10 \
  --numreps 1 --strandspec TRUE --readlen 75 --paired F \
  --maxseqs 1000 --modformat YAML --outdir /path/to/output

=head1 TODO

=over 4

=item * 

Add the possibility of passing logspline R objects as parameters to the

lib/Bio/SeqAlignment/Applications/SequencingSimulators/RNASeq/Polyester.pm  view on Meta::CPAN

=back 

=head1 SEE ALSO

=over 4

=item * L<polyester|https://github.com/alyssafrazee/polyester>

Polyester is an R package designed to simulate RNA sequencing experiments with
differential transcript expression.Given a set of annotated transcripts, 
Polyester will simulate the steps of an RNA-seq experiment (fragmentation, 
reverse-complementing, and sequencing) and produce files containing simulated 
RNA-seq reads. Simulated reads can be analyzed using your choice of downstream 
analysis tools.
Polyester has a built-in wrapper function to simulate a case/control experiment 
with differential transcript expression and biological replicates. Users are 
able to set the levels of differential expression at transcripts of their 
choosing. This means they know which transcripts are differentially expressed 
in the simulated dataset, so accuracy of statistical methods for differential 
expression detection can be analyzed.



( run in 1.275 second using v1.01-cache-2.11-cpan-364913b4093 )