LICENSE

Copyright [1999-2015] Wellcome Trust Sanger Institute and the EMBL-European Bioinformatics Institute Copyright [2016-2024] EMBL-European Bioinformatics Institute

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

CONTACT

Please email comments or questions to the public Ensembl
developers list at <http://lists.ensembl.org/mailman/listinfo/dev>.

Questions may also be sent to the Ensembl help desk at
<http://www.ensembl.org/Help/Contact>.

NAME

Bio::EnsEMBL::CircularSlice - Arbitary Slice of a genome

SYNOPSIS

$sa = $db->get_SliceAdaptor;

$slice =
  $sa->fetch_by_region( 'chromosome', 'X', 1_000_000, 2_000_000 );

# get some attributes of the slice
my $seqname = $slice->seq_region_name();
my $start   = $slice->start();
my $end     = $slice->end();

# get the sequence from the slice
my $seq = $slice->seq();

# get some features from the slice
foreach $gene ( @{ $slice->get_all_Genes } ) {
  # do something with a gene
}

foreach my $feature ( @{ $slice->get_all_DnaAlignFeatures } ) {
  # do something with dna-dna alignments
}

DESCRIPTION

A Slice object represents a region of a genome. It can be used to retrieve sequence or features from an area of interest.

METHODS

new

Arg [...]  : List of named arguments
             Bio::EnsEMBL::CoordSystem COORD_SYSTEM
             string SEQ_REGION_NAME,
             int    START,
             int    END,
             int    SEQ_REGION_LENGTH, (optional)
             string SEQ (optional)
             int    STRAND, (optional, defaults to 1)
             Bio::EnsEMBL::DBSQL::SliceAdaptor ADAPTOR (optional)
Example    :

  $slice =
    Bio::EnsEMBL::CircularSlice->new( -coord_system      => $cs,
                                      -start             => 1,
                                      -end               => 10000,
                                      -strand            => 1,
                                      -seq_region_name   => 'X',
                                      -seq_region_length => 12e6,
                                      -adaptor => $slice_adaptor );

Description: Creates a new slice object.  A slice represents a
             region of sequence in a particular coordinate system.
             Slices can be used to retrieve sequence and features
             from an area of interest in a genome.

             Coordinates start at 1 and are inclusive.  Negative
             coordinates or coordinates exceeding the length of
             the seq_region are permitted.  Start must be less
             than or equal. to end regardless of the strand.

             Slice objects are immutable. Once instantiated their
             attributes (with the exception of the adaptor) may
             not be altered.  To change the attributes a new slice
             must be created.

Returntype : Bio::EnsEMBL::CircularSlice
Exceptions : throws if start, end, coordsystem or seq_region_name not
             specified or not of the correct type
Caller     : general, Bio::EnsEMBL::SliceAdaptor
Status     : Stable

centrepoint

Arg [1]    : none
Example    : $cp = $slice->centrepoint();
Description: Returns the mid position of this slice relative to the
             start of the sequence region that it was created on.
             Coordinates are inclusive and start at 1.
Returntype : int
Exceptions : none
Caller     : general
Status     : Stable

length

Arg [1]    : none
Example    : $length = $slice->length();
Description: Returns the length of this slice in basepairs
Returntype : int
Exceptions : none
Caller     : general
Status     : Stable

seq

Arg [1]    : none
Example    : print "SEQUENCE = ", $slice->seq();
Description: Returns the sequence of the region represented by this
             slice formatted as a string.
Returntype : string
Exceptions : none
Caller     : general
Status     : Stable

subseq

Arg  [1]   : int $startBasePair
             relative to start of slice, which is 1.
Arg  [2]   : int $endBasePair
             relative to start of slice.
Arg  [3]   : (optional) int $strand
             The strand of the slice to obtain sequence from. Default
             value is 1.
Description: returns string of dna sequence
Returntype : txt
Exceptions : end should be at least as big as start
             strand must be set
Caller     : general
Status     : Stable

expand

Arg [1]    : (optional) int $five_prime_expand
             The number of basepairs to shift this slices five_prime
             coordinate by.  Positive values make the slice larger,
             negative make the slice smaller.
             coordinate left.
             Default = 0.
Arg [2]    : (optional) int $three_prime_expand
             The number of basepairs to shift this slices three_prime
             coordinate by. Positive values make the slice larger,
             negative make the slice smaller.
             Default = 0.
Arg [3]    : (optional) bool $force_expand
             if set to 1, then the slice will be contracted even in the case 
             when shifts $five_prime_expand and $three_prime_expand overlap. 
             In that case $five_prime_expand and $three_prime_expand will be set 
             to a maximum possible number and that will result in the slice 
             which would have only 2pbs.
             Default = 0.
Arg [4]    : (optional) int* $fpref
             The reference to a number of basepairs to shift this slices five_prime
             coordinate by. Normally it would be set to $five_prime_expand. 
             But in case when $five_prime_expand shift can not be applied and 
             $force_expand is set to 1, then $$fpref will contain the maximum possible
             shift
Arg [5]    : (optional) int* $tpref
             The reference to a number of basepairs to shift this slices three_prime
             coordinate by. Normally it would be set to $three_prime_expand. 
             But in case when $five_prime_expand shift can not be applied and 
             $force_expand is set to 1, then $$tpref will contain the maximum possible
             shift
Example    : my $expanded_slice      = $slice->expand( 1000, 1000);
             my $contracted_slice    = $slice->expand(-1000,-1000);
             my $shifted_right_slice = $slice->expand(-1000, 1000);
             my $shifted_left_slice  = $slice->expand( 1000,-1000);
             my $forced_contracted_slice    = $slice->expand(-1000,-1000, 1, \$five_prime_shift, \$three_prime_shift);

Description: Returns a slice which is a resized copy of this slice.  The
             start and end are moved outwards from the center of the slice
             if positive values are provided and moved inwards if negative
             values are provided. This slice remains unchanged.  A slice
             may not be contracted below 1bp but may grow to be arbitrarily
             large.
Returntype : Bio::EnsEMBL::Slice
Exceptions : warning if an attempt is made to contract the slice below 1bp
Caller     : general
Status     : Stable

get_all_VariationFeatures

    Args       : $filter [optional]
    Description:returns all variation features on this slice. This function will only work 
                correctly if the variation database has been attached to the core database.
		        If $filter is "genotyped" return genotyped Snps only... (nice likkle hack);
    ReturnType : listref of Bio::EnsEMBL::Variation::VariationFeature
    Exceptions : none
    Caller     : contigview, snpview
    Status     : At Risk
               : Variation database is under development.

get_all_genotyped_VariationFeatures

Args       : none
Description: returns all variation features on this slice that have been genotyped.
             This function will only work correctly if the variation database has 
             been attached to the core database.
ReturnType : listref of Bio::EnsEMBL::Variation::VariationFeature
Exceptions : none
Caller     : contigview, snpview, ldview
Status     : At Risk
           : Variation database is under development.

get_all_DASFeatures

Arg [1]    : none
Example    : $features = $slice->get_all_DASFeatures;
Description: Retrieves a hash reference to a hash of DAS feature
             sets, keyed by the DNS, NOTE the values of this hash
             are an anonymous array containing:
              (1) a pointer to an array of features;
              (2) a pointer to the DAS stylesheet
Returntype : hashref of Bio::SeqFeatures
Exceptions : ?
Caller     : webcode
Status     : Stable

project_to_slice

  Arg [1]    : Slice to project to.
  Example    : my $chr_projection = $clone_slice->project_to_slice($chrom_slice);
                foreach my $segment ( @$chr_projection ){
                  $chr_slice = $segment->to_Slice();
                  print $clone_slice->seq_region_name(). ':'. $segment->from_start(). '-'.
                        $segment->from_end(). ' -> '.$chr_slice->seq_region_name(). ':'. $chr_slice->start().
	                '-'.$chr_slice->end().
                         $chr_slice->strand(). " length: ".($chr_slice->end()-$chr_slice->start()+1). "\n";
                }
  Description: Projection of slice to another specific slice. Needed for where we have multiple mappings
               and we want to state which one to project to.
  Returntype : list reference of Bio::EnsEMBL::ProjectionSegment objects which
               can also be used as [$start,$end,$slice] triplets.
  Exceptions : none
  Caller     : none
  Status     : At Risk

id

Description: Included for Bio::PrimarySeqI interface compliance (0.7)

display_id

Description: Included for Bio::PrimarySeqI interface compliance (1.2)

primary_id

Description: Included for Bio::PrimarySeqI interface compliance (1.2)

desc

Description: Included for Bio::PrimarySeqI interface compliance (1.2)

moltype

Description: Included for Bio::PrimarySeqI interface compliance (0.7)

alphabet

Description: Included for Bio::PrimarySeqI interface compliance (1.2)

accession_number

Description: Included for Bio::PrimarySeqI interface compliance (1.2)

is_circular

Description: Included for Bio::PrimarySeqI interface compliance (1.2)