[Seqinr-commits] r1553 - pkg/R
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Thu Feb 12 13:05:59 CET 2009
Author: lobry
Date: 2009-02-12 13:05:59 +0100 (Thu, 12 Feb 2009)
New Revision: 1553
Added:
pkg/R/al2bp.R
Log:
new utility function al2bp
Added: pkg/R/al2bp.R
===================================================================
--- pkg/R/al2bp.R (rev 0)
+++ pkg/R/al2bp.R 2009-02-12 12:05:59 UTC (rev 1553)
@@ -0,0 +1,9 @@
+al2bp <- function(allele.name, repeat.bp = 4, offLadderChars = "><"){
+ allele.name <- as.character(allele.name)
+ if(any(s2c(allele.name) %in% s2c(offLadderChars))) return(NA)
+ dec <- unlist(strsplit(allele.name, split = "\\."))
+ res <- repeat.bp*suppressWarnings(as.numeric(dec[1]))
+ # NA are returned for X and Y at Amelogenin locus for instance
+ if(length(dec) > 1) res <- res + as.numeric(dec[2])
+ return(res)
+}
More information about the Seqinr-commits
mailing list