Skip to contents

Determines the chromosome arm for each segment in each chromosome. This is determined by the positions given in centromere_positions. Segments before centromere are in Chr_N (first arm), segments after centromere are in Chr_N.5 (second arm). '

The procedure goes like this. For each chromosome, the segments that are before its middle position have their chromosome arm set to 1. The segments that are after the middle position have their chromosome arm set to 2. Then, the chromosome arm column is: chromosome_arm = chromosome_number + (chromosome_arm - 1)/2 So the segments whose arm was 1 have 0 added to their chromosome number, meaning that if a segment its chromosome arm is Chr_N. But, the segments whose arm was 2 have 1 added to their chromosome number, meaning that its chromosome arm is Chr_N.5.

Edge case: segments that start before the middle pos but end after the middle pos. In that case, we split it into 2 and proceed like above.

Usage

AddChromosomeArmHelper(df, include_chr_X, centromere_positions)

Arguments

df

The Data Frame to modify. Column numbers are same as in RemoveCentromereTelomeres.

include_chr_X

A boolean. Whether to set chromosome arms for segments in Chr X/23 or not.

centromere_positions

An array: the middle positions for each chromosome IN ORDER from 1 to 23.