BioPerl
view release on metacpan or search on metacpan
Bio/Assembly/Tools/ContigSpectrum.pm view on Meta::CPAN
print "The contig spectrum from assembly is ".$from_assembly->to_string."\n";
# Report advanced information (possible because eff_asm_params = 1)
print "Average sequence length: ".$from_assembly->avg_seq_len." bp\n";
print "Minimum overlap length: ".$from_assembly->min_overlap." bp\n";
print "Average overlap length: ".$from_assembly->avg_overlap." bp\n";
print "Minimum overlap match: ".$from_assembly->min_identity." %\n";
print "Average overlap match: ".$from_assembly->avg_identity." %\n";
# Assuming the assembly object contains sequences from several different
# metagenomes, we have a mixed contig spectrum from which a cross contig
# spectrum and dissolved contig spectra can be obtained
my $mixed_csp = $from_assembly;
# Calculate a dissolved contig spectrum
my $meta1_dissolved = Bio::Assembly::Tools::ContigSpectrum->new(
-dissolve => [$mixed_csp, 'metagenome1'] );
my $meta2_dissolved = Bio::Assembly::Tools::ContigSpectrum->new(
-dissolve => [$mixed_csp, 'metagenome2'] );
print "The dissolved contig spectra are:\n".
$meta1_dissolved->to_string."\n".
$meta2_dissolved->to_string."\n";
# Determine a cross contig spectrum
my $cross_csp = Bio::Assembly::Tools::ContigSpectrum->new(
-cross => $mixed_csp );
print "The cross contig spectrum is ".$cross_csp->to_string."\n";
# Score a contig spectrum (the more abundant the contigs and the larger their
# size, the larger the score)
my $csp_score = $csp->score( $csp->nof_seq );
=head1 DESCRIPTION
The Bio::Assembly::Tools::ContigSpectrum Perl module enables to
manually create contig spectra, import them from assemblies,
manipulate them, transform between different types of contig spectra
and output them.
Bio::Assembly::Tools::ContigSpectrum is a module to create, manipulate
and output contig spectra, assembly-derived data used in metagenomics
(community genomics) for diversity estimation.
=head2 Background
A contig spectrum is the count of the number of contigs of different
size in an assembly. For example, the contig spectrum [100 5 1 0 0
...] means that there were 100 singlets (1-contigs), 5 contigs of 2
sequences (2-contigs), 1 contig of 3 sequences (3-contig) and no
larger contigs.
An assembly can be produced from a mixture of sequences from different
metagenomes. The contig obtained from this assembly is a mixed contig
spectrum. The contribution of each metagenome in this mixed contig
spectrum can be obtained by determining a dissolved contig spectrum.
Finally, based on a mixed contig spectrum, a cross contig spectrum can
be determined. In a cross contig spectrum, only contigs containing
sequences from different metagenomes are kept; "pure" contigs are
excluded. Additionally, the total number of singletons (1-contigs)
from each region that assembles with any fragments from other regions
is the number of 1-contigs in the cross contig spectrum.
=head2 Implementation
The simplest representation of a contig spectrum is as a hash
representation where the key is the contig size (number of sequences
making up the contig) and the value the number of contigs of this
size.
In fact, it is useful to have more information associated with the
contig spectrum, hence the Bio::Assembly::Tools::ContigSpectrum module
implements an object containing a contig spectrum hash and additional
information. The get/set methods to access them are:
id contig spectrum ID
nof_rep number of repetitions (assemblies) used
max_size size of (number of sequences in) the largest contig
spectrum hash representation of a contig spectrum
nof_seq number of sequences
avg_seq_len average sequence length
eff_asm_params reports effective assembly parameters
nof_overlaps number of overlaps (needs eff_asm_params)
min_overlap minimum overlap length in a contig (needs eff_asm_params)
min_identity minimum sequence identity percentage (needs eff_asm_params)
avg_overlap average overlap length (needs eff_asm_params)
avg_identity average overlap identity percentage (needs eff_asm_params)
Operations on the contig spectra:
to_string create a string representation of the spectrum
spectrum import a hash contig spectrum
assembly determine a contig spectrum from an assembly, contig or singlet
dissolve calculate a dissolved contig spectrum (depends on assembly)
cross produce a cross contig spectrum (depends on assembly)
add add a contig spectrum to an existing one
average make an average of several contig spectra
score score a contig spectrum: the higher the number of contigs
and the larger their size, the higher the score.
When using operations that rely on knowing "where" (from what
metagenomes) a sequence came from (i.e. when creating a dissolved or
cross contig spectrum), make sure that the sequences used for the
assembly have a name header, e.g. E<gt>metagenome1|seq1,
E<gt>metagenome2|seq1, ...
Note: The following operations require the C<Graph::Undirected> module:
eff_asm_params, cross, dissolve
=head1 FEEDBACK
=head2 Mailing Lists
User feedback is an integral part of the evolution of this and other
Bioperl modules. Send your comments and suggestions preferably to the
Bioperl mailing lists Your participation is much appreciated.
bioperl-l@bioperl.org - General discussion
( run in 1.097 second using v1.01-cache-2.11-cpan-364913b4093 )