Skip to content

Commit dfa5dcb

Browse files
committed
Merge branch 'working'
2 parents a2b968d + 27bb564 commit dfa5dcb

7 files changed

Lines changed: 48 additions & 28 deletions

File tree

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Package: oligoMask
2-
Version: 0.99.08
2+
Version: 0.99.09
33
Date: 2013-5-13
44
Title: Tools for masking out problematic Affymetrix probes using VCF files and the oligo package
55
Author: Daniel Bottomly

R/VariantMaskParams.R

Lines changed: 35 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,40 @@
1-
guess.core.query <- function()
2-
{
3-
guess.query.func(oligo:::getFidMetaProbesetCore)
4-
}
1+
#guess.core.query <- function()
2+
#{
3+
# guess.query.func(oligo:::getFidMetaProbesetCore)
4+
#}
5+
#
6+
#guess.probeset.query <- function()
7+
#{
8+
# guess.query.func(oligo:::getFidProbeset)
9+
#}
510

6-
guess.probeset.query <- function()
11+
guess.query.func <- function(object, target)
712
{
8-
guess.query.func(oligo:::getFidProbeset)
9-
}
10-
11-
guess.query.func <- function(defined.function)
12-
{
13-
core.func <- deparse(defined.function)
14-
core.query <- core.func[grep("SELECT", core.func)]
15-
if (length(core.query) != 1)
13+
if (target == "core")
14+
{
15+
use.func <- oligo:::getFidMetaProbesetCore
16+
}else
17+
{
18+
use.func <- oligo:::getFidProbeset
19+
}
20+
21+
func.list <- as.list(body(use.func))
22+
23+
which.sql <- sapply(func.list, function(x) any(grep("SELECT", x)))
24+
25+
if (sum(which.sql) != 1)
1626
{
17-
stop("ERROR: Guess at query failed, please supply valid SQL queries to the VariantMaskParams object")
27+
stop("ERROR: Guess at query failed--multiple possible queries found")
1828
}
1929

20-
temp <- eval(parse(text=core.query))
30+
sql.val <- eval(func.list[which.sql][[1]])
31+
32+
if (is.character(sql.val) == F || length(sql.val) != 1)
33+
{
34+
stop("ERROR: Guess at query failed--only one SQL query expected")
35+
}
2136

22-
return(temp)
37+
return(sql.val)
2338
}
2439

2540
valid.VariantMaskParams <- function(object)
@@ -53,9 +68,9 @@ valid.VariantMaskParams <- function(object)
5368
return(TRUE)
5469
}
5570

56-
setClass(Class="VariantMaskParams", representation=list(mask.type="character", geno.filter="logical", rm.unmap="logical", rm.mult="logical", core.query="character",
57-
probeset.query="character", oligo.probe.id="character", var.db="VcfDB"),
58-
prototype=prototype(mask.type="static", geno.filter=FALSE, rm.unmap=TRUE, rm.mult=TRUE, core.query=guess.core.query(), probeset.query=guess.probeset.query(), oligo.probe.id ="fid", var.db=new("VcfDB")),
71+
setClass(Class="VariantMaskParams", representation=list(mask.type="character", geno.filter="logical", rm.unmap="logical", rm.mult="logical",
72+
oligo.probe.id="character", var.db="VcfDB"),
73+
prototype=prototype(mask.type="static", geno.filter=FALSE, rm.unmap=TRUE, rm.mult=TRUE, oligo.probe.id ="fid", var.db=new("VcfDB")),
5974
validity=valid.VariantMaskParams)
6075

6176
setMethod("show", signature("VariantMaskParams"), function(object)
@@ -122,7 +137,7 @@ get.shortest.query.path <- function(var.mask.par, start=NULL, finish=NULL, rever
122137
setGeneric("validProbeQuery", def=function(object,...) standardGeneric("validProbeQuery"))
123138
setMethod("validProbeQuery", signature("VariantMaskParams"), function(object, target, should.add=TRUE, should.count=FALSE)
124139
{
125-
oligo.query <- switch(target, core=object@core.query, probeset=object@probeset.query)
140+
oligo.query <- guess.query.func(object, target)
126141

127142
var.presence <- "contains_var"
128143
filter.presence <- "passes_filter"

R/vcf_parsing.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,7 @@ create.sanger.mouse.vcf.db <- function(vcf.files, vcf.labels, probe.tab.file, st
374374
}
375375

376376
syms <- list(VERSION=package.desc$Version, MANUF="Affymetrix", CHIPNAME=gsub("-", "_", strsplit(basename(probe.tab.file), "\\.")[[1]][1]), LIC=package.desc$License, TBSLDATA=basename(actual.tbsl.name), DB_NAME=basename(actual.db.name),
377-
GENOME_PACKAGE=bs.genome@seqs_pkgname, LIMIT_CHR=paste0("c(", paste(paste0("'",use.chr.vec, "'"), collapse=","),")"), VAR_TYPE=var.type.str,
377+
GENOME_PACKAGE=bs.genome@pkgname, LIMIT_CHR=paste0("c(", paste(paste0("'",use.chr.vec, "'"), collapse=","),")"), VAR_TYPE=var.type.str,
378378
NUM_MISMATCH=as.character(max.mismatch))
379379

380380
syms <- append(syms, package.info)

inst/NEWS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
VERSION 0.99.09
2+
3+
Removed the probeset.query and core.query slots in the VariantMaskParams object, the proper SQL query is now inferred using the supplied FeatureSet object.
4+
15
VERSION 0.99.02
26

37
Bux fixes for the methods of TableSchemaList as well as the SangerTableSchemaList to deal with INDELS that have the same exact position as SNVs.

inst/unitTests/test_methods.R

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -403,6 +403,8 @@ test.populate.db.tbl.schema.list <- function()
403403
dbDisconnect(db.con)
404404
}
405405

406+
###still need to fix me: attributes are not identical across measure variables; they will be dropped
407+
406408
test.make.vcf.table <- function()
407409
{
408410

@@ -452,7 +454,8 @@ test.make.vcf.table <- function()
452454

453455
filt.vcf.dta <- do.call("rbind", lapply(filt.vcf, function(x)
454456
{
455-
temp.dta <- cbind(as.data.frame(x$rowData), ref=as.character(x$REF), alt=sapply(x$ALT, paste, collapse=","), gt=x$GENO$GT, fi=x$GENO$FI)
457+
temp.dta <- cbind(as.data.frame(x$rowData), ref=as.character(x$REF), alt=sapply(x$ALT, paste, collapse=","), gt=x$GENO$GT, fi=x$GENO$FI,
458+
stringsAsFactors=F)
456459
}))
457460

458461
#the same variant can impact several probes, so remove the duplicates as the conversion to the database should do so
@@ -593,7 +596,7 @@ examine.vcf.db <- function(db.name, db.schema, tab.aln, vcf.files, strain.names)
593596

594597
checkTrue(nrow(probe.aln) == nrow(sub.tab.aln))
595598

596-
merged.annot <- merge(probe.aln, sub.tab.aln, by.x="probe_id", by.y="Probe.ID", all=TRUE, incomparables=NA, sort=FALSE)
599+
merged.annot <- merge(probe.aln, sub.tab.aln, by.x="probe_id", by.y="Probe.ID", all=TRUE, sort=FALSE)
597600

598601
checkTrue(nrow(merged.annot) == nrow(probe.aln))
599602

@@ -622,7 +625,7 @@ examine.vcf.db <- function(db.name, db.schema, tab.aln, vcf.files, strain.names)
622625
var.ovls <- dbGetQuery(db.con, "SELECT * FROM probe_to_snp NATURAL JOIN reference NATURAL JOIN probe_align NATURAL JOIN probe_info")
623626

624627
#there will be some of these which are not variants in one of the 8 strains, check that here...
625-
temp <- merge(probe.snp, var.ovls, all=TRUE, incomparables=NA, sort=FALSE)
628+
temp <- merge(probe.snp, var.ovls, all=TRUE, sort=FALSE)
626629

627630
checkTrue(nrow(temp) == nrow(probe.snp))
628631
checkTrue(sum(is.na(temp)) == 0)

man/VariantMaskParams.Rd

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,7 @@ VariantMaskParams constructor function as VariantMaskParams(var.db, geno.filter=
2424
\item{\code{geno.filter}:}{Object of class \code{"logical"} indicating whether only the probes overlapping the high quality genotypes be used (default is FALSE)}
2525
\item{\code{rm.unmap}:}{Object of class \code{"logical"} indicating whether the probes that are unmapped should be removed as well (default is TRUE)}
2626
\item{\code{rm.mult}:}{Object of class \code{"logical"} indicating whether the probes that map to multiple locations should be removed as well (default is TRUE)}
27-
\item{\code{core.query}:}{Object of class \code{"character"} representing a query from the oligo package to retrieve the probes associated with the core metaprobesets (attempts to find this automatically)}
28-
\item{\code{probeset.query}:}{Object of class \code{"character"} representing a query from the oligo package to retrieve the probes associated with the probesets (attempts to find this automatically)}
29-
\item{\code{oligo.probe.id}:}{Object of class \code{"character"} indicating the database column that the oligo package uses to denote the probe ID}
27+
\item{\code{oligo.probe.id}:}{Object of class \code{"character"} indicating the database column that the oligo package uses to denote the probe ID}
3028
\item{\code{var.db}:}{Object of class \code{"VcfDB"} corresponding to the VCF database to be used for masking}
3129
}
3230
}

0 commit comments

Comments
 (0)