Skip to contents

Function to count how many genes are aligned with multiple factors.

Usage

getCommonFeatures(factor_features)

Arguments

factor_features

A data.frame as returned by getAlignedFeatures.

Value

A data.frame for each factor pair with the numbers and proportions of the genes in the input that overlap.

Author

Jack Gisby

Examples

# Get a random matrix with rnorm, with 100 rows (features)
# and 20 columns (observations)
X <- ReducedExperiment:::.makeRandomData(100, 20, "feature", "obs")

# Estimate 5 factors based on the data matrix
fe <- estimateFactors(X, nc = 5)

# Get the genes highly aligned with each factor
aligned_features <- getAlignedFeatures(
    fe,
    format = "data.frame",
    proportional_threshold = 0.3
)

# Identify overlap between common features for each factor
common_features <- getCommonFeatures(aligned_features)
head(common_features)
#>        c_1      c_2 intersect total_feat_1 total_feat_2 smaller_total
#> 1 factor_1 factor_1        NA            8            8             8
#> 2 factor_1 factor_2         1            8           27             8
#> 3 factor_1 factor_3         0            8           10             8
#> 4 factor_1 factor_4         0            8            8             8
#> 5 factor_1 factor_5         2            8           30             8
#> 6 factor_2 factor_1         1           27            8             8
#>   intersect_prop
#> 1             NA
#> 2          0.125
#> 3          0.000
#> 4          0.000
#> 5          0.250
#> 6          0.125