Bio-KBase
view release on metacpan or search on metacpan
lib/Bio/KBase/CDMI/Client.pm view on Meta::CPAN
{
my($self, @args) = @_;
if ((my $n = @args) != 1)
{
Bio::KBase::Exceptions::ArgumentValidationError->throw(error =>
"Invalid argument count for function fids_to_subsystems (received $n, expecting 1)");
}
{
my($fids) = @args;
my @_bad_arguments;
(ref($fids) eq 'ARRAY') or push(@_bad_arguments, "Invalid type for argument 1 \"fids\" (value was \"$fids\")");
if (@_bad_arguments) {
my $msg = "Invalid arguments passed to fids_to_subsystems:\n" . join("", map { "\t$_\n" } @_bad_arguments);
Bio::KBase::Exceptions::ArgumentValidationError->throw(error => $msg,
method_name => 'fids_to_subsystems');
}
}
my $result = $self->{client}->call($self->{url}, {
method => "CDMI_API.fids_to_subsystems",
params => \@args,
});
if ($result) {
if ($result->is_error) {
Bio::KBase::Exceptions::JSONRPC->throw(error => $result->error_message,
code => $result->content->{code},
method_name => 'fids_to_subsystems',
);
} else {
return wantarray ? @{$result->result} : $result->result->[0];
}
} else {
Bio::KBase::Exceptions::HTTP->throw(error => "Error invoking method fids_to_subsystems",
status_line => $self->{client}->status_line,
method_name => 'fids_to_subsystems',
);
}
}
=head2 $result = fids_to_co_occurring_fids(fids)
One of the most powerful clues to function relates to conserved clusters of genes on
the chromosome (in prokaryotic genomes). We have attempted to record pairs of genes
that tend to occur close to one another on the chromosome. To meaningfully do this,
we need to construct similarity-based mappings between genes in distinct genomes.
We have constructed such mappings for many (but not all) genomes maintained in the
Kbase CS. The prokaryotic geneomes in the CS are grouped into OTUs by ribosomal
RNA (genomes within a single OTU have SSU rRNA that is greater than 97% identical).
If two genes occur close to one another (i.e., corresponding genes occur close
to one another), then we assign a score, which is the number of distinct OTUs
in which such clustering is detected. This allows one to normalize for situations
in which hundreds of corresponding genes are detected, but they all come from
very closely related genomes.
The significance of the score relates to the number of genomes in the database.
We recommend that you take the time to look at a set of scored pairs and determine
approximately what percentage appear to be actually related for a few cutoff values.
=cut
sub fids_to_co_occurring_fids
{
my($self, @args) = @_;
if ((my $n = @args) != 1)
{
Bio::KBase::Exceptions::ArgumentValidationError->throw(error =>
"Invalid argument count for function fids_to_co_occurring_fids (received $n, expecting 1)");
}
{
my($fids) = @args;
my @_bad_arguments;
(ref($fids) eq 'ARRAY') or push(@_bad_arguments, "Invalid type for argument 1 \"fids\" (value was \"$fids\")");
if (@_bad_arguments) {
my $msg = "Invalid arguments passed to fids_to_co_occurring_fids:\n" . join("", map { "\t$_\n" } @_bad_arguments);
Bio::KBase::Exceptions::ArgumentValidationError->throw(error => $msg,
method_name => 'fids_to_co_occurring_fids');
}
}
my $result = $self->{client}->call($self->{url}, {
method => "CDMI_API.fids_to_co_occurring_fids",
params => \@args,
});
if ($result) {
if ($result->is_error) {
Bio::KBase::Exceptions::JSONRPC->throw(error => $result->error_message,
code => $result->content->{code},
method_name => 'fids_to_co_occurring_fids',
);
} else {
return wantarray ? @{$result->result} : $result->result->[0];
}
} else {
Bio::KBase::Exceptions::HTTP->throw(error => "Error invoking method fids_to_co_occurring_fids",
status_line => $self->{client}->status_line,
method_name => 'fids_to_co_occurring_fids',
);
}
}
=head2 $result = fids_to_locations(fids)
A "location" is a sequence of "regions". A region is a contiguous set of bases
in a contig. We work with locations in both the string form and as structures.
fids_to_locations takes as input a list of fids. For each fid, a structured location
is returned. The location is a list of regions; a region is given as a pointer to
a list containing
the contig,
the beginning base in the contig (from 1).
the strand (+ or -), and
the length
lib/Bio/KBase/CDMI/Client.pm view on Meta::CPAN
{
Bio::KBase::Exceptions::ArgumentValidationError->throw(error =>
"Invalid argument count for function get_relationship_HadResultsProducedBy (received $n, expecting 4)");
}
{
my($ids, $from_fields, $rel_fields, $to_fields) = @args;
my @_bad_arguments;
(ref($ids) eq 'ARRAY') or push(@_bad_arguments, "Invalid type for argument 1 \"ids\" (value was \"$ids\")");
(ref($from_fields) eq 'ARRAY') or push(@_bad_arguments, "Invalid type for argument 2 \"from_fields\" (value was \"$from_fields\")");
(ref($rel_fields) eq 'ARRAY') or push(@_bad_arguments, "Invalid type for argument 3 \"rel_fields\" (value was \"$rel_fields\")");
(ref($to_fields) eq 'ARRAY') or push(@_bad_arguments, "Invalid type for argument 4 \"to_fields\" (value was \"$to_fields\")");
if (@_bad_arguments) {
my $msg = "Invalid arguments passed to get_relationship_HadResultsProducedBy:\n" . join("", map { "\t$_\n" } @_bad_arguments);
Bio::KBase::Exceptions::ArgumentValidationError->throw(error => $msg,
method_name => 'get_relationship_HadResultsProducedBy');
}
}
my $result = $self->{client}->call($self->{url}, {
method => "CDMI_EntityAPI.get_relationship_HadResultsProducedBy",
params => \@args,
});
if ($result) {
if ($result->is_error) {
Bio::KBase::Exceptions::JSONRPC->throw(error => $result->error_message,
code => $result->content->{code},
method_name => 'get_relationship_HadResultsProducedBy',
);
} else {
return wantarray ? @{$result->result} : $result->result->[0];
}
} else {
Bio::KBase::Exceptions::HTTP->throw(error => "Error invoking method get_relationship_HadResultsProducedBy",
status_line => $self->{client}->status_line,
method_name => 'get_relationship_HadResultsProducedBy',
);
}
}
=head2 $result = get_relationship_ProjectsOnto(ids, from_fields, rel_fields, to_fields)
This relationship connects two protein sequences for which a clear
bidirectional best hit exists in known genomes. The attributes of the
relationship describe how good the relationship is between the proteins.
The relationship is bidirectional and symmetric, but is only stored in
one direction (lower ID to higher ID).
It has the following fields:
=over 4
=item gene_context
number of homologous genes in the immediate context of the
two proteins, up to a maximum of 10
=item percent_identity
percent match between the two protein sequences
=item score
score describing the strength of the projection, from 0 to 1,
where 1 is the best
=back
=cut
sub get_relationship_ProjectsOnto
{
my($self, @args) = @_;
if ((my $n = @args) != 4)
{
Bio::KBase::Exceptions::ArgumentValidationError->throw(error =>
"Invalid argument count for function get_relationship_ProjectsOnto (received $n, expecting 4)");
}
{
my($ids, $from_fields, $rel_fields, $to_fields) = @args;
my @_bad_arguments;
(ref($ids) eq 'ARRAY') or push(@_bad_arguments, "Invalid type for argument 1 \"ids\" (value was \"$ids\")");
(ref($from_fields) eq 'ARRAY') or push(@_bad_arguments, "Invalid type for argument 2 \"from_fields\" (value was \"$from_fields\")");
(ref($rel_fields) eq 'ARRAY') or push(@_bad_arguments, "Invalid type for argument 3 \"rel_fields\" (value was \"$rel_fields\")");
(ref($to_fields) eq 'ARRAY') or push(@_bad_arguments, "Invalid type for argument 4 \"to_fields\" (value was \"$to_fields\")");
if (@_bad_arguments) {
my $msg = "Invalid arguments passed to get_relationship_ProjectsOnto:\n" . join("", map { "\t$_\n" } @_bad_arguments);
Bio::KBase::Exceptions::ArgumentValidationError->throw(error => $msg,
method_name => 'get_relationship_ProjectsOnto');
}
}
my $result = $self->{client}->call($self->{url}, {
method => "CDMI_EntityAPI.get_relationship_ProjectsOnto",
params => \@args,
});
if ($result) {
if ($result->is_error) {
Bio::KBase::Exceptions::JSONRPC->throw(error => $result->error_message,
code => $result->content->{code},
method_name => 'get_relationship_ProjectsOnto',
);
} else {
return wantarray ? @{$result->result} : $result->result->[0];
}
} else {
Bio::KBase::Exceptions::HTTP->throw(error => "Error invoking method get_relationship_ProjectsOnto",
status_line => $self->{client}->status_line,
method_name => 'get_relationship_ProjectsOnto',
);
}
}
( run in 1.159 second using v1.01-cache-2.11-cpan-39bf76dae61 )