Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug in HRD-LOH calculation (copy-number-scores.R) causing loss of HRD-LOH information #61

Open
danielmuldoon opened this issue Nov 9, 2023 · 0 comments

Comments

@danielmuldoon
Copy link

calculate_hrdloh function bug

To reproduce the bug: find a tumor-normal sample with only one complete chromosome deletion. This deletion must be homozygous. Slack me for specific tumor-normal examples from IMPACT.

Situation: when there are no *“existing” chromosomes in chr_del, the calculation sets segs_loh to NA/NULL and we lose all HRDLOH information for that sample. For example, a sample segs dataframe has chrom=19, but entire chromosome 19 is 0:0 (mcn:lcn), so chromosome 19 gets filtered out at initial step, and no longer exists in segs_loh to be filtered out by chr_del list. Since chrom 19 is the only deleted chromosome and happens to be a homozygous deletion, the calculation is trying to pass something that exists in chr_del but doesn't exist in segs_loh when trying to filter out that chromosome in the final step. If chromosome 19 was a heterozygous deletion 1:0 (mcn:lcn), this error would not occur. If chromosome 20 was deleted as well (1:0), this error would not occur.

“Initial” step of HRDLOH calculation:
segs_loh = segs_loh[which(segs_loh$lcn == 0 & segs_loh$mcn != 0), ]

once filtered out, then chrom 19 no longer exists in segs_loh (but still exists in chr_del)

“Final” step of HRDLOH calculation after filtering out 0:0 segments:
segs_loh = segs_loh[-which(segs_loh$chrom %in% chr_del)

Potential solutions:

  1. Move the “final” step chronologically above the "initial" step? May cause yet foreseen bugs
  2. Change base R final step solution to a dplyr method that can better handle the NA/Null that is created when there are “existing” chromosomes in chr_del but not segs_loh i.e.:
if (length(chr_del) > 0) {
        segs_loh = segs_loh %>% filter(!(chrom %in% chr_del))
    }

*“exisiting”: chromosomes that are in the chr_del list but not in segs_loh dataframe

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant