Skip to content

Commit

Permalink
fixed a bug in getActivity_individual(): invalid class "ExpressionSet…
Browse files Browse the repository at this point in the history
…" object: sampleNames differ between assayData and phenoData. This happened when a hyphen exists in colnames.
  • Loading branch information
QingfeiPan committed Sep 18, 2024
1 parent fb69be2 commit ef102c7
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion R/network_analysis.R
Original file line number Diff line number Diff line change
Expand Up @@ -828,7 +828,7 @@ getActivity_individual <- function(input_eset,
acs <- cal_Activity(target_list = target_list, cal_mat = exprs(input_eset), activity_method = activity_method, do.std = do.z_normalization)

## prepare activity eset
acs_mtx <- data.frame(acs)
acs_mtx <- data.frame(acs, check.names = FALSE)
acs_mtx <- acs_mtx[!is.na(row.names(acs_mtx)),]

if (any(is.na(acs_mtx))) {
Expand All @@ -837,6 +837,12 @@ getActivity_individual <- function(input_eset,
cat('NAs were found in the activity matrix and have been replaced by the minimum value: ', min_v, '.\n')
}

if (any(is.na(acs_mtx))) {
min_v <- min(acs_mtx, na.rm = T)
acs_mtx[is.na(acs_mtx)] <- min_v
cat('NAs were found in the activity matrix and have been replaced by the minimum value: ', min_v, '.\n')
}

acs_pd <- Biobase::pData(input_eset)
acs_pd <- acs_pd[colnames(acs_mtx),]

Expand Down

0 comments on commit ef102c7

Please sign in to comment.