From 50dbbdb8ab269a026e9a0bdd9bf951d01fc9d47e Mon Sep 17 00:00:00 2001 From: kiran Date: Tue, 16 Nov 2010 22:46:07 +0000 Subject: [PATCH] Retrieves per-sample or per-lane metrics from the SQUID database and populates a dataframe with the results. git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@4693 348d0f76-0448-11de-a6fe-93d51630548a --- R/src/gsalib/R/read.squidmetrics.R | 22 ++++++++++++ R/src/gsalib/man/read.squidmetrics.Rd | 48 +++++++++++++++++++++++++++ 2 files changed, 70 insertions(+) create mode 100644 R/src/gsalib/R/read.squidmetrics.R create mode 100644 R/src/gsalib/man/read.squidmetrics.Rd diff --git a/R/src/gsalib/R/read.squidmetrics.R b/R/src/gsalib/R/read.squidmetrics.R new file mode 100644 index 000000000..24e1cc658 --- /dev/null +++ b/R/src/gsalib/R/read.squidmetrics.R @@ -0,0 +1,22 @@ +read.squidmetrics = function(project, bylane = FALSE) { + suppressMessages(library(ROracle)); + + drv = dbDriver("Oracle"); + con = dbConnect(drv, "REPORTING/REPORTING@ora01:1521/SEQPROD"); + + if (bylane) { + rs = dbSendQuery(con, statement = paste("SELECT * FROM ILLUMINA_PICARD_METRICS")); + d = fetch(rs, n=-1); + dbHasCompleted(rs); + dbClearResult(rs); + } else { + rs = dbSendQuery(con, statement = paste("SELECT * FROM ILLUMINA_SAMPLE_STATUS_AGG")); + d = fetch(rs, n=-1); + dbHasCompleted(rs); + dbClearResult(rs); + } + + oraCloseDriver(drv); + + d; +} diff --git a/R/src/gsalib/man/read.squidmetrics.Rd b/R/src/gsalib/man/read.squidmetrics.Rd new file mode 100644 index 000000000..223f9b450 --- /dev/null +++ b/R/src/gsalib/man/read.squidmetrics.Rd @@ -0,0 +1,48 @@ +\name{read.squidmetrics} +\alias{read.squidmetrics} +\title{ +read.squidmetrics +} +\description{ +Reads metrics for a specified SQUID project into a dataframe. +} +\usage{ +read.squidmetrics("C315") +} +\arguments{ + \item{project}{ +The project for which metrics should be obtained. +} + \item{bylane}{ +If TRUE, obtains per-lane metrics rather than the default per-sample metrics. +} +} +\details{ +%% ~~ If necessary, more details than the description above ~~ +} +\value{ +%% ~Describe the value returned +%% If it is a LIST, use +%% \item{comp1 }{Description of 'comp1'} +%% \item{comp2 }{Description of 'comp2'} +%% ... +Returns a data frame with samples (or lanes) as the row and the metric as the column. +} +\references{ +%% ~put references to the literature/web site here ~ +} +\author{ +Kiran Garimella +} +\note{ +This method will only work within the Broad Institute internal network. +} + +\seealso{ +%% ~~objects to See Also as \code{\link{help}}, ~~~ +} +\examples{ +## Obtain metrics for project C315. +d = read.squidmetrics("C315"); +} +\keyword{ ~kwd1 }