Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Kraken QC #125

Merged
merged 9 commits into from
May 21, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ ls Roary-*
```

###Add to your Environment

Add the following lines to your $HOME/.bashrc file, or to /etc/profile.d/roary.sh to make it available to all users:

```
Expand All @@ -55,3 +54,15 @@ export PERL5LIB=$PERL5LIB:$HOME/Roary-x.x.x/lib
```
cpanm Array::Utils BioPerl Exception::Class File::Find::Rule File::Grep File::Slurp::Tiny Graph Moose Moose::Role Text::CSV Log::Log4perl File::Which
```

#When things go wrong
###cdhit seg faults
Old versions of cdhit have a bug, so you need to use at least version 4.6.1. The cdhit packages for Ubuntu 12.04 seem to be effected, so [installing from the source](http://cd-hit.org/) is the only option.

###I installed the homebrew Kraken package and now theres an error when I run the tests or QC
Theres a bug and you'll need to [install it from source](https://ccb.jhu.edu/software/kraken/) on older versions of OSX (like Mountain Lion).

###Why dont you bundle a Kraken database for the QC?
Its massive (2.7GB) and changes as RefSeq is updated. The [authors](https://ccb.jhu.edu/software/kraken/) have prebuilt databases and details about how to make your own.


7 changes: 6 additions & 1 deletion dist.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name = Bio-Roary
version = 2.2.1
version = 2.2.2
author = Andrew J. Page <[email protected]>
license = GPL_3
copyright_holder = Wellcome Trust Sanger Institute
Expand Down Expand Up @@ -32,5 +32,10 @@ requires = parallel
[Encoding]
filename = t/data/expected_set_difference_common_set_plot.png
filename = t/data/expected_set_difference_unique_set_two_plot.png
filename = t/data/kraken_test/database.idx
filename = t/data/kraken_test/database.jdb
filename = t/data/kraken_test/database.kdb
filename = t/data/kraken_test/taxonomy/names.dmp
filename = t/data/kraken_test/taxonomy/nodes.dmp

encoding = bytes
5 changes: 4 additions & 1 deletion lib/Bio/Roary/CommandLine/CreatePanGenome.pm
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,11 @@ sub usage_text {
# Include full annotation and inference in group statistics
create_pan_genome --verbose_stats *.gff

# Increase the groups/clusters limit (default 50,000). Please check the QC results before running this
# Increase the groups/clusters limit (default 50,000). Please check the QC results before running this!
create_pan_genome --group_limit 60000 *.gff

# Use a different Kraken database
roary -k /path/to/kraken_database/ *.gff

# This help message
create_pan_genome -h
Expand Down
10 changes: 7 additions & 3 deletions lib/Bio/Roary/CommandLine/Roary.pm
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ has 'translation_table' => ( is => 'rw', isa => 'Int', default => 11 );
has 'group_limit' => ( is => 'rw', isa => 'Num', default => 50000 );
has 'core_definition' => ( is => 'rw', isa => 'Num', default => 1 );
has 'verbose' => ( is => 'rw', isa => 'Bool', default => 0 );
has 'kraken_db' => ( is => 'rw', isa => 'Str', default => '/lustre/scratch108/pathogen/pathpipe/kraken/minikraken_20140330/' );

has 'run_qc' => ( is => 'rw', isa => 'Bool', default => 0 );

Expand All @@ -51,7 +52,7 @@ sub BUILD {
$max_threads, $dont_delete_files, $dont_split_groups, $perc_identity, $output_filename,
$job_runner, $makeblastdb_exec, $mcxdeblast_exec, $mcl_exec, $blastp_exec,
$apply_unknowns_filter, $cpus, $output_multifasta_files, $verbose_stats, $translation_table,
$run_qc, $core_definition, $help
$run_qc, $core_definition, $help, $kraken_db,
);

GetOptionsFromArray(
Expand All @@ -76,6 +77,7 @@ sub BUILD {
'dont_run_qc' => \$dont_run_qc,
'cd|core_definition=i' => \$core_definition,
'v|verbose' => \$verbose,
'k|kraken_db=s' => \$kraken_db,
'h|help' => \$help,
);

Expand Down Expand Up @@ -119,6 +121,7 @@ sub BUILD {
$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) );


if ( defined($run_qc) ) {
Expand Down Expand Up @@ -167,7 +170,8 @@ sub run {
input_files => $self->fasta_files,
job_runner => $self->job_runner,
cpus => $self->cpus,
verbose => $self->verbose
verbose => $self->verbose,
kraken_db => $self->kraken_db
);
$qc_input_files->report;
}
Expand Down Expand Up @@ -238,7 +242,7 @@ sub usage_text {

# Generate QC report detailing top genus and species for each assembly
# Requires Kraken to be installed
roary -qc *.gff
roary -k /path/to/kraken_database/ -qc *.gff

# This help message
roary -h
Expand Down
18 changes: 18 additions & 0 deletions lib/Bio/Roary/JobRunner/Local.pm
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,17 @@ package Bio::Roary::JobRunner::Local;
=cut

use Moose;
use Log::Log4perl qw(:easy);

has 'commands_to_run' => ( is => 'ro', isa => 'ArrayRef', required => 1 );
has 'logger' => ( is => 'ro', lazy => 1, builder => '_build_logger');
has 'verbose' => ( is => 'rw', isa => 'Bool', default => 0 );

sub run {
my ($self) = @_;

for my $command_to_run ( @{ $self->commands_to_run } ) {
$self->logger->info($command_to_run);
system($command_to_run );
}
1;
Expand All @@ -36,9 +40,23 @@ sub _construct_dependancy_params

sub submit_dependancy_job {
my ( $self,$command_to_run) = @_;
$self->logger->info($command_to_run);
system($command_to_run );
}

sub _build_logger
{
my ($self) = @_;
my $level = $ERROR;
if($self->verbose)
{
$level = $DEBUG;
}
Log::Log4perl->easy_init($level);
my $logger = get_logger();
return $logger;
}

no Moose;
__PACKAGE__->meta->make_immutable;

Expand Down
21 changes: 21 additions & 0 deletions lib/Bio/Roary/JobRunner/Parallel.pm
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,20 @@ package Bio::Roary::JobRunner::Parallel;
use Moose;
use File::Slurp::Tiny qw(read_file write_file);
use File::Temp qw/ tempfile /;
use Log::Log4perl qw(:easy);

has 'commands_to_run' => ( is => 'ro', isa => 'ArrayRef', required => 1 );
has 'cpus' => ( is => 'ro', isa => 'Int', default => 1 );
has 'logger' => ( is => 'ro', lazy => 1, builder => '_build_logger');
has 'verbose' => ( is => 'rw', isa => 'Bool', default => 0 );

sub run {
my ($self) = @_;

for my $command_to_run(@{ $self->commands_to_run })
{
$self->logger->info($command_to_run);
}
open(my $fh,"|-","parallel -j ".$self->cpus) || die "GNU Parallel failed";
print $fh join("\n", @{ $self->commands_to_run });
close $fh;
Expand All @@ -39,9 +46,23 @@ sub _construct_dependancy_params

sub submit_dependancy_job {
my ( $self,$command_to_run) = @_;
$self->logger->info($command_to_run);
system($command_to_run );
}

sub _build_logger
{
my ($self) = @_;
my $level = $ERROR;
if($self->verbose)
{
$level = $DEBUG;
}
Log::Log4perl->easy_init($level);
my $logger = get_logger();
return $logger;
}

no Moose;
__PACKAGE__->meta->make_immutable;

Expand Down
8 changes: 7 additions & 1 deletion lib/Bio/Roary/JobRunner/Role.pm
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,17 @@ has '_queue' => ( is => 'rw', isa => 'Str', default => 'normal
has 'dont_wait' => ( is => 'rw', isa => 'Bool', default => 0 );
has 'cpus' => ( is => 'ro', isa => 'Int', default => 1 );
has 'logger' => ( is => 'ro', lazy => 1, builder => '_build_logger');
has 'verbose' => ( is => 'rw', isa => 'Bool', default => 0 );

sub _build_logger
{
my ($self) = @_;
Log::Log4perl->easy_init($ERROR);
my $level = $ERROR;
if($self->verbose)
{
$level = $DEBUG;
}
Log::Log4perl->easy_init($level);
my $logger = get_logger();
return $logger;
}
Expand Down
106 changes: 0 additions & 106 deletions lib/Bio/Roary/QC/Kraken.pm

This file was deleted.

Loading