[Gtdb-commits] r55 - in pkg/gt.db: R src
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Tue Jun 1 23:18:50 CEST 2010
Author: dahinds
Date: 2010-06-01 23:18:50 +0200 (Tue, 01 Jun 2010)
New Revision: 55
Modified:
pkg/gt.db/R/hapmap.R
pkg/gt.db/src/encode.c
Log:
- update to handle deletion/insertion polymorphisms in hapmap files
Modified: pkg/gt.db/R/hapmap.R
===================================================================
--- pkg/gt.db/R/hapmap.R 2010-06-01 20:33:59 UTC (rev 54)
+++ pkg/gt.db/R/hapmap.R 2010-06-01 21:18:50 UTC (rev 55)
@@ -24,9 +24,10 @@
.fixup.hapmap.alleles <- function(alleles, geno)
{
- # fill in non-SNP allele lists based on the actual data
- bad <- grep('^[ACGT]/[ACGT]$', alleles, invert=TRUE)
- if (!length(bad)) return(alleles)
+ # fill in non-bi-allelic allele lists based on the actual data
+ bad <- (!grepl('^[ACGT]/[ACGT]$', alleles) &
+ !grepl('^-/[ACGT]+$', alleles))
+ if (!any(bad)) return(alleles)
gt <- c('A','C','G','T')
tbl <- (ch.table(geno[bad], chars=gt) > 0)
a12 <- apply(tbl, 1, function(x) c(gt[x],'?','?')[1:2])
Modified: pkg/gt.db/src/encode.c
===================================================================
--- pkg/gt.db/src/encode.c 2010-06-01 20:33:59 UTC (rev 54)
+++ pkg/gt.db/src/encode.c 2010-06-01 21:18:50 UTC (rev 55)
@@ -61,6 +61,11 @@
for (i = 0; i < LENGTH(sa); i++) {
a = CHAR(STRING_ELT(sa,i));
a1 = a[0]; a2 = a[2];
+ if (a1 == '-') {
+ /* codes for insertion/deletion polymorphisms */
+ a1 = 'D';
+ a2 = 'I';
+ }
g = CHAR(STRING_ELT(sg,i));
for (j = 0; j < len && *g; j++) {
buf[j] = '?';
More information about the Gtdb-commits
mailing list