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

Problem with cnvGWAS #21

Open
ItahisaMR opened this issue Jun 4, 2020 · 12 comments
Open

Problem with cnvGWAS #21

ItahisaMR opened this issue Jun 4, 2020 · 12 comments
Assignees

Comments

@ItahisaMR
Copy link

I am contacting you because I am following the CNVRanger manual called "Summarization and quantitative trait analysis of CNV ranges" but I am unable to complete the final GWAS.

The problem is:

segs.pvalue.gr <- cnvGWAS(phen.info, chr.code.name=chr.code.name, method.m.test="none")
Error: logical subscript contains NAs

I have checked all the input files and there are no NA values in any of them.

I follow all the step without any problem, and with your files I can get the final results. I tried to make the GDS and import the LRR/BAF values, but an error ocurr "CNV.gds' has been created or opened."

Do you know which could be the problem?

I hope you can help me, thank you in advance!

@lgeistlinger
Copy link
Collaborator

Hi @ItahisaMR - thank you for contacting us. @viniciushdasilva can you comment?

@viniciushdasilva
Copy link
Collaborator

viniciushdasilva commented Jun 5, 2020

Hi @ItahisaMR, as you can run our example without problems, I can think about two possible problems. (i) Your input is space instead tab delimited. (ii) You might be using an old version, then check with sessionInfo() if you are using the latest CNVRanger release.

If none of this options help you, you can send me an email enclosing at least part of your input to allows the reproduction of your error. In this case please send the files to [email protected].

ps. To avoid the error "CNV.gds' has been created or opened." you just need to close your current R session and start a new one. This error indicates that the gds file is open, which should not be the case if the cnvGWAS() complete the analysis successfully.

@ItahisaMR
Copy link
Author

Thank you very much for the support. I have checked that the files are tabs delimited (all was ok) and updated both the CNVRanger (1.4.0) and R versions (4.0.0). Now I get another different error:

Error in .qqunifPlot(segs.pvalue.gr$MinPvalueAdjusted, auto.key = list(corner = c(0.95, :
pvalue vector contains zeros, can't draw plot

I've tried with the first chromosome only and I have good results. I don't understand why the error appears when using the complete files and not using only one chromosome. The files are exactly the same, the file of one chromosome is a subset of the complete one.

What may be the problem now? Sorry for the troubles.

@viniciushdasilva
Copy link
Collaborator

Could you try to run your analysis again please with the latest version in github? I just included a line that might help to solve this error. Please let me know if the error persists. To install the current version here use:

BiocManager::install("waldronlab/CNVRanger")

@ItahisaMR
Copy link
Author

The error persists, sorry.

Error in .qqunifPlot(segs.pvalue.gr$MinPvalueAdjusted, auto.key = list(corner = c(0.95, :
pvalue vector contains zeros, can't draw plot

@viniciushdasilva
Copy link
Collaborator

I think I need to take a look in your inputs. Could you please send to me a file input that may retrieve this error? Unfortunately, I am not sure how to explore the possible problems in another way.

@ItahisaMR
Copy link
Author

Thank you very much! Now I'm exploring the files... maybe i can find the bad chromosome!

Thank you for your time!

@lgeistlinger
Copy link
Collaborator

lgeistlinger commented Jun 16, 2020

Does this mean that this issue has been resolved? I am closing this issue in this case, feel free to reopen.

@SaraNara
Copy link

SaraNara commented Jun 30, 2021

Thank you very much! Now I'm exploring the files... maybe i can find the bad chromosome!

Thank you for your time!

@ItahisaMR I am getting a similar error with GWAS. Have you solved the problem? I have also tried the solution provided by @viniciushdasilva. Still, the problem persists. Any other suggestions?
I have tried the solution provided in #25.
I am getting the following error;

data.folder <- "/Volumes/sgunaseg/PHD_2/Data/3_CNV/data_analysis/1_Sep2020/CNV_Ranger/EBV_Allison/outfile/cnvrangerinputfile/#25script/"

pheno <- read.csv(file.path(data.folder,"pheno.for.CNVRanger.csv"), as.is=TRUE, sep = "\t")
View(pheno)
ped <-pheno
ped$sire <- NA
ped$dam <- NA
ped$fam <- NA
ped <- subset(ped, select = c(sample.id, sire, dam, BT))
write.table(ped, file.path(data.folder,"ped.for.CNVRanger.txt"), sep="\t", col.names = TRUE, row.names = FALSE, quote=FALSE)

You might need to run it twice due to an error in plink setup

phen.info <- setupCnvGWAS("run", phen.loc=file.path(data.folder,"pheno.for.CNVRanger.csv"),

  •                       cnv.out.loc=file.path(data.folder, "cnvs.for.CNVRanger.csv"), 
    
  •                       pedigree.loc=file.path(data.folder,"ped.for.CNVRanger.csv"))
    

Error in setupCnvGWAS("run", phen.loc = file.path(data.folder, "pheno.for.CNVRanger.csv"), :
unused argument (pedigree.loc = file.path(data.folder, "ped.for.CNVRanger.csv"))

Here is the sessionInfo details;

R version 4.1.0 (2021-05-18)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Big Sur 11.4

Matrix products: default
LAPACK: /Library/Frameworks/R.framework/Versions/4.1/Resources/lib/libRlapack.dylib

locale:
[1] en_CA.UTF-8/en_CA.UTF-8/en_CA.UTF-8/C/en_CA.UTF-8/en_CA.UTF-8

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

other attached packages:
[1] lme4qtl_0.2.2 pedigreemm_0.3-3 lme4_1.1-27.1 Matrix_1.3-4 CNVRanger_1.8.0
[6] RaggedExperiment_1.16.0 GenomicRanges_1.44.0 GenomeInfoDb_1.28.0 IRanges_2.26.0 S4Vectors_0.30.0
[11] BiocGenerics_0.38.0

loaded via a namespace (and not attached):
[1] Rcpp_1.0.6 lattice_0.20-44 prettyunits_1.1.1 ps_1.6.0 rprojroot_2.0.2
[6] utf8_1.2.1 plyr_1.8.6 R6_2.5.0 ggplot2_3.3.5 pillar_1.6.1
[11] zlibbioc_1.38.0 rlang_0.4.11 data.table_1.14.0 minqa_1.2.4 kinship2_1.8.5
[16] callr_3.7.0 nloptr_1.2.2.2 desc_1.3.0 devtools_2.4.2 splines_4.1.0
[21] RCurl_1.98-1.3 munsell_0.5.0 DelayedArray_0.18.0 compiler_4.1.0 pkgconfig_2.0.3
[26] pkgbuild_1.2.0 SummarizedExperiment_1.22.0 tibble_3.1.2 GenomeInfoDbData_1.2.6 quadprog_1.5-8
[31] matrixStats_0.59.0 fansi_0.5.0 crayon_1.4.1 withr_2.4.2 rappdirs_0.3.3
[36] MASS_7.3-54 bitops_1.0-7 grid_4.1.0 nlme_3.1-152 gtable_0.3.0
[41] lifecycle_1.0.0 magrittr_2.0.1 scales_1.1.1 cli_2.5.0 cachem_1.0.5
[46] XVector_0.32.0 fs_1.5.0 remotes_2.4.0 testthat_3.0.3 ellipsis_0.3.2
[51] vctrs_0.3.8 boot_1.3-28 tools_4.1.0 Biobase_2.52.0 glue_1.4.2
[56] purrr_0.3.4 MatrixGenerics_1.4.0 processx_3.5.2 pkgload_1.2.1 fastmap_1.1.0
[61] colorspace_2.0-2 BiocManager_1.30.16 sessioninfo_1.1.1 memoise_2.0.0 usethis_2.0.1

@lgeistlinger
Copy link
Collaborator

Hi @SaraNara best not to comment on a closed issue, but rather reopen, or open a new issue. We have replaced PLINK support with R native linear models for CNV GWAS in CNVRanger_v1.8.0, so I believe this is a new issue. @viniciushdasilva can you have a look?

@viniciushdasilva
Copy link
Collaborator

Hi @SaraNara,

It seems that you are using the example provided in #25 with the master branch of the package (i.e. https://github.com/waldronlab/CNVRanger/tree/master). If you have installed directly from bioconductor, or the master branch, the #25 example is not valid. This example can be only used to the dev branch (https://github.com/waldronlab/CNVRanger/tree/dev). In the master branch the vignette examples should work just fine.

You just need to venture yourself in the dev branch, using the example in #25, if you need linear mixed models with a relationship matrix. More info on why linear mixed models are not in the master branch yet can be found here in #27.

@SaraNara
Copy link

SaraNara commented Jul 7, 2021

Dear @viniciushdasilva ;
Thank you for your reply. I have downloaded the CNVRanger from the Bioconductor. So it is the master branch. Your example works fine with GWAS. When I am trying to run my data I am getting 2 following errors;

#phen.info <- setupCnvGWAS("example", cnv.out.loc=re, map.loc=map.loc)
Error in setupCnvGWAS("example", cnv.out.loc = re, map.loc = map.loc) : The map should be unique. If multiple populations with different probe map use map.loc=NULL

When I used the map file I got the above error. So I also tried the map.loc=NULL. Then I am getting the below error.

segs.pvalue.gr <- cnvGWAS(phen.info, method.m.test="none")
Error in .qqunifPlot(segs.pvalue.gr$MinPvalueAdjusted, auto.key = list(corner = c(0.95, :
pvalue vector contains zeros, can't draw plot

Here are the codes that I used;
cnv.calls <-read.table("~/Data/CNVOut_final.txt", sep = "\t", header = TRUE)
head(cnv.calls)

----calls2grl----------------------------------------------------------------

cnv.calls <- GenomicRanges::makeGRangesListFromDataFrame(cnv.calls,
split.field="sample.id", keep.extra.columns=TRUE)
sort(cnv.calls)

----phenoData----------------------------------------------------------------

#phen.loc <- file.path(data.dir, "Pheno.txt")
#phen.df <- read.delim(phen.loc, as.is=TRUE)
phen.df <-read.delim("~/Data/pheno_final.txt")
head(phen.df)

----importPhen---------------------------------------------------------------

re <- RaggedExperiment::RaggedExperiment(cnv.calls, colData=phen.df)
re

----map----------------------------------------------------------------------

map.loc <- read.delim("~/Data/map_final.txt")
head(map.loc)

----importPhenRagged---------------------------------------------------------

#phen.info <- setupCnvGWAS("example", cnv.out.loc=re, map.loc=map.loc)#Error in setupCnvGWAS("example", cnv.out.loc = re, map.loc = map.loc) : The map should be unique. If multiple populations with different probe map use map.loc=NULL

phen.info <- setupCnvGWAS("example", cnv.out.loc=re, map.loc=NULL)
phen.info

----Wdir---------------------------------------------------------------------

all.paths <- phen.info$all.paths
all.paths

----CNVGWA-------------------------------------------------------------------

segs.pvalue.gr <- cnvGWAS(phen.info, method.m.test="none")
segs.pvalue.gr

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

4 participants