A question about how to create a gwaa.data-class object

Questions about GenABEL (aka *ABEL) suite of packages
Forum rules
Please remember not to post any sensitive data on this public forum.
The first few posts of newly registered users will be moderated in order to filter out any spammers.

When get a solution to the problem you posted, please change the topic name (e.g. from "how to ..." to "[SOLVED] how to ..."). This will make it easier for the community to follow the posts yet to be attended.
Dugucan
Posts: 1
Joined: Mon Nov 03, 2014 7:09 am

A question about how to create a gwaa.data-class object

Postby Dugucan » Wed Mar 11, 2015 6:27 am

I first use the GenABEL package, and try to create a gwaa.data-class according the GenABEL tutorial. There's no method described in the tutorial aobout how to create a phdata, which is one of the two parts of gwaa.data-class, so I don't konw the correct progress and how to fix the error detonated by the following code:

Code: Select all

library(GenABEL)
illumina <- data.frame(name = c("rs1001", "rs6679", "rs2401", "rs123",
                                "rs6679", "rs876", "mitoA1"),
                       chr = c("1", "9", "22", "X", "XY", "Y", "mt"),
                       pos = c(1235, 2344, 3455, 32535, 2344, 23556, 24245),
                       strand = c("+", "+", "+", "-", "-", "+", "-"),
                       cd289982 = c("AA", "GT", "AA", "TT", "GT", "00", "AA"),
                       cd325285 = c("AG", "GG", "CC", "GT", "GG", "00", "CC"),
                       cd357273 = c("AG", "GG", "CC", "TT", "GG", "TT", "00"),
                       cd872422 = c("AA", "TG", "CC", "TT", "TG", "GG", "00"),
                       cd1005389 = c("GG", "GG", "AC", "TT", "GG", "TT", "00"))
SNP <- snp.data(nids = 5,
                idnames = c("cd289982", "cd325285", "cd357273", "cd872422",
                            "cd1005389"),
                male = c(0, 1, 1, 0, 0),
                snpnames = c("rs1001", "rs6679", "rs2401", "rs123",
                             "rs6679", "rs876", "mitoA1"),
                chromosome = c("1", "9", "22", "X", "XY", "Y", "mt"),
                )
save(illumina, file = "SNP.illu")
convert.snp.illumina(inf = "SNP.illu", out = "SNP.raw", strand = "file")
SNP.ph <- data.frame(id = c("cd289982", "cd325285", "cd357273", "cd872422",
                            "cd1005389"),
                     sex = c(0, 1, 1, 0, 0),
                     age = c(13, 23, 12, 35, 21),
                     qt1 = c(2, 3, 2, 1, 5))
save(SNP.ph, file = "SNP.dat")
df <- load.gwaa.data(phe = "SNP.dat", gen = "SNP.raw", force = TRUE)

The error is that:
Error in load.gwaa.data(phe = "SNP.dat", gen = "SNP.raw", force = TRUE) :
the filed named "id", containing the identifier presented in both pheno- and geno- files was not found in the phenofile
In addition: Warning messages:
1: In read.table(phenofile, header = TRUE, as.is = TRUE) :
line 3 appears to contain embedded nulls
2: In read.table(phenofile, header = TRUE, as.is = TRUE) :
line 4 appears to contain embedded nulls
3: In read.table(phenofile, header = TRUE, as.is = TRUE) :
line 5 appears to contain embedded nulls
4: In scan(file = file, what = what, sep = sep, quote = quote, dec = dec, :
embedded nul(s) found in input

Can someone tell how to fix the bug in my code? Thans a lot!

Return to “GenABEL”

Who is online

Users browsing this forum: No registered users and 1 guest