ensembl-hive  2.7.0
Bio::EnsEMBL::IdMapping::ScoredMappingMatrix Class Reference
+ Inheritance diagram for Bio::EnsEMBL::IdMapping::ScoredMappingMatrix:

Public Member Functions

public Bio::EnsEMBL::IdMapping::ScoredMappingMatrix new ()
 
public void flush ()
 
public Bio::EnsEMBL::IdMapping::ScoredMappingMatrix sub_matrix ()
 
public Float add_Entry ()
 
public Float update_Entry ()
 
public remove_Entry ()
 
public Float add_score ()
 
public Float set_score ()
 
public Bio::EnsEMBL::IdMapping::Entry get_Entry ()
 
public Float get_score ()
 
public Arrayref get_targets_for_source ()
 
public Arrayref get_Entries_for_source ()
 
public Arrayref get_sources_for_target ()
 
public Arrayref get_Entries_for_target ()
 
public Arrayref get_all_Entries ()
 
public Arrayref get_all_sources ()
 
public Arrayref get_all_targets ()
 
public Int get_entry_count ()
 
public Int size ()
 
public Int get_source_count ()
 
public Int get_target_count ()
 
public Arrayref get_min_max_scores ()
 
public Float get_average_score ()
 
public Int merge ()
 
public void log ()
 
public String to_string ()
 
- Public Member Functions inherited from Bio::EnsEMBL::IdMapping::Serialisable
public Bio::EnsEMBL::IdMapping::Serialisable new ()
 
public String write_to_file ()
 
public Bio::EnsEMBL::IdMapping::Serialisable read_from_file ()
 
public String dump_path ()
 
public String cache_file_name ()
 
public String cache_file ()
 
public Boolean loaded ()
 

Detailed Description

Synopsis

# create a new ScoredMappingMatrix
-DUMP_PATH => $dump_path,
-CACHE_FILE => 'gene_scores.ser',
);
# add entries
my $gene_scores->add_Entry($entry1);
# serialise to file
$gene_scores->write_to_file;
# later, read these gene_scores from file
-DUMP_PATH => $dump_path,
-CACHE_FILE => 'gene_gene_scores.ser',
);
$gene_scores1->read_from_file;

Description

This object represents a collection of scores between source and target
objects.  It holds a list of Bio::EnsEMBL::IdMapping::Entry objects and
has methods to retrieve indiviual or all Entries, as well as derived
data like number of unique sources or targets, or various counts and
averages.

It is the main collection for dealing with scored relationships in the
stable Id mapping application.

Definition at line 44 of file ScoredMappingMatrix.pm.

Member Function Documentation

◆ add_Entry()

public Float Bio::EnsEMBL::IdMapping::ScoredMappingMatrix::add_Entry ( )
  Arg[1]      : Bio::EnsEMBL::IdMapping::Entry $entry - Entry to add
  Example     :
$gene_scores->add_Entry($entry);
  Description : Adds an Entry to the scoring matrix.
  Return type : Float - the Entry's score
  Exceptions  : thrown on wrong or missing argument
  Caller      : general
  Status      : At Risk
              : under development
 
Code:
click to view

◆ add_score()

public Float Bio::EnsEMBL::IdMapping::ScoredMappingMatrix::add_score ( )
  Arg[1]      : Int $source - source object's internal Id ("dbID")
  Arg[2]      : Int $target - target object's internal Id ("dbID")
  Arg[3]      : Float $score - score for source/target pair
  Example     :
$gene_scores->add_score(1234, 5678, 0.997);
  Description : Adds a score for a source/target pair to the scoring matrix.
                This is a low-level version of add_Entry().
  Return type : Float - the score
  Exceptions  : none
  Caller      : general
  Status      : At Risk
              : under development
 
Code:
click to view

◆ flush()

public void Bio::EnsEMBL::IdMapping::ScoredMappingMatrix::flush ( )
  Example     :
$gene_scores->flush;
  Description : Flushes (empties) the scoring matrix.
  Return type : none
  Exceptions  : none
  Caller      : general
  Status      : At Risk
              : under development
 
Code:
click to view

◆ get_all_Entries()

public Arrayref Bio::EnsEMBL::IdMapping::ScoredMappingMatrix::get_all_Entries ( )
  Example     :
foreach my $entry (@{ $gene_scores->get_all_Entries }) {
@section autotoc_md12 do something with the entry
}
  Description : Returns a list of all Entries in the scoring matrix.
  Return type : Arrayref of Bio::EnsEMBL::IdMapping::Entry objects
  Exceptions  : none
  Caller      : general
  Status      : At Risk
              : under development
 
Code:
click to view

◆ get_all_sources()

public Arrayref Bio::EnsEMBL::IdMapping::ScoredMappingMatrix::get_all_sources ( )
  Example     :
my @sources = @{ $gene_scores->get_all_sources };
  Description : Returns a list of all sources in the scoring matrix.
  Return type : Arrayref of Int (source objects' internal Ids)
  Exceptions  : none
  Caller      : general
  Status      : At Risk
              : under development
 
Code:
click to view

◆ get_all_targets()

public Arrayref Bio::EnsEMBL::IdMapping::ScoredMappingMatrix::get_all_targets ( )
  Example     :
my @targets = @{ $gene_scores->get_all_targets };
  Description : Returns a list of all targets in the scoring matrix.
  Return type : Arrayref of Int (target objects' internal Ids)
  Exceptions  : none
  Caller      : general
  Status      : At Risk
              : under development
 
Code:
click to view

◆ get_average_score()

public Float Bio::EnsEMBL::IdMapping::ScoredMappingMatrix::get_average_score ( )
  Example     :
my $avg_score = $gene_scores->get_average_score;
  Description : Returns the average (mean) score in the matrix.
  Return type : Float
  Exceptions  : none
  Caller      : general
  Status      : At Risk
              : under development
 
Code:
click to view

◆ get_Entries_for_source()

public Arrayref Bio::EnsEMBL::IdMapping::ScoredMappingMatrix::get_Entries_for_source ( )
  Arg[1]      : Int $source - source object's internal Id ("dbID")
  Example     :
my @entries = @{ $gene_scores->get_Entries_for_source(1234) };
  Description : Returns a list of all Entries in the scoring matrix for a given
                source object.
  Return type : Arrayref of Bio::EnsEMBL::IdMapping::Entry objects
  Exceptions  : none
  Caller      : general
  Status      : At Risk
              : under development
 
Code:
click to view

◆ get_Entries_for_target()

public Arrayref Bio::EnsEMBL::IdMapping::ScoredMappingMatrix::get_Entries_for_target ( )
  Arg[1]      : Int $target - target object's internal Id ("dbID")
  Example     :
my @entries = @{ $gene_scores->get_Entries_for_target(5678) };
  Description : Returns a list of all Entries in the scoring matrix for a given
                target object.
  Return type : Arrayref of Bio::EnsEMBL::IdMapping::Entry objects
  Exceptions  : none
  Caller      : general
  Status      : At Risk
              : under development
 
Code:
click to view

◆ get_Entry()

public Bio::EnsEMBL::IdMapping::Entry Bio::EnsEMBL::IdMapping::ScoredMappingMatrix::get_Entry ( )
  Arg[1]      : Int $source - source object's internal Id ("dbID")
  Arg[2]      : Int $target - target object's internal Id ("dbID")
  Example     :
my $entry = $gene_scores->get_Entry($source_gene->id,
$target_gene->id);
  Description : Gets an Entry from the scoring matrix for a given source and
                target object.
  Return type : Bio::EnsEMBL::IdMapping::Entry or undef
  Exceptions  : none
  Caller      : general
  Status      : At Risk
              : under development
 
Code:
click to view

◆ get_entry_count()

public Int Bio::EnsEMBL::IdMapping::ScoredMappingMatrix::get_entry_count ( )
  Example     :
my $num_entries = $gene_scores->get_entry_count;
  Description : Returns the number of Entries in the scoring matrix.
  Return type : Int
  Exceptions  : none
  Caller      : general
  Status      : At Risk
              : under development
 
Code:
click to view

◆ get_min_max_scores()

public Arrayref Bio::EnsEMBL::IdMapping::ScoredMappingMatrix::get_min_max_scores ( )
  Example     :
my ($min_score, $max_score) =
@{ $gene_scores->get_min_max_scores };
  Description : Returns the mininum and maximum score in the scoring matrix.
  Return type : Arrayref of Float [min_score, max_score]
  Exceptions  : none
  Caller      : general
  Status      : At Risk
              : under development
 
Code:
click to view

◆ get_score()

public Float Bio::EnsEMBL::IdMapping::ScoredMappingMatrix::get_score ( )
  Arg[1]      : Int $source - source object's internal Id ("dbID")
  Arg[2]      : Int $target - target object's internal Id ("dbID")
  Example     :
my $score = $gene_scores->get_score($source_gene->id,
$target_gene->id);
  Description : Gets the score from the scoring matrix for a given source and
                target object.
  Return type : Float or undef
  Exceptions  : none
  Caller      : general
  Status      : At Risk
              : under development
 
Code:
click to view

◆ get_source_count()

public Int Bio::EnsEMBL::IdMapping::ScoredMappingMatrix::get_source_count ( )
  Example     :
my $num_sources = $gene_scores->get_source_count;
  Description : Returns the number of distinct sources in the scoring matrix.
  Return type : Int
  Exceptions  : none
  Caller      : general
  Status      : At Risk
              : under development
 
Code:
click to view

◆ get_sources_for_target()

public Arrayref Bio::EnsEMBL::IdMapping::ScoredMappingMatrix::get_sources_for_target ( )
  Arg[1]      : Int $target - target object's internal Id ("dbID")
  Example     :
my @sources = @{ $gene_scores->get_sources_for_target(5678) };
  Description : Returns a list of all sources which have a score against a given
                target object.
  Return type : Arrayref of Int (source objects' internal Ids)
  Exceptions  : none
  Caller      : general
  Status      : At Risk
              : under development
 
Code:
click to view

◆ get_target_count()

public Int Bio::EnsEMBL::IdMapping::ScoredMappingMatrix::get_target_count ( )
  Example     :
my $num_targets = $gene_scores->get_target_count;
  Description : Returns the number of distinct targets in the scoring matrix.
  Return type : Int
  Exceptions  : none
  Caller      : general
  Status      : At Risk
              : under development
 
Code:
click to view

◆ get_targets_for_source()

public Arrayref Bio::EnsEMBL::IdMapping::ScoredMappingMatrix::get_targets_for_source ( )
  Arg[1]      : Int $source - source object's internal Id ("dbID")
  Example     :
my @targets = @{ $gene_scores->get_targets_for_source(1234) };
  Description : Returns a list of all targets which have a score against a given
                source object.
  Return type : Arrayref of Int (target objects' internal Ids)
  Exceptions  : none
  Caller      : general
  Status      : At Risk
              : under development
 
Code:
click to view

◆ log()

public void Bio::EnsEMBL::IdMapping::ScoredMappingMatrix::log ( )
  Arg[1]      : String $type - object type (e.g. 'gene')
  Arg[2]      : String $dump_path - path for writing output
  Example     :
$gene_scores->log('gene', $conf->param('basedir'));
  Description : Logs all Entries in the scoring matrix to a file. Used for
                debugging.
  Return type : none
  Exceptions  : thrown on I/0 error
  Caller      : general
  Status      : At Risk
              : under development
 
Code:
click to view

◆ merge()

public Int Bio::EnsEMBL::IdMapping::ScoredMappingMatrix::merge ( )
  Arg[1]      : Bio::EnsEMBL::IdMapping::ScoredMappingMatrix $matrix - another
                matrix to merge with
  Example     :
my $update_count = $gene_scores->merge($more_gene_scores);
  Description : Merges two scoring matrices. If there's an Entry for a
                source/target pair in both matrices, the higher score will be
                retained.
  Return type : Int - number of Entries added or updated
  Exceptions  : thrown on wrong or missing argument
  Caller      : general
  Status      : At Risk
              : under development
 
Code:
click to view

◆ new()

public Bio::EnsEMBL::IdMapping::ScoredMappingMatrix Bio::EnsEMBL::IdMapping::ScoredMappingMatrix::new ( )
  Arg[1-N]    : see superclass
  Example     :
-DUMP_PATH => $dump_path,
-CACHE_FILE => 'gene_scores.ser',
);
  Description : Constructor.
  Return type : Bio::EnsEMBL::IdMapping::ScoredMappingMatrix
  Exceptions  : none
  Caller      : general
  Status      : At Risk
              : under development
 
Code:
click to view

◆ remove_Entry()

public Bio::EnsEMBL::IdMapping::ScoredMappingMatrix::remove_Entry ( )

Undocumented method

Code:
click to view

◆ set_score()

public Float Bio::EnsEMBL::IdMapping::ScoredMappingMatrix::set_score ( )
  Arg[1]      : Int $source - source object's internal Id ("dbID")
  Arg[2]      : Int $target - target object's internal Id ("dbID")
  Arg[3]      : Float $score - score for source/target pair
  Example     :
$gene_scores->set_score(1234, 5678, 0.997);
  Description : Sets the score for a source/target pair in the scoring matrix.
                This method is similar to add_score, but assumes that the Entry
                has been added before, so won't update the sources and target
                lists.
  Return type : Float - the score
  Exceptions  : none
  Caller      : general
  Status      : At Risk
              : under development
 
Code:
click to view

◆ size()

public Int Bio::EnsEMBL::IdMapping::ScoredMappingMatrix::size ( )
  Example     :
my $size = $gene_scores->size;
  Description : Returns the size of the scoring matrix. Same value as returned
                by get_entry_count().
  Return type : Int
  Exceptions  : none
  Caller      : general
  Status      : At Risk
              : under development
 
Code:
click to view

◆ sub_matrix()

public Bio::EnsEMBL::IdMapping::ScoredMappingMatrix Bio::EnsEMBL::IdMapping::ScoredMappingMatrix::sub_matrix ( )
  Arg[1]      : Int $start - start index (inclusive)
  Arg[2]      : Int $end - end index (inclusive)
  Example     :
# get the first 1000 elements in the matrix
my $sub_matrix = $gene_scores->sub_matrix(1, 1000);
  Description : Returns a sub-matrix of the ScoredMappingMatrix. The arguments
                ($start and $end) specify the position of the first and last
                element to return (inclusive, counting starts with element 1,
                not 0)
  Return type : Bio::EnsEMBL::IdMapping::ScoredMappingMatrix
  Exceptions  : none
  Caller      : general
  Status      : At Risk
              : under development
 
Code:
click to view

◆ to_string()

public String Bio::EnsEMBL::IdMapping::ScoredMappingMatrix::to_string ( )
  Example     :
print LOG $gene_scores->to_string, "\n";
  Description : Returns a string representation of the scoring matrix. This is
                simply a multi-line string, where each line is a stringified
                Entry.
                Useful for debugging and logging.
  Return type : String
  Exceptions  : none
  Caller      : general
  Status      : At Risk
              : under development
 
Code:
click to view

◆ update_Entry()

public Float Bio::EnsEMBL::IdMapping::ScoredMappingMatrix::update_Entry ( )
  Arg[1]      : Bio::EnsEMBL::IdMapping::Entry $entry - Entry to update
  Example     :
$gene_scores->update_Entry($entry);
  Description : Updates an Entry (or rather its score) in the scoring matrix.
                Actually delegates to add_Entry(), only there as an intuitively
                named wrapper.
  Return type : Float - the Entry's score
  Exceptions  : thrown on wrong or missing argument
  Caller      : general
  Status      : At Risk
              : under development
 
Code:
click to view

The documentation for this class was generated from the following file:
Bio::EnsEMBL::IdMapping::Entry
Definition: Entry.pm:16
Bio::EnsEMBL::IdMapping::ScoredMappingMatrix::get_Entries_for_target
public Arrayref get_Entries_for_target()
Bio::EnsEMBL::IdMapping::ScoredMappingMatrix::to_string
public String to_string()
Bio::EnsEMBL::IdMapping::ScoredMappingMatrix::get_min_max_scores
public Arrayref get_min_max_scores()
Bio::EnsEMBL::IdMapping::ScoredMappingMatrix::add_score
public Float add_score()
map
public map()
Bio::EnsEMBL::IdMapping::ScoredMappingMatrix::get_average_score
public Float get_average_score()
Bio::EnsEMBL::IdMapping::ScoredMappingMatrix::get_score
public Float get_score()
Bio::EnsEMBL::IdMapping::ScoredMappingMatrix::get_sources_for_target
public Arrayref get_sources_for_target()
Bio::EnsEMBL::IdMapping::ScoredMappingMatrix::flush
public void flush()
Bio::EnsEMBL::IdMapping::ScoredMappingMatrix
Definition: ScoredMappingMatrix.pm:44
Bio::EnsEMBL::IdMapping::ScoredMappingMatrix::get_target_count
public Int get_target_count()
Bio::EnsEMBL::IdMapping::ScoredMappingMatrix::update_Entry
public Float update_Entry()
Bio::EnsEMBL::IdMapping::ScoredMappingMatrix::size
public Int size()
Bio::EnsEMBL::IdMapping::ScoredMappingMatrix::add_Entry
public Float add_Entry()
Bio::EnsEMBL::IdMapping::ScoredMappingMatrix::get_all_sources
public Arrayref get_all_sources()
Bio::EnsEMBL::IdMapping::ScoredMappingMatrix::merge
public Int merge()
Bio::EnsEMBL::IdMapping::ScoredMappingMatrix::sub_matrix
public Bio::EnsEMBL::IdMapping::ScoredMappingMatrix sub_matrix()
Bio::EnsEMBL::IdMapping::ScoredMappingMatrix::set_score
public Float set_score()
Bio::EnsEMBL::IdMapping::ScoredMappingMatrix::new
public Bio::EnsEMBL::IdMapping::ScoredMappingMatrix new()
Bio::EnsEMBL::IdMapping::ScoredMappingMatrix::get_all_targets
public Arrayref get_all_targets()
Bio::EnsEMBL::IdMapping::ScoredMappingMatrix::remove_Entry
public remove_Entry()
Bio::EnsEMBL::IdMapping::ScoredMappingMatrix::log
public void log()
Bio::EnsEMBL::IdMapping::Serialisable::read_from_file
public Bio::EnsEMBL::IdMapping::Serialisable read_from_file()
Bio::EnsEMBL::IdMapping::ScoredMappingMatrix::get_all_Entries
public Arrayref get_all_Entries()
Bio::EnsEMBL::IdMapping::ScoredMappingMatrix::get_Entries_for_source
public Arrayref get_Entries_for_source()
Bio::EnsEMBL::IdMapping::ScoredMappingMatrix::get_Entry
public Bio::EnsEMBL::IdMapping::Entry get_Entry()
Bio::EnsEMBL::IdMapping::ScoredMappingMatrix::get_source_count
public Int get_source_count()
Bio::EnsEMBL::IdMapping::ScoredMappingMatrix::get_targets_for_source
public Arrayref get_targets_for_source()
Bio::EnsEMBL::IdMapping::Entry::new_fast
public A new_fast()
Bio::EnsEMBL::IdMapping::ScoredMappingMatrix::get_entry_count
public Int get_entry_count()