简体   繁体   中英

R GWASTools createDataFile() error: “Error … %in% names(…) is not TRUE”

I'm trying to create an intensity GDS file from existing Illumina files using createDataFile() function of GWASTools.

I tried this:

col.nums        <- as.integer(c(1,11,12,13,14))
names(col.nums) <- c("snp", "BAlleleFreq", "LogRRatio", "a1", "a2")
variables       <- c("genotype","BAlleleFreq","LogRRatio")

        intens      <- createDataFile(path="/pathexample/", "/pathexample/IntensityGDS", file.type="gds", variables=variables, snp.annotation=snpAnnot, scan.annotation=scanAnnot, sep.type=",", skip.num=12, col.total=14, col.nums=col.nums, scan.name.in.file=-1, allele.coding="nucleotide", precision="single", compress="LZMA_RA:1M", compress.geno="", compress.annot="LZMA_RA", array.name=NULL, genome.build=NULL, diagnostics.filename="createDataFile.diagnostics.RData", verbose=TRUE)

The error I'm getting is:

Error: all(c("snpID", "chromosome", "position", "snpName") %in% names(snp.annotation)) is not TRUE

However I know those column names are in both the snp.annotation snpAnnotationDataFrame (aka snpAnnot) and the underlying dataframe I used to create that snpAnnotationDataFrame. Eg:

varLabels(snpAnnot) 

yields

"snpName"    "chromosome" "position"   "rsID_real"  "snpID"

Thanks!!

Apparently the problem was that createDataFile() takes regular R dataframes in the snp.annotation and scan.annotation arguments, not an object of class "snp annotation data frame." ie, no need to run the command SnpAnnotationDataFrame() on your dataframe, just insert the actual dataframe.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM