Giter Site home page Giter Site logo

Comments (9)

smgogarten avatar smgogarten commented on July 17, 2024

I could not reproduce this error. If it persists after restarting your R session, could you please share sessionInfo()?

from genesis.

wcmoors avatar wcmoors commented on July 17, 2024

was there a solution to this?

from genesis.

smgogarten avatar smgogarten commented on July 17, 2024

Restart your R session. If that doesn't work and you are seeing this error, please share sessionInfo().

from genesis.

jychungbu avatar jychungbu commented on July 17, 2024

from genesis.

EEsdaile avatar EEsdaile commented on July 17, 2024

Hate to dredge this up again, but I'm getting the same error. Here's my sessionInfo()

Edit to add that I have restarted R and encounter the same issue.

R version 4.0.3 (2020-10-10)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 18362)

Matrix products: default

locale:
[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252 LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C LC_TIME=English_United States.1252

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

other attached packages:
[1] GENESIS_2.20.0 SNPRelate_1.24.0 gdsfmt_1.26.1

loaded via a namespace (and not attached):
[1] quantsmooth_1.56.0 Rcpp_1.0.5 lattice_0.20-41 tidyr_1.1.2 Biostrings_2.58.0
[6] formula.tools_1.7.1 zoo_1.8-8 digest_0.6.27 lmtest_0.9-38 foreach_1.5.1
[11] R6_2.5.0 GenomeInfoDb_1.26.2 backports_1.2.0 MatrixModels_0.4-1 stats4_4.0.3
[16] RSQLite_2.2.1 pillar_1.4.7 zlibbioc_1.36.0 rlang_0.4.9 rstudioapi_0.13
[21] data.table_1.13.4 SparseM_1.78 blob_1.2.1 S4Vectors_0.28.1 Matrix_1.2-18
[26] splines_4.0.3 GWASExactHW_1.01 RCurl_1.98-1.2 bit_4.0.4 tinytex_0.28
[31] broom_0.7.3 compiler_4.0.3 xfun_0.19 pkgconfig_2.0.3 BiocGenerics_0.36.0
[36] mgcv_1.8-33 tidyselect_1.1.0 tibble_3.0.4 GenomeInfoDbData_1.2.4 DNAcopy_1.64.0
[41] IRanges_2.24.1 codetools_0.2-18 matrixStats_0.57.0 crayon_1.3.4 dplyr_1.0.2
[46] conquer_1.0.2 bitops_1.0-6 grid_4.0.3 nlme_3.1-151 lifecycle_0.2.0
[51] DBI_1.1.0 magrittr_2.0.1 SeqVarTools_1.28.1 XVector_0.30.0 mice_3.12.0
[56] ellipsis_0.3.1 generics_0.1.0 vctrs_0.3.6 sandwich_3.0-0 iterators_1.0.13
[61] tools_4.0.3 bit64_4.0.5 Biobase_2.50.0 glue_1.4.2 purrr_0.3.4
[66] parallel_4.0.3 survival_3.2-7 SeqArray_1.30.0 GenomicRanges_1.42.0 GWASTools_1.36.0
[71] operator.tools_1.6.3 memoise_1.1.0 logistf_1.24 quantreg_5.75

from genesis.

smgogarten avatar smgogarten commented on July 17, 2024

I think this is an error that can be resolved by restarting R. Can you try starting a brand-new R session and running the following?

library(GENESIS)
library(SNPRelate)

gdsfile <- system.file("extdata", "HapMap_ASW_MXL_geno.gds", package="GENESIS")
gds <- snpgdsOpen(gdsfile)
class(gds) # should see "SNPGDSFileClass"

data("HapMap_ASW_MXL_KINGmat")
mypcair <- pcair(gds, kinobj = HapMap_ASW_MXL_KINGmat, divobj = HapMap_ASW_MXL_KINGmat)

snpgdsClose(gds)

from genesis.

AlexHatoum avatar AlexHatoum commented on July 17, 2024

Hello, I am having the same issue but this time with pcrelate. I am wondering if the R version or the version of the packages could be the issue?

I have run the above code in a new R session, but with pc relate at the end (like below) but pcrelate still generates the error, any thoughts?

Code that is sufficient to produce error, R v 4.1.3 :

library(GENESIS)
library(SNPRelate)

gdsfile <- system.file("extdata", "HapMap_ASW_MXL_geno.gds", package="GENESIS")
gds <- snpgdsOpen(gdsfile)
class(gds) # should see "SNPGDSFileClass"

data("HapMap_ASW_MXL_KINGmat")
mypcair <- pcair(gds, kinobj = HapMap_ASW_MXL_KINGmat, divobj = HapMap_ASW_MXL_KINGmat)

mypcrelate <- pcrelate(gds, pcs = mypcair$vectors[,1:2],
training.set = mypcair$unrels,
BPPARAM = BiocParallel::SerialParam())
snpgdsClose(gds)

from genesis.

AlexHatoum avatar AlexHatoum commented on July 17, 2024

I have figured out the issue. It is with the way the .gds files are read into R, perhaps in different versions. If your data produces this error, reading the .gds files back into R in different ways can help (which you should probably do after restarting R according to this thread, but in my experience it is not necessary as long as you can reload in the .gds files). It is always best to do so using the two part commands like this:

HapMap_geno <- GdsGenotypeReader(filename = "MyGDS.gds")
HapMap_genoData <- GenotypeData(HapMap_geno)

Instead of using other GDS commands like this:
genofile <- snpgdsOpen("MyGDS.gds")

Both sets of code produce the same class of object but the package throws an error for the latter and not the former. Apologies to the developers if this is something obvious, but I thought I would just post here in case others run into this issue.

Best,

Alexander

from genesis.

smgogarten avatar smgogarten commented on July 17, 2024

@AlexHatoum pcair has more options for input classes than pcrelate, which is why you saw the error for the latter but not the former. This has to do with the way the two functions are implemented internally: pcair calls the snpgdsPCA function in the SNPRelate package, so it can accept SNPRelate classes, but pcrelate requires an Iterator object defined in GWASTools or SeqVarTools. You can see this difference in the "Usage" section of the man pages for the two functions:

Usage:

     ## S4 method for signature 'gds.class'
     pcair(gdsobj, kinobj = NULL, divobj = NULL,
 <...>
     ## S4 method for signature 'SNPGDSFileClass'
     pcair(gdsobj, ...)
     ## S4 method for signature 'GdsGenotypeReader'
     pcair(gdsobj, ...)
     ## S4 method for signature 'MatrixGenotypeReader'
     pcair(gdsobj, ...)
     ## S4 method for signature 'GenotypeData'
     pcair(gdsobj, ...)
     ## S4 method for signature 'SeqVarGDSClass'
     pcair(gdsobj, ...)
     

vs

Usage:

     ## S4 method for signature 'GenotypeIterator'
     pcrelate(gdsobj,
<...>
     ## S4 method for signature 'SeqVarIterator'
     pcrelate(gdsobj,

from genesis.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.