Subset a (counts) matrix based on the column from a dataframe.

Usage

subset_matrix(s, mat, colname = "SampleID")

Arguments

s
a sample data dataframe
mat
a counts matrix
colname
the name of the column to use for subsetting

Value

the subsetted matrix

Description

This is useful for subsetting a counts matrix based on the sample IDs present in the sample data dataframe. It then prunes the matrix to remove any rows whose sums are 0.