gavinha / TitanCNA

Analysis of subclonal copy number alterations (CNA) and loss of heterozygosity (LOH) in cancer
GNU General Public License v3.0
93 stars 36 forks source link

titanCNA.R excluding chromosome X for males by default despite correction #53

Closed fpbarthel closed 5 years ago

fpbarthel commented 5 years ago

Why does titanCNA.R exclude sex chromosomes for males? https://github.com/gavinha/TitanCNA/blob/2a7e268352322c089cf092ff43cbc3a250f36e1b/scripts/R_scripts/titanCNA.R#L191-L194

It seems that correctIntegerCN already adjusts for sex, so no need to remove X for males? https://github.com/gavinha/TitanCNA/blob/master/R/utils.R#L1213-L1227

    # Adjust chrX copy number if purity is sufficiently high
    # males - all data points in chrX is corrected
    # females - only  
    if (purity >= minPurityToCorrect){
        if (gender == "male" & length(chrXStr) > 0){
            segs[Chromosome == chrXStr, Corrected_Copy_Number := as.integer(round(logR_Copy_Number))]
            segs[Chromosome == chrXStr, Corrected_Call := names[Corrected_Copy_Number + 2]]
            cn[Chr == chrXStr, Corrected_Copy_Number := as.integer(round(logR_Copy_Number))]
            cn[Chr == chrXStr, Corrected_Call := names[Corrected_Copy_Number + 2]]
        }else if (gender == "female"){
            segs[Chromosome == chrXStr & Copy_Number >= maxCNtoCorrect.X, Corrected_Copy_Number := as.integer(round(logR_Copy_Number))]
            segs[Chromosome == chrXStr & Copy_Number >= maxCNtoCorrect.X, Corrected_Call := "HLAMP"]
            cn[Chr == chrXStr & CopyNumber >= maxCNtoCorrect.X, Corrected_Copy_Number := as.integer(round(logR_Copy_Number))]
            cn[Chr == chrXStr & CopyNumber >= maxCNtoCorrect.X, Corrected_Call := "HLAMP"]
        }
gavinha commented 5 years ago

Hi @fpbarthel

TITAN ignores chrX because it doesn't contain germline heterozygous SNPs for allelic copy number analysis. I have been working to include the total copy number of chrX that is output by ichorCNA in the intermediate step. This correctIntegerCN function corrects copy number genome-wide and also accounts for chrX in males - but this is only for total copy number.

I haven't added this into the TitanCNA snakemake pipeline yet but I have been using this for my 10X Genomics analysis https://github.com/gavinha/TitanCNA_10X_snakemake/blob/master/code/combineTITAN-ichor.R

I will eventually port this over to the original TitanCNA snakemake workflow as well. In the meantime, if you are interested, you can look at that script to see how I combine the results.

https://github.com/gavinha/TitanCNA_10X_snakemake/blob/ba8ca730ccfa9580ff58c5fe3d37159809e6ee37/TitanCNA.snakefile#L74-L96

fpbarthel commented 5 years ago

Thanks!