Bio-Align-Subset
view release on metacpan or search on metacpan
lib/Bio/Align/Subset.pm view on Meta::CPAN
my $subset = [1,12,25,34,65,100,153,156,157,158,159,160,200,201,202,285];
# Create the object
my $obj = Bio::Align::Subset->new(
file => $filename,
format => $format
);
# View the result
# This function returns a Bio::SimpleAlign object
print Dumper($obj->build_subset($subset));
=cut
=head1 DESCRIPTION
Given an array of codon positions and an alignment, the function
L<Bio::Align::Subset-E<gt>build_subset> returns a new alignment with the codons at
those positions from the original alignment.
=cut
# Body ########################################################################
###############################################################################
###############################################################################
###############################################################################
=head1 CONSTRUCTOR
=head2 Bio::Align::Subset->new()
$Obj = Bio::Align::Subset->new(file => 'filename', format => 'format')
The L<new> class method constructs a new L<Bio::Align::Subset> object.
The returned object can be used to retrieve, print and generate subsets
from alignment objects. L<new> accepts the following parameters:
=over 1
=item file
A file path to be opened for reading or writing. The usual Perl
conventions apply:
'file' # open file for reading
'>file' # open file for writing
'>>file' # open file for appending
'+<file' # open file read/write
'command |' # open a pipe from the command
'| command' # open a pipe to the command
=item format
Specify the format of the file. Supported formats include fasta,
genbank, embl, swiss (SwissProt), Entrez Gene and tracefile formats
such as abi (ABI) and scf. There are many more, for a complete listing
see the SeqIO HOWTO (L<http://bioperl.open-bio.org/wiki/HOWTO:SeqIO>).
If no format is specified and a filename is given then the module will
attempt to deduce the format from the filename suffix. If there is no
suffix that Bioperl understands then it will attempt to guess the
format based on file content. If this is unsuccessful then SeqIO will
throw a fatal error.
The format name is case-insensitive: 'FASTA', 'Fasta' and 'fasta' are
all valid.
Currently, the tracefile formats (except for SCF) require installation
of the external Staden "io_lib" package, as well as the
Bio::SeqIO::staden::read package available from the bioperl-ext
repository.
=back
=cut
###############################################################################
# Class data and methods
###############################################################################
{
# A list of all attributes wiht default values and read/write/required properties
my %_attribute_properties = (
_file => ["????", "read.required"],
_format => ["????", "read.required"],
_identifiers => ["????", "read.write" ],
_sequences => ["????", "read.write" ],
_seq_length=> [0 , "read.write" ]
);
# Global variable to keep count of existing objects
my $_count = 0;
# The list of all attributes
sub _all_attributes {
keys %_attribute_properties;
}
# Check if a given property is set for a given attribute
sub _permissions{
my ($self,$attribute, $permissions) = @_;
$_attribute_properties{$attribute}[1] =~/$permissions/;
}
# Return the default value for a given attribute
sub _attribute_default{
my ($self,$attribute) = @_;
$_attribute_properties{$attribute}[0];
}
# Manage the count of existing objects
sub get_count{
$_count;
}
sub _incr_count{
++$_count;
}
sub _decr_count{
--$_count;
}
}
( run in 2.189 seconds using v1.01-cache-2.11-cpan-39bf76dae61 )