Bio-EnsEMBL

 view release on metacpan or  search on metacpan

LICENSE  view on Meta::CPAN

      and distribution as defined by Sections 1 through 9 of this document.

      "Licensor" shall mean the copyright owner or entity authorized by
      the copyright owner that is granting the License.

      "Legal Entity" shall mean the union of the acting entity and all
      other entities that control, are controlled by, or are under common
      control with that entity. For the purposes of this definition,
      "control" means (i) the power, direct or indirect, to cause the
      direction or management of such entity, whether by contract or
      otherwise, or (ii) ownership of fifty percent (50%) or more of the
      outstanding shares, or (iii) beneficial ownership of such entity.

      "You" (or "Your") shall mean an individual or Legal Entity
      exercising permissions granted by this License.

      "Source" form shall mean the preferred form for making modifications,
      including but not limited to software source code, documentation
      source, and configuration files.

      "Object" form shall mean any form resulting from mechanical

lib/Bio/EnsEMBL/BaseAlignFeature.pm  view on Meta::CPAN

         -SEQNAME   => $self->{'seqname'},
         -START      => $qstart,
         -END        => $qend,
         -STRAND     => $strand1,
         -HSLICE      => $self->{'hslice'},
         -HSEQNAME   => $self->{'hseqname'},
         -HSTART     => $hstart,
         -HEND       => $hend,
         -HSTRAND    => $strand2,
         -SCORE      => $self->{'score'},
         -PERCENT_ID => $self->{'percent_id'},
         -ANALYSIS   => $self->{'analysis'},
         -P_VALUE    => $self->{'p_value'},
         -EXTERNAL_DB_ID => $self->{'external_db_id'},
         -HCOVERAGE   => $self->{'hcoverage'},
         -GROUP_ID    => $self->{'group_id'},
         -LEVEL_ID    => $self->{'level_id'});
      

      # end M cigar bits 
    } elsif( $piece =~ /I$/ ) {

lib/Bio/EnsEMBL/BaseAlignFeature.pm  view on Meta::CPAN

  } else {
    @f = sort { $b->start <=> $a->start} @$features;
  }

  my $hstrand     = $f[0]->hstrand;
  my $slice       = $f[0]->slice();
  my $hslice       = $f[0]->hslice();
  my $name        = $slice ? $slice->name() : undef;
  my $hname       = $f[0]->hseqname;
  my $score       = $f[0]->score;
  my $percent     = $f[0]->percent_id;
  my $analysis    = $f[0]->analysis;
  my $pvalue      = $f[0]->p_value();
  my $external_db_id = $f[0]->external_db_id;
  my $hcoverage   = $f[0]->hcoverage;
  my $group_id    = $f[0]->group_id;
  my $level_id    = $f[0]->level_id;

  my $seqname = $f[0]->seqname;
  # implicit strand 1 for peptide sequences
  $strand  ||= 1;

lib/Bio/EnsEMBL/BaseAlignFeature.pm  view on Meta::CPAN

            $f->slice->name()."]");
    }
    if ( defined($hname) && $hname ne $f->hseqname) {
      throw("Inconsistent hit names in feature array [$hname - ".
            $f->hseqname . "]");
    }
    if ( defined($score) && $score ne $f->score) {
      throw("Inconsisent scores in feature array [$score - " .
            $f->score . "]");
    }
    if (defined($f->percent_id) && $percent ne $f->percent_id) {
      throw("Inconsistent pids in feature array [$percent - " .
            $f->percent_id . "]");
    }
    if(defined($pvalue) && $pvalue != $f->p_value()) {
      throw("Inconsistant p_values in feature arraw [$pvalue " .
            $f->p_value() . "]");
    }
    if($seqname && $seqname ne $f->seqname){
      throw("Inconsistent seqname in feature array [$seqname - ".
            $f->seqname . "]");
    }
    my $start1 = $f->start;      #source sequence alignment start

lib/Bio/EnsEMBL/BaseAlignFeature.pm  view on Meta::CPAN

      $matchlength = "";
    }
    $string .= $matchlength."M";
  }

  $self->{'start'}      = $f1start;
  $self->{'end'}        = $f1end;
  $self->{'seqname'}    = $seqname;
  $self->{'strand'}     = $strand;
  $self->{'score'}      = $score;
  $self->{'percent_id'} = $percent;
  $self->{'analysis'}   = $analysis;
  $self->{'slice'}      = $slice;
  $self->{'hslice'}     = $hslice;
  $self->{'hstart'}     = $f2start;
  $self->{'hend'}       = $f2end;
  $self->{'hstrand'}    = $hstrand;
  $self->{'hseqname'}   = $hname;
  $self->{'cigar_string'} = $string;
  $self->{'p_value'}      = $pvalue;
  $self->{'external_db_id'} = $external_db_id; 

lib/Bio/EnsEMBL/DBSQL/BaseAlignFeatureAdaptor.pm  view on Meta::CPAN

  return
    $self->fetch_all_by_Slice_constraint( $slice, $constraint,
                                          $logic_name );
} ## end sub fetch_all_by_Slice_and_external_db

=head2 fetch_all_by_Slice_and_pid

  Arg [1]    : Bio::EnsEMBL::Slice $slice
               The slice from which to obtain align features.
  Arg [2]    : (optional) float $pid 
               A lower bound for the percentage identity of features
               to obtain.
  Arg [3]    : (optional) string $logic_name
               The logic name of the type of features to obtain.
  Example    : @feats =
                 @{ $adaptor->fetch_all_by_Slice_and_pid( $slice, 50.0 ) };
  Description: Returns a listref of features created from the
               database which are on the Slice $slice and with a
               percentage identity greater than $pid.  If logic name
               is defined, only features with an analysis of type
               $logic_name will be returned.
  Returntype : listref of Bio::EnsEMBL::BaseAlignFeatures
               in Slice coordinates
  Exceptions : none
  Caller     : general
  Status     : Stable

=cut

lib/Bio/EnsEMBL/DBSQL/DensityFeatureAdaptor.pm  view on Meta::CPAN

               prevent excessive interpolation of the database values.
  Example    : #interpolate:
               $feats = $dfa->fetch_all_by_Slice($slice,'SNPDensity', 10, 1);
               #do not interpoloate, get what is in the database:
               $feats = $dfa->fetch_all_by_Slice($slice,'SNPDensity', 50);
               #interpolate, but not too much
               $feats = $dfa->fetch_all_by_Slice($slice,'SNPDensity',50,1,5.0);
  Description: Retrieves a set of density features which overlap the region
               of this slice. Density features are a discrete representation
               of a continuous value along a sequence, such as a density or
               percent coverage.  Density Features may be stored in chunks of
               different sizes in the database, and interpolated to fit the
               desired size for the requested region.  For example the database
               may store a single density value for each 1KB and also for each
               1MB.  When fetching for an entire chromosome the 1MB density
               chunks will be used if the requested number of blocks is not
               very high.
               Note that features which have been interpolated are not stored
               in the database and as such will have no dbID or adaptor set.
  Returntype : Bio::EnsEMBL::DensityFeature
  Exceptions : warning on invalid $num_blocks argument

lib/Bio/EnsEMBL/DBSQL/DensityFeatureAdaptor.pm  view on Meta::CPAN


      #what portion of this feature are we using to construct our new block?
      $fstart = ($f->{'start'} < $start) ? $start : $f->{'start'};
      $fend   = ($f->{'end'}   > $end  ) ? $end   : $f->{'end'};
      $fend   = $length if($fend > $length);

      if($value_type eq 'sum') {

        $portion = ($fend-$fstart+1)/$f->length();

        #take a percentage of density value, depending on how much of the
        #feature we overlapped
        $density_value += $portion * $f->{'density_value'};

      } elsif($value_type eq 'ratio') {

        #maintain a running total of the length used from each feature
        #and its value
        push(@dvalues,[$fend-$fstart+1,$f->{'density_value'}]);

      } else {

lib/Bio/EnsEMBL/DBSQL/DnaAlignFeatureAdaptor.pm  view on Meta::CPAN

    $sth->bind_param( 3,  $feat->end,            SQL_INTEGER );
    $sth->bind_param( 4,  $feat->strand,         SQL_TINYINT );
    $sth->bind_param( 5,  $hstart,               SQL_INTEGER );
    $sth->bind_param( 6,  $hend,                 SQL_INTEGER );
    $sth->bind_param( 7,  $hstrand,              SQL_TINYINT );
    $sth->bind_param( 8,  $hseqname,             SQL_VARCHAR );
    $sth->bind_param( 9,  $cigar_string,         SQL_LONGVARCHAR );
    $sth->bind_param( 10, $feat->analysis->dbID, SQL_INTEGER );
    $sth->bind_param( 11, $feat->score,          SQL_DOUBLE );
    $sth->bind_param( 12, $feat->p_value,        SQL_DOUBLE );
    $sth->bind_param( 13, $feat->percent_id,     SQL_FLOAT );
    $sth->bind_param( 14, $feat->external_db_id, SQL_INTEGER );
    $sth->bind_param( 15, $feat->hcoverage,      SQL_DOUBLE );
    $sth->bind_param( 16, $feat->align_type,     SQL_VARCHAR);
    $sth->execute();

    my $dbId = $self->last_insert_id("${tablename}_id", undef, $tablename);

    # store attributes if there are any
    my $attr_adaptor = $db->get_AttributeAdaptor();
    $attr_adaptor->store_on_DnaDnaAlignFeature($dbId, $feat->get_all_Attributes);

lib/Bio/EnsEMBL/DBSQL/DnaAlignFeatureAdaptor.pm  view on Meta::CPAN

               'slice'           => $slice,
               'start'           => $seq_region_start,
               'end'             => $seq_region_end,
               'strand'          => $seq_region_strand,
               'hseqname'        => $hit_name,
               'hstart'          => $hit_start,
               'hend'            => $hit_end,
               'hstrand'         => $hit_strand,
               'score'           => $score,
               'p_value'         => $evalue,
               'percent_id'      => $perc_ident,
               'cigar_string'    => $cigar_line,
               'analysis'        => $analysis,
               'adaptor'         => $self,
               'dbID'            => $dna_align_feature_id,
               'external_db_id'  => $external_db_id,
               'hcoverage'       => $hcoverage,
               'align_type'      => $align_type,
               'dbname'          => $external_db_name,
               'db_display_name' => $external_display_db_name
             } ) );

lib/Bio/EnsEMBL/DBSQL/ProteinAlignFeatureAdaptor.pm  view on Meta::CPAN

   $sth->bind_param(2,$feat->start,SQL_INTEGER);
   $sth->bind_param(3,$feat->end,SQL_INTEGER);
   $sth->bind_param(4,$feat->strand,SQL_TINYINT);
   $sth->bind_param(5,$feat->hstart,SQL_INTEGER);
   $sth->bind_param(6,$feat->hend,SQL_INTEGER);
   $sth->bind_param(7,$feat->hseqname,SQL_VARCHAR);
   $sth->bind_param(8,$feat->cigar_string,SQL_LONGVARCHAR);
   $sth->bind_param(9,$feat->analysis->dbID,SQL_INTEGER);
   $sth->bind_param(10,$feat->score,SQL_DOUBLE);
   $sth->bind_param(11,$feat->p_value,SQL_DOUBLE);
   $sth->bind_param(12,$feat->percent_id,SQL_REAL);
   $sth->bind_param(13,$feat->external_db_id,SQL_INTEGER);
   $sth->bind_param(14,$feat->hcoverage,SQL_DOUBLE);
   $sth->bind_param(15,$feat->align_type,SQL_VARCHAR);

   $sth->execute();
   my $dbId = $self->last_insert_id("${tablename}_id", undef, $tablename);
   $original->dbID($dbId);
   $original->adaptor($self);
 }

lib/Bio/EnsEMBL/DBSQL/ProteinAlignFeatureAdaptor.pm  view on Meta::CPAN

          'start'        => $seq_region_start,
          'end'          => $seq_region_end,
          'strand'       => $seq_region_strand,
          'hseqname'     => $hit_name,
          'hstart'       => $hit_start,
          'hend'         => $hit_end,
          'hstrand'      => 1,                  # dna_pep_align features
                                                # are always hstrand 1
          'score'        => $score,
          'p_value'      => $evalue,
          'percent_id'   => $perc_ident,
          'cigar_string' => $cigar_line,
          'analysis'     => $analysis,
          'adaptor'      => $self,
          'dbID'           => $protein_align_feature_id,
          'external_db_id' => $external_db_id,
          'hcoverage'      => $hcoverage,
          'align_type'     => $align_type,
          'dbname'         => $external_db_name,
          'db_display_name' => $external_display_db_name
        } ) );

lib/Bio/EnsEMBL/DBSQL/ProteinFeatureAdaptor.pm  view on Meta::CPAN

  my $i = 0;
  $sth->bind_param(++$i, $translation_id,        SQL_INTEGER);
  $sth->bind_param(++$i, $feature->start,        SQL_INTEGER);
  $sth->bind_param(++$i, $feature->end,          SQL_INTEGER);
  $sth->bind_param(++$i, $feature->hstart,       SQL_INTEGER);
  $sth->bind_param(++$i, $feature->hend,         SQL_INTEGER);
  $sth->bind_param(++$i, $feature->hseqname,     SQL_VARCHAR);
  $sth->bind_param(++$i, $analysis->dbID,        SQL_INTEGER);
  $sth->bind_param(++$i, $feature->score,        SQL_DOUBLE);
  $sth->bind_param(++$i, $feature->p_value,      SQL_DOUBLE);
  $sth->bind_param(++$i, $feature->percent_id,   SQL_FLOAT);
  $sth->bind_param(++$i, $feature->external_data,      SQL_VARCHAR);
  $sth->bind_param(++$i, $feature->hdescription, SQL_LONGVARCHAR);

  if ($self->schema_version > 92) {
    $sth->bind_param(++$i, $feature->cigar_string,      SQL_VARCHAR);
    $sth->bind_param(++$i, $feature->align_type,      SQL_VARCHAR);
  }

  $sth->execute();

lib/Bio/EnsEMBL/DBSQL/SliceAdaptor.pm  view on Meta::CPAN

}



=head2 fetch_by_Feature

  Arg [1]    : Bio::EnsEMBL::Feature $feat
               The feature to fetch the slice around
  Arg [2]    : int size (optional)
               The desired number of flanking basepairs around the feature.
               The size may also be provided as a percentage of the feature 
               size such as 200% or 80.5%.
  Example    : $slice = $slice_adaptor->fetch_by_Feature($feat, 100);
  Description: Retrieves a slice around a specific feature.  All this really
               does is return a resized version of the slice that the feature
               is already on. Note that slices returned from this method
               are always on the forward strand of the seq_region regardless of
               the strandedness of the feature passed in.
  Returntype : Bio::EnsEMBL::Slice
  Exceptions : throw if the feature does not have an attached slice
               throw if feature argument is not provided

lib/Bio/EnsEMBL/DensityFeature.pm  view on Meta::CPAN

  $feature = Bio::EnsEMBL::DensityFeature->new(
    -seq_region    => $region,
    -start         => 1,
    -end           => 1e6,
    -density_type  => $dt,
    -density_value => 98.5
  );

=head1 DESCRIPTION

A density feature represents a count, density, or percentage coverage,
etc. for a given region.

This module is part of the Ensembl project http://www.ensembl.org

=head1 METHODS

=cut


use strict;

lib/Bio/EnsEMBL/DensityFeature.pm  view on Meta::CPAN

  return 0;
}



=head2 density_value

  Arg [1]    : (optional) float $density_value
  Example    : $dv = $density_feature->density_value();
  Description: Getter/Setter for the density value of this DensityFeature.
               The density value may be a count, a percentage, or a coverage
               of a feature type in the area defined by this feature.
  Returntype : float
  Exceptions : throw if a negative density value is provided
  Caller     : general
  Status     : Stable

=cut

sub density_value {
  my $self = shift;

lib/Bio/EnsEMBL/DensityType.pm  view on Meta::CPAN

  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>.

=cut

=head1 NAME

Bio::EnsEMBL::DensityType - A type representing a density, or percentage
coverage etc. in a given region.

=head1 SYNOPSIS

  use Bio::EnsEMBL::DensityType;

  $type = Bio::EnsEMBL::DensityType->new(
    -analysis   => $analysis,
    -blocksize  => 1000000,
    -value_type => $type
  );

=head1 DESCRIPTION

A density type represents a density, or percentage coverage etc. in a
given region.

=head1 METHODS

=cut

use strict;
use warnings;

package Bio::EnsEMBL::DensityType;

lib/Bio/EnsEMBL/FeaturePair.pm  view on Meta::CPAN


    my $feat = Bio::EnsEMBL::FeaturePair->new(
      -start      => 132_231,
      -end        => 132_321,
      -strand     => -1,
      -slice      => $slice,
      -hstart     => 10,
      -hend       => 100,
      -hstrand    => 1,
      -score      => 100,
      -percent_id => 92.0,
      -hseqname   => 'ALUSX10.1',
      -analysis   => $analysis
    );

    my $hit_start  = $feat->hstart();
    my $hit_end    = $feat->hend();
    my $hit_strand = $feat->hstrand();
    my $analysis   = $feat->analysis();

=head1 DESCRIPTION

lib/Bio/EnsEMBL/FeaturePair.pm  view on Meta::CPAN

  $clone = $slice_adpator->fetch_by_region( 'clone', 'HS120G22' );

  $fp = Bio::EnsEMBL::FeaturePair(
    -start      => 100,
    -end        => 220,
    -strand     => 1,
    -slice      => $clone,
    -hstart     => 1,
    -hend       => 40,
    -hstrand    => 1,
    -percent_id => 92.0,
    -score      => 100,
    -hseqname   => 'SW:HBA_HUMAN',
    -species    => 'Homo sapiens',
    -hspecies   => 'Homo sapiens'
  );

=head1 METHODS

=cut

lib/Bio/EnsEMBL/FeaturePair.pm  view on Meta::CPAN

  Arg [EXTRA_DATA]: HashRef - Additional data, specified as name, value attribute pairs (optional)
  Arg [...]       : Named superclass constructor args (Bio::EnsEMBL::Feature)
  Example    : $feat = Bio::EnsEMBL::FeaturePair->new(-start    => 132_231,
                                              -end      => 132_321,
                                              -strand   => -1,
                                              -slice    => $slice,
                                              -hstart   => 10,
                                              -hend     => 100,
                                              -hstrand  => 1,
                                              -score    => 100,
                                              -percent_id => 92.0,
                                              -hseqname => 'ALUSX10.1',
                                              -analysis => $analysis);
  Description: Creates a new Bio::EnsEMBL::FeaturePair object
  Returntype : Bio::EnsEMBL::FeaturePair
  Exceptions : throw if start > end
               throw if invalid strand is provided
  Caller     : general
  Status     : Stable

=cut

sub new {
  my $caller = shift;

  my $class = ref($caller) || $caller;

  my $self = $class->SUPER::new(@_);

  my ($hstart, $hend, $hstrand, $percent_id, $score, $species, $hspecies, $p_value, $hseqname, $f1, $f2, $coverage, $hcoverage, $group_id, $level_id, $external_db_id, $extra_data, $external_db_name, $external_display_db_name, $hdescription) = rearran...

  if (defined($hstart) && defined($hend) && ($hend < $hstart)) {
	throw('HSTART must be less than or equal to HEND');
  }

  if (defined($hstrand) && $hstrand != 1 && $hstrand != -1 && $hstrand != 0) {
	throw('HSTRAND must be one of (0,1,-1)');
  }

  $self->{'hstart'}          = $hstart;
  $self->{'hend'}            = $hend;
  $self->{'hstrand'}         = $hstrand;
  $self->{'score'}           = $score;
  $self->{'percent_id'}      = $percent_id;
  $self->{'species'}         = $species;
  $self->{'hspecies'}        = $hspecies;
  $self->{'hseqname'}        = $hseqname;
  $self->{'coverage'}        = $coverage;
  $self->{'hcoverage'}       = $hcoverage;
  $self->{'p_value'}         = $p_value;
  $self->{'group_id'}        = $group_id;
  $self->{'level_id'}        = $level_id;
  $self->{'external_db_id'}  = $external_db_id;
  $self->{'extra_data'}      = $extra_data;

lib/Bio/EnsEMBL/FeaturePair.pm  view on Meta::CPAN

  Status     : Stable

=cut

sub score {
  my $self = shift;
  $self->{'score'} = shift if (@_);
  return $self->{'score'};
}

=head2 percent_id

  Arg [1]    : float $percent_id (optional)
  Example    : $percent_id = $fp->percent_id();
  Description: Getter/Setter for the percentage identity of this feature pair
  Returntype : float
  Exceptions : none
  Caller     : general
  Status     : Stable

=cut

sub percent_id {
  my $self = shift;
  $self->{'percent_id'} = shift if (@_);
  return $self->{'percent_id'};
}

=head2 species

 Arg [1]    : string $genus_species_name (optional)
              e.g. Homo_sapiens or Mus_musculus
 Example    : $species = $fp->species();
 Description: get/set on the species of feature1
 Returntype : string
 Execeptions: none

lib/Bio/EnsEMBL/FeaturePair.pm  view on Meta::CPAN

=cut

sub hspecies {
  my $self = shift;
  $self->{'hspecies'} = shift if (@_);
  return $self->{'hspecies'};
}

=head2 coverage

  Arg [1]    : number (percentage) $coverage (optional)
  Example    : $cov = $fp->coverage();
  Description: Getter/Setter for the % of the query covered by the feature
  Returntype : string
  Exceptions : none
  Caller     : general
  Status     : Stable

=cut

sub coverage {
  my $self = shift;
  $self->{'coverage'} = shift if (@_);
  return $self->{'coverage'};
}

=head2 hcoverage

  Arg [1]    : number (percentage) $hcoverage (optional)
  Example    : $hcov = $fp->hcoverage();
  Description: Getter/Setter for the % of the target covered by the feature
  Returntype : string
  Exceptions : none
  Caller     : general
  Status     : Stable

=cut

sub hcoverage {

lib/Bio/EnsEMBL/IdMapping/ExonScoreBuilder.pm  view on Meta::CPAN

  }
  
  closedir($dumpdir);

  # determine number of jobs to split task into
  my $bytes_per_job = $self->conf->param('exonerate_bytes_per_job')
    || 250000;
  my $num_jobs = $self->conf->param('exonerate_jobs');
  $num_jobs ||= int( $source_size/$bytes_per_job + 1 );

  my $percent =
    int( ( $self->conf->param('exonerate_threshold') || 0.5 )*100 );
  my $lsf_name       = 'idmapping_exonerate_' . time;
  my $exonerate_path = $self->conf->param('exonerate_path');
  my $exonerate_extra_params =
    $self->conf->param('exonerate_extra_params');

  #
  # run exonerate jobs using lsf
  #
  my $exonerate_job =
    qq{$exonerate_path } .
    qq{--query $source_file --target $target_file } .
    q{--querychunkid $LSB_JOBINDEX } .
    qq{--querychunktotal $num_jobs } .
    q{--model ungapped -M 1000 -D 100 } .
    q{--showalignment FALSE --subopt no } . qq{--percent $percent } .
    $self->conf->param('exonerate_extra_params') . " " .
    q{--ryo 'myinfo: %qi %ti %et %ql %tl\n' } .
    qq{| grep '^myinfo:' > $dump_path/exonerate_map.\$LSB_JOBINDEX} .
    "\n";

  $self->logger->info("Submitting $num_jobs exonerate jobs to lsf.\n");
  $self->logger->debug("$exonerate_job\n\n");

  my $bsub_cmd = sprintf(
               "|bsub -J '%s[1-%d]%%%d' -o %s/exonerate.%%I.out %s",

lib/Bio/EnsEMBL/SeqFeature.pm  view on Meta::CPAN

  } else {
    bless $self, $caller;
  }

  $self->{'_gsf_tag_hash'} = {};
  $self->{'_gsf_sub_array'} = [];
  $self->{'_parse_h'} = {};
  $self->{'_is_splittable'} = 0;

  my ($start,$end,$strand,$frame,$score,$analysis,$seqname, $source_tag,
      $primary_tag, $percent_id, $p_value, $phase, $end_phase) =

      &rearrange([qw(START
                            END
                            STRAND
                            FRAME
                            SCORE
                            ANALYSIS
                            SEQNAME
                            SOURCE_TAG
                            PRIMARY_TAG

lib/Bio/EnsEMBL/SeqFeature.pm  view on Meta::CPAN


  #  $gff_string && $self->_from_gff_string($gff_string);

  if ( defined $analysis  && $analysis ne "")   { $self->analysis($analysis)};
  if ( defined ($start) && $start ne "" )       { $self->start($start)};
  if ( defined ($end )  && $end   ne "" )       { $self->end($end)}
  if ( defined $strand  && $strand ne "")       { $self->strand($strand)}
  if ( defined $frame  && $frame ne "")         { $self->frame($frame)}
  if ( defined $score  && $score ne "")         { $self->score($score)}
  if ( defined $seqname && $seqname ne "")      { $self->seqname($seqname)};
  if ( defined $percent_id && $percent_id ne ""){ $self->percent_id($percent_id)};
  if ( defined $p_value && $p_value ne "")      { $self->p_value($p_value)};
  if ( defined $phase && $phase ne "")          { $self->phase($phase)};
  if ( defined $end_phase && $end_phase ne "")  { $self->end_phase($end_phase)};

  return $self; # success - we hope!

}



lib/Bio/EnsEMBL/SeqFeature.pm  view on Meta::CPAN

=cut

# Shouldn't this go as "validate" into Pro_SeqFeature?
sub validate_prot_feature{
    my ($self,$num) = @_;
    $self->throw("Seqname not defined in feature")     unless defined($self->seqname);
    $self->throw("start not defined in feature")       unless defined($self->start);
    $self->throw("end not defined in feature")         unless defined($self->end);
    if ($num == 1) {
        $self->throw("score not defined in feature")       unless defined($self->score);
        $self->throw("percent_id not defined in feature") unless defined($self->percent_id);
        $self->throw("evalue not defined in feature") unless defined($self->p_value);
    }
    $self->throw("analysis not defined in feature")    unless defined($self->analysis);
}



# These methods are specified in the SeqFeatureI interface but we don't want
# people to store data in them.  These are just here in order to keep
# existing code working

lib/Bio/EnsEMBL/SeqFeature.pm  view on Meta::CPAN

    my ($self,$value) = @_;

    if (defined($value)) {
        $self->{_id} = $value;
    }

    return $self->{_id};

}

=head2 percent_id

 Title   : percent_id
 Usage   : $pid = $feat->percent_id()
           $feat->percent_id($pid)
 Function: get/set on percentage identity information
 Returns : float
 Args    : none if get, the new value if set

=cut

sub percent_id {
    my ($self,$value) = @_;

    if (defined($value))
    {
            $self->{_percent_id} = $value;
    }

    return $self->{_percent_id};
}

=head2 p_value

 Title   : p_value
 Usage   : $p_val = $feat->p_value()
           $feat->p_value($p_val)
 Function: get/set on p value information
 Returns : float
 Args    : none if get, the new value if set

lib/Bio/EnsEMBL/Utils/Converter/bio_ens_hit.pm  view on Meta::CPAN

    }

    my $bio_ens_seqFeature_converter = $self->_bio_ens_seqFeature_converter;
    my $ens_feature1 = $bio_ens_seqFeature_converter->_convert_single(
        $hsp->feature1);
    my $ens_feature2 = $bio_ens_seqFeature_converter->_convert_single(
        $hsp->feature2);

    $ens_feature1->p_value($hsp->evalue);
    $ens_feature1->score($hsp->score);
    $ens_feature1->percent_id($hsp->percent_identity);
    $ens_feature2->p_value($hsp->evalue);
    $ens_feature2->score($hsp->score);
    $ens_feature2->percent_id($hsp->percent_identity);
    
    my $cigar_string = $hsp->cigar_string;
    my @args = (
        -feature1 => $ens_feature1,
        -feature2 => $ens_feature2,
        -cigar_string => $cigar_string
    );

    my $contig = $self->contig;
    # choose the AlignFeature based on the blast program

lib/Bio/EnsEMBL/Utils/Converter/bio_ens_hsp.pm  view on Meta::CPAN

    my ($self, $hsp) = @_;
    
    my $bio_ens_seqFeature_converter = $self->_bio_ens_seqFeature_converter;
    my $ens_feature1 = $bio_ens_seqFeature_converter->_convert_single(
        $hsp->feature1);
    my $ens_feature2 = $bio_ens_seqFeature_converter->_convert_single(
        $hsp->feature2);

    $ens_feature1->p_value($hsp->evalue);
    $ens_feature1->score($hsp->score);
    $ens_feature1->percent_id($hsp->percent_identity);
    $ens_feature2->p_value($hsp->evalue);
    $ens_feature2->score($hsp->score);
    $ens_feature2->percent_id($hsp->percent_identity);

    my $featurePair = Bio::EnsEMBL::FeaturePair->new(
        -feature1 => $ens_feature1,
        -feature2 => $ens_feature2
    );

    return $featurePair;
}

sub _convert_single_to_proteinFeature {

lib/Bio/EnsEMBL/Utils/Converter/bio_ens_seqFeature.pm  view on Meta::CPAN

        $self->throw("a Bio::SeqFeature::Generic object needed");
    }
    
    my $seqFeature = $in;
    my $seq_id = $seqFeature->seq_id;
    unless(defined($seq_id) && $seq_id){
        $self->warn("No seq_id value. EnsEMBL SeqFeature will validate it");
        $seq_id = 'Unknown';
    }
    
    # Debated issue here. There are p_value and percent_id in EnsEMBL API and DB
    # schema, but not in bioperl. If in bioperl there are tags called p_value or
    # percent_id, then the values are passed, otherwise set the default 1.
    #
    # the problem arise when I try to converter the seqfeature for tmhmm to 
    # EnsEMBL seqFeature.
    # -- Juguang, 11 July '03
    my $score = $in->score || 0;
    my $percent_id;
    if($in->has_tag('percent_id')){
        ($percent_id) = $in->get_tag_values('percent_id');
    }else{
        $percent_id ||= 0;
    }
    my $p_value;
    if($in->has_tag('p_value')){
        ($p_value) = $in->get_tag_values('p_value');
    }elsif($in->has_tag('evalue')){
        ($p_value) = $in->get_tag_values('evalue');
    }else{
        $p_value ||= 1;
    }
    my $ens_seqFeature;
    my %args = (
        -start => $in->start,
        -end => $in->end,
        -strand => $in->strand,
        -score => $score,
        -analysis => $self->analysis,
        -source_tag => $in->source_tag,
        -seqname => $seq_id,
        -percent_id => $percent_id,
        -p_value => $p_value
    );

    my $output_module = $self->out;
    
    if($output_module eq 'Bio::EnsEMBL::SeqFeature'){
        
        $ens_seqFeature = new Bio::EnsEMBL::SeqFeature(%args);
    }elsif($self->out eq 'Bio::EnsEMBL::SimpleFeature'){
        $ens_seqFeature = new Bio::EnsEMBL::SimpleFeature(%args);

lib/Bio/EnsEMBL/Utils/Logger.pm  view on Meta::CPAN

  my $indent = shift;
  
  throw("You must provide a name and the current value for your progress bar")
    unless ($name and $curr);

  # return if we haven't reached the next increment
  return if ($curr < int($self->{'_progress'}->{$name}->{'next'}));

  my $index = $self->{'_progress'}->{$name}->{'index'};
  my $num_bins = $self->{'_progress'}->{$name}->{'numbins'};
  my $percent = $index/$num_bins*100;

  my $log_str;
  $log_str .= '      'x$indent if ($index == 0);
  $log_str .= "\b"x4;
  $log_str .= sprintf("%3s%%", $percent);
  $log_str .= "\n" if ($curr == $self->{'_progress'}->{$name}->{'max_val'});

  $self->info($log_str);

  # increment counters
  $self->{'_progress'}->{$name}->{'index'}++;
  $self->{'_progress'}->{$name}->{'next'} += $self->{'_progress'}->{$name}->{'binsize'};
}


lib/Bio/EnsEMBL/Utils/Logger.pm  view on Meta::CPAN

  my $indent = shift;
  
  throw("You must provide a name and the current value for your progress bar")
    unless ($name and $curr);

  # return if we haven't reached the next increment
  return if ($curr < int($self->{'_progress'}->{$name}->{'next'}));

  my $index = $self->{'_progress'}->{$name}->{'index'};
  my $num_bins = $self->{'_progress'}->{$name}->{'numbins'};
  my $percent = $index/$num_bins*100;

  my $log_str = "\r".('  'x$indent)."[".('='x$index).(' 'x($num_bins-$index))."] ${percent}\%";
  $log_str .= "\n" if ($curr == $self->{'_progress'}->{$name}->{'max_val'});

  $self->info($log_str);

  # increment counters
  $self->{'_progress'}->{$name}->{'index'}++;
  $self->{'_progress'}->{$name}->{'next'} += $self->{'_progress'}->{$name}->{'binsize'};
}




( run in 0.526 second using v1.01-cache-2.11-cpan-709fd43a63f )