R/segment_relevant_functions.R
initiate_seg_table.RdCreates a table of chromosome segments dividing each chromosome into p (short arm), c (centromere), and q (long arm) regions. Each segment is initialized with base state properties including positions, copy numbers, and source information.
initiate_seg_table(chr_lengths, chr_names, centromere_length, haplotype)A data frame containing segment information with columns:
haplotype: Origin of the segment (maternal/paternal)
chrom: Chromosome identifier
ref_start, ref_end: Reference coordinates
ori_start, ori_end: Original coordinates
start, end: Current coordinates
region_name: Region identifier (e.g., chr1p, chr1c, chr1q)
copy_index: Copy number index
seg_id: Unique segment identifier
CN_change: Copy number change status
seg_source_edge: Source edge information
seg_source_event: Source event information
chr_lengths <- list(maternal = c(100, 200, 300))
chr_names <- c("chr1", "chr2", "chr3")
centromere_length <- 10
seg_table <- initiate_seg_table(chr_lengths, chr_names, centromere_length, "maternal")
#> 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