NAME

Bio::Gonzales::SummarizedExperiment - represent experimental matrix-like data (assay) with features and sample info

SYNOPSIS

DESCRIPTION

http://bioconductor.org/packages/devel/bioc/vignettes/SummarizedExperiment/inst/doc/SummarizedExperiment.html

ATTRIBUTES

assay

my $assay = $se->assay;

Return the assay of the summarized experiment.

col_data

my $col_data = $se->col_data;
$se->col_data(\@col_data);

row_data

row_names

col_names

row_data_names

col_data_names

meta_data

na_value

Set the NA value if the object is stored. Internally, while in memory, undef will be used. So this value will only have an effect if data is read or written somewhere. Default is Bio::Gonzales::SummarizedExperiment::NA_VALUE.

METHODS

data

my $assay = $se->data;

A alias for assay.

add_col

add_cols

add_rows

aggregate

$se = $se->aggregate_by_idcs(\@idcs, sub { ... }, \@col_names)

The callback gets passed the grouping keys, rows and row indices. $_ is set to the group has that comes from the (internally used) $se->group function.

sub {
  my ($key, $rows, $row_idcs) = @_;
  my $group = $_;
}

$se = $se->aggregate_by_names(\@names, sub { ... }, \@col_names)

apply

as_hash

cbind

clone

col_apply

col_idx

col_idx_map

my $I = $se->col_idx_map;
my %I = $se->col_idx_map;

Returns a hash that maps the column names to their column index. col_idx_map is context sensitve and returns a hash in list context and a hash reference in scalar context.

col_idx_match

col_names_to_idcs

col_rename

dim

each

extract_col_by_idx

extract_col_by_name

group

group_by_idcs

group_by_names

has_col_data

has_col_names

has_row_data

has_row_names

header_idx

header_idx_match

inconsistencies

json_spew

make_consistent

merge

Merge two SummarizedExperiment objects.

use Bio::Gonzales::SummarizedExperiment;
my $se_x = Bio::Gonzales::SummarizedExperiment->new(
  assay => [ [ 1, "homer", "simpson" ], [ 2, "bart", "simpson" ], [ 3, "lisa simpson" ] ],
  col_names => [qw(user_id first_name surname)]
);

my $se_y = Bio::Gonzales::SummarizedExperiment->new(
  assay => [ [ 1, 120 ], [ 2, 20 ] ],
  col_names => [qw(user_id weight_kg)]
);

# inner join by default
my $merged_se = $se_x->merge($se_y, { by => [ 'user_id' ] });

# user_id first_name surname weight_kg
# 1       homer      simpson 120
# 2       bart       simpson 20
# Lisa is missing, because the $se_y lacks weight information.

names_to_idcs

ncol

nrow

rbind

row_apply

Apply a callback to each row. $se-row_apply(@args)> is equivalent to $se-apply(1, @args)>

use Bio::Gonzales::SummarizedExperiment;
my $se = Bio::Gonzales::SummarizedExperiment->new(
  assay => [ [ 1, "homer", "simpson" ], [ 2, "bart", "simpson" ], [ 3, "lisa", "simpson" ] ],
  col_names => [qw(user_id first_name surname)]
);

# WITHOUT MODIFYING THE SUMMARIZEDEXPERIMENT OBJECT
$se->row_apply(sub { (my $name = $_->[1]) =~ s/[ra]/z/; $name });
# [ 'homez', 'bzrt', 'lisz' ];

$se->extract_col_by_idx(1);
# [ 'homer', 'bart', 'lisa' ];


# WITH MODIFYING THE SUMMARIZEDEXPERIMENT OBJECT
$se->row_apply(sub { $_->[1] =~ s/[ra]/z/; $_->[1] });
# [ 'homez', 'bzrt', 'lisz' ];

$se->extract_col_by_idx(1);
# [ 'homez', 'bzrt', 'lisz' ];

row_idx

row_idx_map

row_idx_match

shuffle

slice_by_idcs

$se->slice_by_idcs(\@idcs);
$se->slice_by_idcs([0,5,13]);

Extract a column-"slice" from the summarized experiment. The indices select the columns.

slice_by_names

slurp_assay

my $se = Bio::Gonzales::SummarizedExperiment->slurp_assay($source, \%params);
my $se = Bio::Gonzales::SummarizedExperiment->slurp_assay("data.csv", { header => 1, sep => ';' });

Create a new summarized experiment from matrix/tabular data.

sort

spew_assay

subset

encode_as_json

transpose

uniq

LIMITATIONS

NOTES

By convention,

  • constructor or function arguments ending in ? are optional

  • methods ending in ! will modify the object it is called on

SEE ALSO

AUTHOR

jw bargsten, <jwb at cpan dot org>