Extracts 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
)

Arguments

haplotype_cn

A list containing haplotype-specific copy number matrices

haplotype

Character string specifying which haplotype to analyze (must be a name in the haplotype_cn list)

chr

Character string specifying the chromosome of interest (e.g., "chr1", "chrX")

interested_region_indices

Numeric vector of indices specifying which regions within the chromosome to analyze

Value

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

Details

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

See also

Other functions for manipulating copy number profiles in the package

Examples

# 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