FilterMaf by ranges
1
1
Entering edit mode
Jeni ▴ 10
@jeni-23673
Last seen 2.0 years ago
Spain

Hi!

I am trying to filter a MAF by removing its variants by coordinates. To do that, I have a dataframe with 3 columns (chr, start, end). My problem is that I can only use subsetMaf to do that, as filterMaf has no "ranges" option. By subsetting, I can only get those variants occuring in the regions of the data frame, while I am looking for the variants NOT occuring there.

I have tryed to subset the MAF in order to get those variants that I want to remove, and then I have used setdiffMaf to get those variants which are different between this set and the original one, but I am getting the following error.

maf2 <- subsetMaf(maf, ranges = mydf)
expectedmaf <- setdiffMAF(maf1, maf2, refAltMatch = F)

Error in :=(maf_slot, NULL) : Check that is.data.table(DT) == TRUE. Otherwise, := and :=(...) are defined for use in j, once only and in particular ways. See help(":=").

sessionInfo( )

R version 4.0.4 (2021-02-15)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19042)

Matrix products: default

locale:
[1] LC_COLLATE=Spanish_Spain.1252  LC_CTYPE=Spanish_Spain.1252    LC_MONETARY=Spanish_Spain.1252 LC_NUMERIC=C                  
[5] LC_TIME=Spanish_Spain.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] data.table_1.14.0 bedr_1.0.7        dplyr_1.0.4       ggplot2_3.3.5     maftools_2.6.05   xlsx_0.6.5       

loaded via a namespace (and not attached):
 [1] formatR_1.11         pillar_1.6.4         compiler_4.0.4       RColorBrewer_1.1-2   BiocManager_1.30.16  futile.logger_1.4.3  R.methodsS3_1.8.1   
 [8] R.utils_2.11.0       futile.options_1.0.1 tools_4.0.4          pkgload_1.2.3        testthat_3.0.2       lifecycle_1.0.1      tibble_3.0.6        
[15] gtable_0.3.0         lattice_0.20-41      pkgconfig_2.0.3      rlang_0.4.10         Matrix_1.3-2         DBI_1.1.1            parallel_4.0.4      
[22] yaml_2.2.1           VennDiagram_1.6.20   rJava_0.9-13         withr_2.4.2          desc_1.4.0           generics_0.1.1       xlsxjars_0.6.1      
[29] vctrs_0.3.8          rprojroot_2.0.2      grid_4.0.4           tidyselect_1.1.1     glue_1.4.2           R6_2.5.1             fansi_0.4.2         
[36] survival_3.2-7       lambda.r_1.2.4       purrr_0.3.4          magrittr_2.0.1       scales_1.1.1         ellipsis_0.3.2       splines_4.0.4       
[43] assertthat_0.2.1     colorspace_2.0-0     utf8_1.1.4           munsell_0.5.0        crayon_1.4.1         R.oo_1.24.0

Do you know how can I solve this? or if there is an easiest way to filter a maf by coordinates?

maftools • 1.3k views
ADD COMMENT
0
Entering edit mode
Nogayhan • 0
@27fda6d5
Last seen 2.1 years ago
United Kingdom

Hello,

So, I've had the same problem and tried running the function line by line with two MAFs. When the function is running it's adding a 'maf_slot' column where the values can be 'syn' or 'nonsyn'. I've noticed that all the values I have are 'nonsyn'. I removed the parts where the function uses maf_x_unique[['syn']] like below and it works. So basically, if you have all synonymous or all non-synonymous variants the default function doesn't work.

if (!mafObj) {
maf_x_unique


} else {
maf_x_unique = split(maf_x_unique, f = maf_x_unique$maf_slot)
#maf_x_unique[['syn']][,maf_slot := NULL]
maf_x_unique[['nonsyn']][,maf_slot := NULL]


#maf_x_unique = MAF(nonSyn = maf_x_unique[['nonsyn']], syn = maf_x_unique[['syn']], clinicalData = x@clinical.data, verbose = FALSE)
maf_x_unique = MAF(nonSyn = maf_x_unique[['nonsyn']], clinicalData = x@clinical.data, verbose = FALSE)
maf_x_unique@clinical.data = droplevels(maf_x_unique@clinical.data)

#mafSummary = summarizeMaf(maf = maf_x_unique[["nonsyn"]], anno = x@clinical.data, chatty = FALSE)
# maf_x_unique = MAF(data = maf_x_unique[['nonsyn']], variants.per.sample = mafSummary$variants.per.sample, variant.type.summary = mafSummary$variant.type.summary,
#         variant.classification.summary = mafSummary$variant.classification.summary, gene.summary = mafSummary$gene.summary,
#         summary = mafSummary$summary, maf.silent = maf_x_unique[['syn']], clinical.data = droplevels(mafSummary$sample.anno))
  }
ADD COMMENT

Login before adding your answer.

Traffic: 547 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6