comparison pipe-t.R @ 15:5e8bf316343d draft

planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit d5c46b42061ff823c19437d1c803119ef8b95627
author davidecangelosi
date Fri, 24 May 2019 09:26:43 -0400
parents 3168db2e0ff5
children 254114751c2e
comparison
equal deleted inserted replaced
14:3168db2e0ff5 15:5e8bf316343d
269 file.header <- readLines(con=readfile, n=100) 269 file.header <- readLines(con=readfile, n=100)
270 n.header <- grep("^#", file.header) 270 n.header <- grep("^#", file.header)
271 if (length(n.header)==0) 271 if (length(n.header)==0)
272 n.header <- 0 272 n.header <- 0
273 # Read data, skip the required lines 273 # Read data, skip the required lines
274 out <- read.delim(file=readfile, header=FALSE, colClasses="character", nrows=nspots*n.data[i], skip=n.header, strip.white=TRUE, ...) 274 out <- read.delim(file=readfile, header=TRUE, colClasses="character", nrows=nspots*n.data[i], skip=n.header-1, strip.white=TRUE, ...)
275 # Return 275 # Return
276 out 276 out
277 } # .readCtSDS 277 } # .readCtSDS
278 278
279 .readCtLightCycler <- 279 .readCtLightCycler <-
349 warning("Please use 'column.info' for providing a list of column numbers containing particular information. The use of 'flag', 'feature', 'type', 'position' and 'Ct' is deprecated and will be removed in future versions.") 349 warning("Please use 'column.info' for providing a list of column numbers containing particular information. The use of 'flag', 'feature', 'type', 'position' and 'Ct' is deprecated and will be removed in future versions.")
350 } 350 }
351 if (missing(column.info)) { 351 if (missing(column.info)) {
352 column.info <- switch(format, EDS = list(flag="EXPFAIL", feature="Target.Name", position="Well.Position", Ct="CT"), 352 column.info <- switch(format, EDS = list(flag="EXPFAIL", feature="Target.Name", position="Well.Position", Ct="CT"),
353 plain = list(flag = 4, feature = 6, type = 7, position = 3, Ct = 8), 353 plain = list(flag = 4, feature = 6, type = 7, position = 3, Ct = 8),
354 SDS = list(flag = 4,feature = 6, type = 7, position = 3, Ct = 8), 354 #SDS = list(flag = 4,feature = 6, type = 7, position = 3, Ct = 8),
355 #SDS = list(flag = "Omit",feature = "Detector", type = "Task", position = "Pos", Ct = "Avg.Ct"), 355 SDS = list(flag = "Omit",feature = "Detector", type = "Task", position = "Pos", Ct = "Avg.Ct"),
356 LightCycler = list(feature = "Name", 356 LightCycler = list(feature = "Name",
357 position = "Pos", Ct = "Cp"), CFX = list(feature = "Content", 357 position = "Pos", Ct = "Cp"), CFX = list(feature = "Content",
358 position = "Well", Ct = "Cq.Mean"), OpenArray = list(flag = "ThroughHole.Outlier", 358 position = "Well", Ct = "Cq.Mean"), OpenArray = list(flag = "ThroughHole.Outlier",
359 feature = "Assay.Assay.ID", type = "Assay.Assay.Type", 359 feature = "Assay.Assay.ID", type = "Assay.Assay.Type",
360 position = "ThroughHole.Address", Ct = "ThroughHole.Ct"), 360 position = "ThroughHole.Address", Ct = "ThroughHole.Ct"),
400 data[data %in% nas | data == 0] <- NA 400 data[data %in% nas | data == 0] <- NA
401 } 401 }
402 else { 402 else {
403 data[data %in% nas | is.na(data) | data == 0] <- na.value 403 data[data %in% nas | is.na(data) | data == 0] <- na.value
404 } 404 }
405 X[, cols] <- apply(data, 2, function(x) as.numeric(as.character(x))) 405 X[, cols] <- suppressWarnings(apply(data, 2, function(x) as.numeric(as.character(x))))
406 if ("flag" %in% names(column.info)) { 406 if ("flag" %in% names(column.info)) {
407 flags <- matrix(sample[, column.info[["flag"]]], 407 flags <- matrix(sample[, column.info[["flag"]]],
408 ncol = n.data[i]) 408 ncol = n.data[i])
409 flags[flags == "-"] <- "Failed" 409 flags[flags == "-"] <- "Failed"
410 flags[flags == "+"] <- "Passed" 410 flags[flags == "+"] <- "Passed"
492 phenoData <- new("AnnotatedDataFrame", data = files, varMetadata = metadata) 492 phenoData <- new("AnnotatedDataFrame", data = files, varMetadata = metadata)
493 rownames(phenoData)=as.vector(files$sampleName) 493 rownames(phenoData)=as.vector(files$sampleName)
494 raw<- readCtDataDav(files = as.vector(files$sampleName), header=FALSE, format="plain", path = path, sample.info=phenoData,n.features = as.numeric(nfeatures)) 494 raw<- readCtDataDav(files = as.vector(files$sampleName), header=FALSE, format="plain", path = path, sample.info=phenoData,n.features = as.numeric(nfeatures))
495 }, 495 },
496 "SDS"={ 496 "SDS"={
497 columns<- list(feature=3, Ct=6, flag=11) 497 #columns<- list(feature=3, Ct=6, flag=11)
498 #columns <-list(flag = "Omit",feature = "Detector", type = "Task", position = "Wells", Ct = "Avg.Ct") 498 #columns <-list(flag = "Omit",feature = "Detector", type = "Task", position = "Wells", Ct = "Avg.Ct")
499 metadata <- data.frame(labelDescription = c("sampleName", "Treatment"), row.names = c("sampleName", "Treatment")) 499 metadata <- data.frame(labelDescription = c("sampleName", "Treatment"), row.names = c("sampleName", "Treatment"))
500 phenoData <- new("AnnotatedDataFrame", data = files, varMetadata = metadata) 500 phenoData <- new("AnnotatedDataFrame", data = files, varMetadata = metadata)
501 rownames(phenoData)=as.vector(files$sampleName) 501 rownames(phenoData)=as.vector(files$sampleName)
502 raw<- readCtDataDav(files = files$sampleName, format="SDS",column.info=columns, path = path, sample.info=phenoData, n.features=as.numeric(nfeatures)) 502 raw<- readCtDataDav(files = files$sampleName, header=TRUE,format="SDS",path = path, sample.info=phenoData, n.features=as.numeric(nfeatures))
503 }, 503 },
504 "LightCycler"={ 504 "LightCycler"={
505 metadata <- data.frame(labelDescription = c("sampleName", "Treatment"), row.names = c("sampleName", "Treatment")) 505 metadata <- data.frame(labelDescription = c("sampleName", "Treatment"), row.names = c("sampleName", "Treatment"))
506 phenoData <- new("AnnotatedDataFrame", data = files, varMetadata = metadata) 506 phenoData <- new("AnnotatedDataFrame", data = files, varMetadata = metadata)
507 rownames(phenoData)=as.vector(files$sampleName) 507 rownames(phenoData)=as.vector(files$sampleName)