hanchenphd / GMMAT

Generalized linear Mixed Model Association Tests
Other
36 stars 22 forks source link

Error in readLines(infile) : 'con' is not a connection - glmm.wald test #44

Open HKJ396 opened 2 years ago

HKJ396 commented 2 years ago

Hi Han,

I hope you are doing well. I am running the following command for the wald test after successfully running the single score test. However, I am getting the following error (see below). My bim, fam and bed file are all located in the working directory. Do I need to define these files in the command?

geno.file <- strsplit(system.file("extdata", "file.bed", package = "GMMAT"), ".bed", fixed = TRUE)

glmm.wald(value ~ age+bmi+smoking+pc1+pc2+pc3+pc4+pc5+pc6+pc7+pc8+pc9+pc10+pc11+pc12+pc13+pc14+pc15, data = covariate_PCA, kins = NULL, id = "IID", family = gaussian(link = "identity"), infile = geno.file, outfile = "glmm.wald.bed.testoutfile.txt")

Error: Error in readLines(infile) : 'con' is not a connection
hanchenphd commented 2 years ago

If your files are all located in the working directory, you should directly provide the file prefix to the infile argument. What you did above was trying to find a file named "file.bed" from the extdata folder of the GMMAT package, which would not work (the package did not provide "file.bed").

HKJ396 commented 2 years ago

Thank you so much Han. That solved that error. Now getting a new one when running:

glmm.wald(value ~ age+bmi+smoking+pc1+pc2+pc3+pc4+pc5+pc6+pc7+pc8+pc9+pc10+pc11+pc12+pc13+pc14+pc15, data = covariate_PCA, kins = NULL, id = "IID", family = gaussian(link = "identity"), snps = NULL, infile = "file.bed", outfile = "glmm.wald.bed.testoutfile.txt")

Duplicated id detected...
Assuming longitudinal data with repeated measures...
Error in glmm.wald(value ~ age + bmi + smoking  +  pc1 : 
  Expecting a single string value: [type=NULL; extent=0].
In addition: There were 50 or more warnings (use warnings() to see the first 50)

When I run warnings() I get...

warnings()
Warning messages:
1: In readLines(infile) : line 1 appears to contain an embedded nul
2: In readLines(infile) : line 2 appears to contain an embedded nul
3: In readLines(infile) : line 4 appears to contain an embedded nul
4: In readLines(infile) : line 6 appears to contain an embedded nul
5: In readLines(infile) : line 7 appears to contain an embedded nul

Thank you in advance.

hanchenphd commented 2 years ago

The function glmm.wald does not allow the snps argument to be NULL. Please see Section 5.2.2 of the user manual for an example.

HKJ396 commented 2 years ago

Can I just provide a text file with my 7,097,340 SNPs and load that in? I can always split the files up if it takes too long e.g. split SNPs by chromosome?

hanchenphd commented 2 years ago

No, it has to be a character vector. Please read the help document in R.

Are you trying to run the Wald test genome-wide? I would strongly recommend that you use glmm.score for genome-wide analyses. The glmm.wald function was not designed for such tasks and I would only recommend using it for candidate gene analyses.

HKJ396 commented 2 years ago

Great thank you. I'll stick with the glmm score test. Thanks for all your help!