R/pattern_extraction.R
subset_interested_profiles.RdExtracts copy number data for specific regions of interest from a haplotype-specific copy number profile and returns a transformed matrix with the same dimensions as the original data, where only the regions of interest contain values.
subset_interested_profiles(
haplotype_cn,
haplotype,
chr,
interested_region_indices
)A list containing haplotype-specific copy number matrices
Character string specifying which haplotype to analyze (must be a name in the haplotype_cn list)
Character string specifying the chromosome of interest (e.g., "chr1", "chrX")
Numeric vector of indices specifying which regions within the chromosome to analyze
A numeric matrix with the same dimensions as the original copy number matrix, where:
Only specified regions of interest contain copy number values
All other positions contain NA
Column names are preserved from the original matrix
The function performs these steps:
Identifies regions in the specified chromosome
Extracts copy number data for regions of interest
Creates a new matrix with same dimensions as original data
Fills in only the specified regions, leaving others as NA
Other functions for manipulating copy number profiles in the package
# Create sample haplotype copy number data
sample_cn <- list(
hap1 = matrix(1:20, nrow = 2, ncol = 10,
dimnames = list(NULL,
paste0("chr1_", 1:10))),
hap2 = matrix(2:21, nrow = 2, ncol = 10,
dimnames = list(NULL,
paste0("chr1_", 1:10)))
)
# Extract regions of interest
subset_data <- subset_interested_profiles(
haplotype_cn = sample_cn,
haplotype = "hap1",
chr = "chr1",
interested_region_indices = 2:4
)
#> Warning: restarting interrupted promise evaluation
#> Warning: internal error -3 in R_decompress1
#> Error: lazy-load database '/Library/Frameworks/R.framework/Versions/4.4-x86_64/Resources/library/cancerSimCraft/R/cancerSimCraft.rdb' is corrupt