Skip to contents

Converts a count matrix to a long data frame format using geneID as the identifier.

Usage

countMatrix_2longDtf(countMatrix, value_name = "kij", id_vars = "geneID")

Arguments

countMatrix

Count matrix

value_name

Name for the value column

id_vars

Name for the id column (default "geneID")

Value

Long data frame

Examples

list_var <- init_variable()
#> Variable name should not contain digits, spaces, or special characters.
#> If any of these are present, they will be removed from the variable name.
mock_data <- mock_rnaseq(list_var, n_genes = 3, 2, 2)
#> Building mu_ij matrix
#> INFO: 1 genes have all(mu_ij) < 1, indicating very low counts. Consider removing them for future analysis using prepareData2fit with row_threshold = 10. To detect them in future experiment, try increasing sequencing depth.
#> k_ij ~ Nbinom(mu_ij, dispersion)
#> Counts simulation: Done
countMatrix_2longDtf(mock_data$counts)
#>    geneID      sampleID kij
#> 1   gene1 myVariable1_1   0
#> 2   gene2 myVariable1_1   0
#> 3   gene3 myVariable1_1   1
#> 4   gene1 myVariable1_2   1
#> 5   gene2 myVariable1_2   3
#> 6   gene3 myVariable1_2   1
#> 7   gene1 myVariable2_1   0
#> 8   gene2 myVariable2_1   1
#> 9   gene3 myVariable2_1   0
#> 10  gene1 myVariable2_2   1
#> 11  gene2 myVariable2_2   3
#> 12  gene3 myVariable2_2   1