GMMAT icon indicating copy to clipboard operation
GMMAT copied to clipboard

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

Open HKJ396 opened this issue 2 years ago • 6 comments

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

HKJ396 avatar May 03 '22 11:05 HKJ396

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").

hanchenphd avatar May 03 '22 17:05 hanchenphd

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.

HKJ396 avatar May 04 '22 10:05 HKJ396

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.

hanchenphd avatar May 04 '22 14:05 hanchenphd

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?

HKJ396 avatar May 04 '22 15:05 HKJ396

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.

hanchenphd avatar May 04 '22 16:05 hanchenphd

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

HKJ396 avatar May 05 '22 08:05 HKJ396