maftools icon indicating copy to clipboard operation
maftools copied to clipboard

sampleSwaps bugfix

Open loipf opened this issue 2 years ago • 2 comments

for samples with a low read depth, it can happen that no SNP/variant is found per sample and the vaf column in rc_af contains only NAs. This causes problems in cor.test() codeline with one argument only containing NAs when iterating over all parallel::mclapply(seq_along(rc_af), function(idx) codeline

-> simple fix with filtering beforehand for only selected samples containing SNPS which passed the min_depth requirement. also include output information about samples which have been ignored (also this could theoretically extracted by the user from the difference of SNP_readcounts$BAM and colnames(AF_table) but makes it clearer)

feel free to edit, was only a fast easy fix, it is a really nice method

loipf avatar Jan 11 '22 09:01 loipf

this does not solve the whole problem, still some edge cases can appear where not a sufficient number of SNPs (more than 1 but less than 3?) is present to calculate correlations, some threshold of a minimal number of SNPs are needed. following 2 errors occur: [1] "Error in concordant_snps[[2]] : subscript out of bounds\n" [1] "Error in cor.test.default(x$vaf, y$vaf) : not enough finite observations\n" this leads to null entries in sample_matches, leading to errors in next lapply

loipf avatar Jan 12 '22 21:01 loipf

I have encountered this bug. Can this fix be merged into the official repository?

Yunuuuu avatar Sep 08 '23 08:09 Yunuuuu