[GenABEL-dev] GenABEL impute2databel Patch
Matthias Wuttke
matthias.wuttke at uniklinik-freiburg.de
Thu Jan 21 16:25:46 CET 2016
Hi!
We imputed our genotypes to the 1000 Genomes project, phase 3. In order to be able to work with GenABEL/ProbABEL, I was required to shorten the long variant identifiers to less than 32 chars.
Therefore, I added an option to do so to the impute2databel function that takes a file with new (shorter) variant identifiers. Please find attached a patch in case you like the new option.
Best regards
Matthias
-------------- next part --------------
Index: pkg/GenABEL/R/impute2databel.R
===================================================================
--- pkg/GenABEL/R/impute2databel.R (Revision 2045)
+++ pkg/GenABEL/R/impute2databel.R (Arbeitskopie)
@@ -14,6 +14,7 @@
#' @param old for developers' use only
#' @param dataOutType the output data type, either "FLOAT" or "DOUBLE" (or
#' another DatABEL/filevector type)
+#' @param snpfile file with SNP names in each line (same order as columns in IMPUTE genotype file)
#'
#' @return 'databel-class' object
#'
@@ -21,7 +22,7 @@
impute2databel <- function(genofile, samplefile, outfile,
- makeprob = TRUE, old = FALSE, dataOutType = "FLOAT")
+ makeprob = TRUE, old = FALSE, dataOutType = "FLOAT", snpfile = NA)
{
if (!require(DatABEL))
stop("this function requires the DatABEL package to be installed")
@@ -36,6 +37,13 @@
warning("The non-float dataOutType is not fully supported; your outputs may be in 'FLOAT'...",
immediate. = TRUE);
+ rowNamesSetting = 2
+ if (!is.na(snpfile)) {
+ if (missing(snpfile))
+ stop("snpfile file not found")
+ rowNamesSetting = snpfile
+ }
+
## extract snp names (varnames)
## if (tmpname != "")
## text2databel(infile=genofile,outfile=outfile,
@@ -47,7 +55,7 @@
tmpname <- get_temporary_file_name()
tmp_fv <- text2databel(infile=genofile,
outfile=tmpname,
- rownames=2,
+ rownames=rowNamesSetting,
skipcols=5,
## skiprows,
transpose=TRUE,
More information about the genabel-devel
mailing list