Generates a named vector of sign values (+1 = repressive, -1 = active, 0 = unclassified)
for chromatin states based on user-specified patterns. This is typically used to
weight states in functions such as ErosionScore.
Arguments
- state_names
Character string containing a unique list of chromatin state names.
- state_col
Character string specifying the metadata column name in
chromHMM_states@elementMetadatacontaining the state names. Default ="name".- active_patterns
Character vector of regex patterns used to identify active states. Default =
c("TssA","TssFlnk","Tx","EnhA","EnhG","EnhWk").- repressive_patterns
Character vector of regex patterns used to identify repressive states. Default =
c("ReprPC","Quies","Het").- error_if_unclassified
Logical indicating whether to stop with an error if any states remain unclassified (sign = 0). Default =
FALSE(issues a message instead).
Value
A named numeric vector of signs with one entry per unique chromatin state:
-1: Active state+1: Repressive state0: Unclassified (did not match any pattern)
Details
The function:
Extracts unique chromatin state names from
chromHMM_states.Initializes all state signs to 0 (unclassified).
Assigns
-1for states matching anyactive_patterns.Assigns
+1for states matching anyrepressive_patterns.
The returned vector can be supplied to ErosionScore
as the state_signs argument.