Bio-Roary

 view release on metacpan or  search on metacpan

lib/Bio/Roary/CommandLine/RoaryCoreAlignment.pm  view on Meta::CPAN

    if ( defined($core_definition) ) 
	{
		if($core_definition > 1)
		{
			$self->core_definition( $core_definition/100 );
		}
		else
		{
			$self->core_definition( $core_definition );
		}
	}
    $self->dont_delete_files($dont_delete_files) if ( defined($dont_delete_files) );
    
}

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

    ( !$self->help ) or die $self->usage_text;
    if ( defined( $self->_error_message ) ) {
        print $self->_error_message . "\n";
        die $self->usage_text;
    }

	$self->logger->info("Extract core genes from spreadsheet");
    my $core_genes_obj = Bio::Roary::ExtractCoreGenesFromSpreadsheet->new( 
        spreadsheet     => $self->spreadsheet_filename,
        core_definition => $self->core_definition,
		allow_paralogs => $self->allow_paralogs
    );
	
	$self->logger->info("Looking up genes in files");
    my $gene_files = Bio::Roary::LookupGeneFiles->new(
        multifasta_directory => $self->multifasta_base_directory,
        ordered_genes        => $core_genes_obj->ordered_core_genes,
      );
	 
	$self->logger->info("Merge multifasta alignments");
    my $merge_alignments_obj = Bio::Roary::MergeMultifastaAlignments->new(
	  sample_names          => $core_genes_obj->sample_names,
      multifasta_files      => $gene_files->ordered_gene_files(),
      output_filename       => $self->output_filename,
	  sample_names_to_genes => $core_genes_obj->sample_names_to_genes
    );
    $merge_alignments_obj->merge_files;
    
    if($self->dont_delete_files == 0)
    {
      remove_tree('pan_genome_sequences');
    }
}

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

    return <<USAGE;
Usage: pan_genome_core_alignment [options]
Create an alignment of core genes from the spreadsheet and the directory of gene multi-FASTAs.

Options: -o STR    output filename [core_gene_alignment.aln]
         -cd FLOAT percentage of isolates a gene must be in to be core [99]
         -m STR    directory containing gene multi-FASTAs [pan_genome_sequences]
         -s STR    gene presence and absence spreadsheet [gene_presence_absence.csv]
         -p        allow paralogs
         -z        dont delete intermediate files
         -v        verbose output to STDOUT
         -h        this help message

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::RoaryCoreAlignment - Take in the group statistics spreadsheet and the location of the gene multifasta files and create a core alignment.

=head1 VERSION

version 3.13.0

=head1 SYNOPSIS

Take in the group statistics spreadsheet and the location of the gene multifasta files and create a core alignment.

=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

=cut



( run in 1.858 second using v1.01-cache-2.11-cpan-d8267643d1d )