Bio-Roary
view release on metacpan or search on metacpan
lib/Bio/Roary/CommandLine/Roary.pm view on Meta::CPAN
print "\nPlease cite Roary if you use any of the results it produces:
Andrew J. Page, Carla A. Cummins, Martin Hunt, Vanessa K. Wong, Sandra Reuter, Matthew T. G. Holden, Maria Fookes, Daniel Falush, Jacqueline A. Keane, Julian Parkhill,
\"Roary: Rapid large-scale prokaryote pan genome analysis\", Bioinformatics, 2015 Nov 15;31(22):3691-3693
doi: http://doi.org/10.1093/bioinformatics/btv421
Pubmed: 26198102\n\n";
$self->help($help) if ( defined($help) );
if( $self->help )
{
print $self->usage_text;
return;
}
if ( defined($verbose) ) {
$self->verbose($verbose);
$self->logger->level(10000);
}
$self->check_dependancies($check_dependancies) if ( defined($check_dependancies) );
if ($self->check_dependancies) {
my $check_tools = Bio::Roary::External::CheckTools->new();
$check_tools->check_all_tools;
$self->logger->error( "Roary version " . $self->_version() );
if( @{ $self->args } < 1 )
{
return;
}
}
if ( @{ $self->args } < 2 ) {
$self->logger->error("Error: You need to provide at least 2 files to build a pan genome");
die $self->usage_text;
}
my %basenames;
foreach my $string (@{$self->args}) {
my($base, $path, $suf) = fileparse($string);
next unless $basenames{$base}++;
$self->logger->error("Error: GFF files must have unique basenames.");
die $self->usage_text;
}
if ( @{ $self->args } < 2 ) {
$self->logger->error("Error: You need to provide at least 2 files to build a pan genome");
die $self->usage_text;
}
$self->output_filename($output_filename) if ( defined($output_filename) );
$self->job_runner($job_runner) if ( defined($job_runner) );
$self->makeblastdb_exec($makeblastdb_exec) if ( defined($makeblastdb_exec) );
$self->blastp_exec($blastp_exec) if ( defined($blastp_exec) );
$self->mcxdeblast_exec($mcxdeblast_exec) if ( defined($mcxdeblast_exec) );
$self->mcl_exec($mcl_exec) if ( defined($mcl_exec) );
$self->cpus($cpus) if ( defined($cpus) );
$self->inflation_value($inflation_value) if ( defined($inflation_value));
if ( defined($perc_identity) ) {
$self->perc_identity($perc_identity);
if ( $perc_identity < 50 ) {
$self->logger->error(
"The percentage identity is too low. Either something is wrong with your data, like contamination, or your doing something that the software isnt designed to support."
);
}
}
$self->mafft($mafft) if ( defined($mafft) );
$self->apply_unknowns_filter($apply_unknowns_filter)
if ( defined($apply_unknowns_filter) );
if ( defined($output_multifasta_files) ) {
if ( which('prank') ) {
$self->output_multifasta_files($output_multifasta_files);
}
else {
if ( which('mafft') ) {
$self->output_multifasta_files($output_multifasta_files);
$self->mafft(1);
$self->logger->warn("PRANK not found in your PATH so using MAFFT instead to generate multiFASTA alignments.");
}
else {
$self->logger->warn("PRANK (or MAFFT) not found in your PATH so cannot generate multiFASTA alignments, skipping for now.");
}
}
}
$self->dont_delete_files($dont_delete_files) if ( defined($dont_delete_files) );
$self->dont_split_groups($dont_split_groups) if ( defined($dont_split_groups) );
$self->dont_create_rplots(0) if ( defined($create_rplots) );
$self->verbose_stats($verbose_stats) if ( defined $verbose_stats );
$self->translation_table($translation_table) if ( defined($translation_table) );
$self->group_limit($group_limit) if ( defined($group_limit) );
$self->kraken_db($kraken_db) if ( defined($kraken_db) );
$self->output_directory($output_directory) if ( defined($output_directory) );
if ( defined $verbose_stats && defined($output_multifasta_files) ) {
$self->verbose_stats(0);
$self->logger->warn("The verbose stats spreadsheet is not compatible with the core gene alignement so disabling verbose_stats");
}
if ( defined($run_qc) ) {
if ( which('kraken') && which('kraken-report') ) {
$self->run_qc($run_qc);
}
else {
$self->logger->warn("kraken or kraken-report not found in your PATH so cannot run QC, skipping for now.");
}
}
if ( $self->cpus > 1 ) {
$self->job_runner('Parallel');
}
$self->core_definition( $core_definition / 100 ) if ( defined($core_definition) );
for my $filename ( @{ $self->args } ) {
if ( !-e $filename ) {
$self->logger->error("Error: Cant access file $filename");
die $self->usage_text;
}
push( @{ $self->fasta_files }, abs_path($filename) );
}
lib/Bio/Roary/CommandLine/Roary.pm view on Meta::CPAN
if ( $self->run_qc ) {
$self->logger->info("Running Kraken on each input assembly");
my $qc_input_files = Bio::Roary::QC::Report->new(
input_files => $self->fasta_files,
job_runner => $self->job_runner,
cpus => $self->cpus,
verbose => $self->verbose,
kraken_db => $self->kraken_db
);
$qc_input_files->report;
}
my $pan_genome_obj = Bio::Roary->new(
input_files => $self->fasta_files,
fasta_files => $prepare_input_files->fasta_files,
output_filename => $self->output_filename,
job_runner => $self->job_runner,
cpus => $self->cpus,
makeblastdb_exec => $self->makeblastdb_exec,
blastp_exec => $self->blastp_exec,
output_multifasta_files => $self->output_multifasta_files,
perc_identity => $self->perc_identity,
dont_delete_files => $self->dont_delete_files,
dont_create_rplots => $self->dont_create_rplots,
dont_split_groups => $self->dont_split_groups,
verbose_stats => $self->verbose_stats,
translation_table => $self->translation_table,
group_limit => $self->group_limit,
core_definition => $self->core_definition,
verbose => $self->verbose,
mafft => $self->mafft,
allow_paralogs => $self->allow_paralogs,
inflation_value => $self->inflation_value,
);
$pan_genome_obj->run();
chdir( $self->_original_directory );
}
sub _version {
my ($self) = @_;
if ( defined($Bio::Roary::CommandLine::Roary::VERSION) ) {
return $Bio::Roary::CommandLine::Roary::VERSION . "\n";
}
else {
return "x.y.z\n";
}
}
sub usage_text {
my ($self) = @_;
return <<USAGE;
Usage: roary [options] *.gff
Options: -p INT number of threads [1]
-o STR clusters output filename [clustered_proteins]
-f STR output directory [.]
-e create a multiFASTA alignment of core genes using PRANK
-n fast core gene alignment with MAFFT, use with -e
-i minimum percentage identity for blastp [95]
-cd FLOAT percentage of isolates a gene must be in to be core [99]
-qc generate QC report with Kraken
-k STR path to Kraken database for QC, use with -qc
-a check dependancies and print versions
-b STR blastp executable [blastp]
-c STR mcl executable [mcl]
-d STR mcxdeblast executable [mcxdeblast]
-g INT maximum number of clusters [50000]
-m STR makeblastdb executable [makeblastdb]
-r create R plots, requires R and ggplot2
-s dont split paralogs
-t INT translation table [11]
-ap allow paralogs in core alignment
-z dont delete intermediate files
-v verbose output to STDOUT
-w print version and exit
-y add gene inference information to spreadsheet, doesnt work with -e
-iv STR Change the MCL inflation value [1.5]
-h this help message
Example: Quickly generate a core gene alignment using 8 threads
roary -e --mafft -p 8 *.gff
For further info see: http://sanger-pathogens.github.io/Roary/
USAGE
}
__PACKAGE__->meta->make_immutable;
no Moose;
1;
__END__
=pod
=encoding UTF-8
=head1 NAME
Bio::Roary::CommandLine::Roary - Take in FASTA files of proteins and cluster them
=head1 VERSION
version 3.13.0
=head1 SYNOPSIS
Take in FASTA files of proteins and cluster them
=head1 AUTHOR
Andrew J. Page <ap13@sanger.ac.uk>
=head1 COPYRIGHT AND LICENSE
This software is Copyright (c) 2013 by Wellcome Trust Sanger Institute.
This is free software, licensed under:
The GNU General Public License, Version 3, June 2007
( run in 1.435 second using v1.01-cache-2.11-cpan-b16cb0d3907 )