Skip to contents

This function processes junction abundance data from multiple samples to create a splicing modality inclusion matrix (M1). It merges event data, handles start and end coordinate groups, ensures matrix compatibility, and includes robust error handling.

Usage

make_m1(junction_ab_object, min_counts = 1, verbose = FALSE)

Arguments

junction_ab_object

A named list where each element represents a sample's junction abundance data. Each element must contain eventdata and a sparse matrix.

min_counts

Numeric (default 1). Minimum count threshold for filtering events. Events with total counts below this threshold will be removed.

verbose

Logical (default FALSE). If TRUE, prints detailed progress messages during processing.

Value

A list containing the processed data from all samples:

m1_inclusion_matrix

A matrix representing the processed inclusion values for all events across all samples.

event_data

A data.table containing the merged and grouped metadata for each event.

Details

The function requires the following libraries: data.table, and Matrix.

Examples

# Example usage
junction_abundance_object <- load_toy_SJ_object()
result <- make_m1(junction_abundance_object)
#> Starting M1 matrix creation...
#> Combined eventdata from 1 samples
#> Found 915 unique junctions
#> Creating coordinate groups...
#> Start coordinate alternative events: 25 
#> End coordinate alternative events: 31 
#> Combined eventdata has 56 alternative splicing events
#> Processing junction abundance matrices...
#> Applying count threshold filtering...
#> Filtered from 56 to 23 events
#> Events removed: 33 
#> Finished processing M1.
#> 
#> Summary:
#>   Input junctions: 915 
#>   Alternative splicing events: 56 
#>   Events passing threshold: 23 
#>   Total cells: 4120 
m1_matrix <- result$m1_inclusion_matrix
event_metadata <- result$event_data