Bio::EnsEMBL::Funcgen
ProbeFeature
Toolbar
Summary
Bio::EnsEMBL::ProbeFeature - A module to represent an nucleotide probe
genomic mapping.
Package variables
No package variables defined.
Included modules
Inherit
Synopsis
use Bio::EnsEMBL::Funcgen::ProbeFeature;
my $feature = Bio::EnsEMBL::Funcgen::ProbeFeature->new(
-PROBE => $probe,
-MISMATCHCOUNT => 0,
-SLICE => $chr_1_slice,
-START => 1_000_000,
-END => 1_000_024,
-STRAND => -1,
-ANALYSIS => $analysis,
);
#build_id/version, seq_region_id, seq_region_strand - from slice?
#cigar_line?
Description
An ProbeFeature object represents the genomic placement of an Probe
object. The data are stored in the probe_feature table.
Methods
Methods description
Arg [1] : str - Cigar line alignment annotation Example : my $cg = $feature->cigar_line(); Description: Getter and setter for number of the cigar line attribute for this feature. Returntype : str Exceptions : None Caller : General Status : High Risk |
Arg [1] : Bio::EnsEMBL::Analysis Arg [2] : listref - Bio::EnsEMBL::Funcgen::ExperimentalChip Example : my $result = $feature->get_result_by_Analysis_ExperimentalChips($anal, \@echips); Description: Getter of results attribute for a given Analysis and set of ExperimentalChips Returntype : float Exceptions : Throws is no Analysis or ExperimentalChips are not passed? Caller : General Status : High Risk |
Arg [1] : int - channel_id (mandatory) Arg [2] : string - Analysis name e.g. RawValue, VSN (optional) Example : my @results = $feature->results(); Description: Getter, setter and lazy loader of results attribute for ProbeFeature objects. Returntype : List ref to arrays containing ('score', 'Analysis logic_name'); Exceptions : None Caller : General Status : Medium Risk |
Arg [1] : int - number of mismatches Example : my $mismatches = $feature->mismatchcount(); Description: Getter and setter for number of mismatches for this feature. Returntype : int Exceptions : None Caller : General Status : High Risk |
Arg [-PROBE] : Bio::EnsEMBL::Funcgen::Probe - probe A ProbeFeature must have a probe. This probe must already be stored if you plan to store the feature. Arg [-MISMATCHCOUNT]: int Number of mismatches over the length of the probe. Arg [-SLICE] : Bio::EnsEMBL::Slice The slice on which this feature is. Arg [-START] : int The start coordinate of this feature relative to the start of the slice it is sitting on. Coordinates start at 1 and are inclusive. Arg [-END] : int The end coordinate of this feature relative to the start of the slice it is sitting on. Coordinates start at 1 and are inclusive. Arg [-STRAND] : int The orientation of this feature. Valid values are 1, -1 and 0. Arg [-dbID] : (optional) int Internal database ID. Arg [-ADAPTOR] : (optional) Bio::EnsEMBL::DBSQL::BaseAdaptor Database adaptor. Example : my $feature = Bio::EnsEMBL::Funcgen::ProbeFeature->new( -PROBE => $probe, -MISMATCHCOUNT => 0, -SLICE => $chr_1_slice, -START => 1_000_000, -END => 1_000_024, -STRAND => -1, -ANALYSIS => $analysis, -CIGARLINE => '15M2m3d4M', #Can represent transcript alignment as gapped genomic alignments #D(eletions) representing introns #Lowercase m's showing sequence mismatches ); Description: Constructor for ProbeFeature objects. Returntype : Bio::EnsEMBL::Funcgen::ProbeFeature Exceptions : None Caller : General Status : At risk |
Args : Hashref with all internal attributes set Example : none Description: Quick and dirty version of new. Only works if the code is very disciplined. Returntype : Bio::EnsEMBL::Funcgen::ProbeFeature Exceptions : None Caller : General Status : At Risk |
Arg [1] : Bio::EnsEMBL::Funcgen::Probe - probe Example : my $probe = $feature->probe(); Description: Getter, setter and lazy loader of probe attribute for ProbeFeature objects. Features are retrieved from the database without attached probes, so retrieving probe information for a feature will involve another query. Returntype : Bio::EnsEMBL::Funcgen::Probe Exceptions : None Caller : General Status : at risk |
Example : my $probe_id = $pfeature->probe_id(); Description: Getter for the probe db id of the ProbeFeature Returntype : int Exceptions : None Caller : General Status : at risk |
Args : None Example : my $probelength = $feature->probelength(); Description: Getter for the length of the probe. Shortcut for $feature->probe->length(), which should be used instead. Originally, this method returned the length of the feature, which was often, but not always, the same as the length of the probe. Returntype : int Exceptions : None Caller : General Status : Medium Risk : Use $feature->probe->length() because this may be removed |
Arg [1] : (optional) string - probeset Example : my $probeset = $feature->probeset(); Description: Getter and setter for the probeset for this feature. Shortcut for $feature->probe->probeset(), which should be used instead. Probeset is not persisted if set with this method. Returntype : string Exceptions : None Caller : General Status : Medium Risk : Use $feature->probe->probeset() because this may be removed |
Methods code
sub cigar_line
{ my $self = shift;
$self->{'cigar_line'} = shift if @_;
return $self->{'cigar_line'}; } |
sub get_result_by_Analysis_ExperimentalChips
{ my ($self, $anal, $exp_chips) = @_;
throw("Need to pass listref of ExperiemntalChips") if(scalar(@$exp_chips) == 0);
throw("Need to pass a valid Bio::EnsEMBL::Analysis") if ! $anal->isa("Bio::EnsEMBL::Analysis");
my (%query_ids, %all_ids, %ac_ids);
my $anal_name = $anal->logic_name();
foreach my $ec(@$exp_chips){
throw("Need to pass a listref of Bio::EnsEMBL::Funcgen::ExperimentalChip objects")
if ! $ec->isa("Bio::EnsEMBL::Funcgen::ExperimentalChip");
$ac_ids{$ec->array_chip_id()} = 1;
$all_ids{$ec->dbID()} = 1;
$query_ids{$ec->dbID()} = 1 if(! exists $self->{'results'}{$anal_name}{$ec->dbID()});
}
my @ec_ids = keys %query_ids;
my @all_ids = keys %all_ids;
if((scalar(@all_ids) - scalar(@ec_ids))> 1){
throw("DATA ERROR - There is more than one result stored for the following ExperimentalChip ids: @all_ids");
}
elsif(! $self->{'results'} || (($anal_name && scalar(@ec_ids) > 0) && scalar(@all_ids) == scalar(@ec_ids))){
my @result_refs = @{$self->adaptor->fetch_results_by_Probe_Analysis_experimental_chip_ids($self->probe(),
$anal,\@
ec_ids)};
while(@result_refs && (! $result_refs[0]->[0])){
shift @result_refs;
}
my $num_results = scalar(@result_refs);
my ($result, $mpos);
if($num_results == 1){
$result = $result_refs[0]->[0];
}
elsif($num_results == 2){ $result = ($result_refs[0]->[0] + $result_refs[1]->[0])/2;
}
elsif($num_results > 2){ $mpos = $num_results/2;
if($mpos =~ /\./){ $mpos =~ s/\..*//;
$mpos ++;
$result = $result_refs[$mpos]->[0];
}else{
$result = ($result_refs[$mpos]->[0] + $result_refs[($mpos+1)]->[0])/2 ; }
}
$self->{'results'}{$anal_name}{":".join(":", @ec_ids).":"} = $result;
}
my @keys;
foreach my $id(@all_ids){
my @tmp = grep(/:${id}:/, keys %{$self->{'results'}{$anal_name}});
if(@tmp){
push @keys, grep(/:${id}:/, keys %{$self->{'results'}{$anal_name}});
last;
}
}
throw("Got more than one key for the results cache") if scalar(@keys) > 1;
return $self->{'results'}{$anal_name}{$keys[0]};
}
} |
sub get_result_by_ResultSet
{ my ($self, $rset) = @_;
my $results = $rset->adaptor->fetch_results_by_probe_id_ResultSet($self->probe_id(), $rset);
return median($results);
}
1; } |
sub get_results_by_channel_id
{ my $self = shift;
my $channel_id = shift;
my $anal_name = shift;
warn("This method not fully implemented, remove/deprecate?");
$self->{'results_complete'} ||= 0;
if(! $self->{'results'} || ($anal_name && ! exists $self->{'results'}{$anal_name})){
$self->{'results_complete'} ||= 1 if(! $anal_name);
foreach my $results_ref(@{$self->adaptor->fetch_results_by_channel_analysis($self->probe->dbID(),
$channel_id, $anal_name)}){
$self->{'results'}{$$results_ref[1]} = $$results_ref[0];
}
}
return $self->{'results'}
}
} |
sub mismatchcount
{ my $self = shift;
$self->{'mismatchcount'} = shift if @_;
return $self->{'mismatchcount'}; } |
sub new
{ my $caller = shift;
my $class = ref($caller) || $caller;
my $self = $class->SUPER::new(@_);
my ($probe, $mismatchcount, $pid, $cig_line)
= rearrange(['PROBE', 'MISMATCHCOUNT', 'PROBE_ID', 'CIGAR_LINE'], @_);
$self->{'probe_id'} = $pid if $pid;
$self->probe($probe) if $probe;
$self->mismatchcount($mismatchcount) if defined $mismatchcount; $self->cigar_line($cig_line) if defined $cig_line;
return $self; } |
sub new_fast
{ bless ($_[1], $_[0]); } |
sub probe
{ my $self = shift;
my $probe = shift;
if ($probe) {
if ( !ref $probe || !$probe->isa('Bio::EnsEMBL::Funcgen::Probe') ) {
throw('Probe must be a Bio::EnsEMBL::Funcgen::Probe object');
}
$self->{'probe'} = $probe;
}
if ( ! defined $self->{'probe'}){
$self->{'probe'} = $self->adaptor()->db()->get_ProbeAdaptor()->fetch_by_dbID($self->probe_id());
}
return $self->{'probe'}; } |
sub probe_id
{ my $self = shift;
return $self->{'probe_id'} || $self->probe->dbID(); } |
sub probelength
{ my $self = shift;
return $self->probe->length(); } |
sub probeset
{ my $self = shift;
$self->{'probeset'} = shift if @_;
if ($self->{'probe'}) {
$self->{'probeset'} = $self->probe()->probeset();
}
return $self->{'probeset'}; } |
General documentation
This module was created by Nathan Johnson, but is almost entirely based on the
core OligoFeature module written by Ian Sealy.
This module is part of the Ensembl project:
/