Mercurial > repos > davidecangelosi > pipe_t
comparison pipe-t.R @ 7:3e099c082954 draft
planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 5c55ecdfd6ed19c7eb7558f278884511620df5dd
author | davidecangelosi |
---|---|
date | Tue, 07 May 2019 06:03:18 -0400 |
parents | d1cabb2bc795 |
children | e5953805ad7a |
comparison
equal
deleted
inserted
replaced
6:d1cabb2bc795 | 7:3e099c082954 |
---|---|
175 file.header <- readLines(con=readfile, n=100) | 175 file.header <- readLines(con=readfile, n=100) |
176 n.header <- grep("^#", file.header) | 176 n.header <- grep("^#", file.header) |
177 if (length(n.header)==0) | 177 if (length(n.header)==0) |
178 n.header <- 0 | 178 n.header <- 0 |
179 # Read data, skip the required lines | 179 # Read data, skip the required lines |
180 out <- read.delim(file=readfile, header=TRUE, colClasses="character", nrows=nspots*n.data[i], skip=n.header-1, strip.white=TRUE, ...) | 180 out <- read.delim(file=readfile, header=FALSE, colClasses="character", nrows=nspots*n.data[i], skip=n.header, strip.white=TRUE, ...) |
181 # Return | 181 # Return |
182 out | 182 out |
183 } # .readCtSDS | 183 } # .readCtSDS |
184 | 184 |
185 .readCtLightCycler <- | 185 .readCtLightCycler <- |
255 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.") | 255 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.") |
256 } | 256 } |
257 if (missing(column.info)) { | 257 if (missing(column.info)) { |
258 column.info <- switch(format, EDS = list(flag="EXPFAIL", feature="Target.Name", position="Well.Position", Ct="CT"), | 258 column.info <- switch(format, EDS = list(flag="EXPFAIL", feature="Target.Name", position="Well.Position", Ct="CT"), |
259 plain = list(flag = 4, feature = 6, type = 7, position = 3, Ct = 8), | 259 plain = list(flag = 4, feature = 6, type = 7, position = 3, Ct = 8), |
260 #SDS = list(flag = 4,feature = 6, type = 7, position = 3, Ct = 8), | 260 SDS = list(flag = 4,feature = 6, type = 7, position = 3, Ct = 8), |
261 SDS = list(flag = "Omit",feature = "Detector", type = "Task", position = "Wells", Ct = "Ct"), | 261 #SDS = list(flag = "Omit",feature = "Detector", type = "Task", position = "Pos", Ct = "Avg.Ct"), |
262 LightCycler = list(feature = "Name", | 262 LightCycler = list(feature = "Name", |
263 position = "Pos", Ct = "Cp"), CFX = list(feature = "Content", | 263 position = "Pos", Ct = "Cp"), CFX = list(feature = "Content", |
264 position = "Well", Ct = "Cq.Mean"), OpenArray = list(flag = "ThroughHole.Outlier", | 264 position = "Well", Ct = "Cq.Mean"), OpenArray = list(flag = "ThroughHole.Outlier", |
265 feature = "Assay.Assay.ID", type = "Assay.Assay.Type", | 265 feature = "Assay.Assay.ID", type = "Assay.Assay.Type", |
266 position = "ThroughHole.Address", Ct = "ThroughHole.Ct"), | 266 position = "ThroughHole.Address", Ct = "ThroughHole.Ct"), |
287 n.data = n.data, i = i, nspots = nspots, ...), LightCycler = .readCtLightCycler(readfile = readfile, | 287 n.data = n.data, i = i, nspots = nspots, ...), LightCycler = .readCtLightCycler(readfile = readfile, |
288 n.data = n.data, i = i, nspots = nspots, ...), CFX = .readCtCFX(readfile = readfile, | 288 n.data = n.data, i = i, nspots = nspots, ...), CFX = .readCtCFX(readfile = readfile, |
289 n.data = n.data, i = i, nspots = nspots, ...), OpenArray = .readCtOpenArray(readfile = readfile, | 289 n.data = n.data, i = i, nspots = nspots, ...), OpenArray = .readCtOpenArray(readfile = readfile, |
290 n.data = n.data, i = i, nspots = nspots, ...), BioMark = .readCtBioMark(readfile = readfile, | 290 n.data = n.data, i = i, nspots = nspots, ...), BioMark = .readCtBioMark(readfile = readfile, |
291 n.data = n.data, i = i, nspots = nspots, ...)) | 291 n.data = n.data, i = i, nspots = nspots, ...)) |
292 | 292 #if (format == "SDS") { |
293 data <- matrix(sample[, column.info[["Ct"]]], ncol = n.data[i]) | 293 # if("Avg Ct" %in% colnames(n.data)){ |
294 # data <- matrix(sample[, column.info[["Avg.Ct"]]], ncol = n.data[i]) | |
295 # } elseif { | |
296 # cat("\n Unsupported SDS format! ") | |
297 # } | |
298 #}else{ | |
299 data <- matrix(sample[, column.info[["Ct"]]], ncol = n.data[i]) | |
300 # } | |
294 undeter <- apply(data, 2, function(x) x %in% c("Undetermined", | 301 undeter <- apply(data, 2, function(x) x %in% c("Undetermined", |
295 "No Ct")) | 302 "No Ct")) |
296 X.cat[, cols][undeter] <- "Undetermined" | 303 X.cat[, cols][undeter] <- "Undetermined" |
297 nas <- c("Undetermined", "No Ct", "999", "N/A") | 304 nas <- c("Undetermined", "No Ct", "999", "N/A") |
298 if (is.null(na.value)) { | 305 if (is.null(na.value)) { |
392 rownames(phenoData)=as.vector(files$sampleName) | 399 rownames(phenoData)=as.vector(files$sampleName) |
393 raw<- readCtDataDav(files = as.vector(files$sampleName), header=FALSE, format="plain", path = path, sample.info=phenoData,n.features = as.numeric(nfeatures)) | 400 raw<- readCtDataDav(files = as.vector(files$sampleName), header=FALSE, format="plain", path = path, sample.info=phenoData,n.features = as.numeric(nfeatures)) |
394 }, | 401 }, |
395 "SDS"={ | 402 "SDS"={ |
396 #columns<- list(feature=3, Ct=6, flag=11) | 403 #columns<- list(feature=3, Ct=6, flag=11) |
397 columns <-list(flag = "Omit",feature = "Detector", type = "Task", position = "Wells", Ct = "Ct") | 404 columns <-list(flag = "Omit",feature = "Detector", type = "Task", position = "Wells", Ct = "Avg.Ct") |
398 metadata <- data.frame(labelDescription = c("sampleName", "Treatment"), row.names = c("sampleName", "Treatment")) | 405 metadata <- data.frame(labelDescription = c("sampleName", "Treatment"), row.names = c("sampleName", "Treatment")) |
399 phenoData <- new("AnnotatedDataFrame", data = files, varMetadata = metadata) | 406 phenoData <- new("AnnotatedDataFrame", data = files, varMetadata = metadata) |
400 rownames(phenoData)=as.vector(files$sampleName) | 407 rownames(phenoData)=as.vector(files$sampleName) |
401 raw<- readCtDataDav(files = files$sampleName, format="SDS",column.info=columns, path = path, sample.info=phenoData, n.features=as.numeric(nfeatures)) | 408 raw<- readCtDataDav(files = files$sampleName, format="SDS",column.info=columns, path = path, sample.info=phenoData, n.features=as.numeric(nfeatures)) |
402 }, | 409 }, |
629 # DF[rowSums(is.na(DF)) <= n,] | 636 # DF[rowSums(is.na(DF)) <= n,] |
630 #} | 637 #} |
631 | 638 |
632 #user_number=5 | 639 #user_number=5 |
633 #genorm <- selectHKs(t(delete.na(as.matrix(exprs(xGlico)),0)), method = "geNorm", Symbols = rownames(as.matrix(delete.na(exprs(xGlico),0))), minNrHK = as.numeric(user_number), log = TRUE) | 640 #genorm <- selectHKs(t(delete.na(as.matrix(exprs(xGlico)),0)), method = "geNorm", Symbols = rownames(as.matrix(delete.na(exprs(xGlico),0))), minNrHK = as.numeric(user_number), log = TRUE) |
641 #genorm | |
634 #normfinder <- selectHKs(as.matrix(t(delete.na(exprs(xGlico),0))), group= files$Treatment , method = "NormFinder", Symbols =rownames(as.matrix(delete.na(exprs(xGlico),0))), minNrHK = as.numeric(user_number), log = TRUE) | 642 #normfinder <- selectHKs(as.matrix(t(delete.na(exprs(xGlico),0))), group= files$Treatment , method = "NormFinder", Symbols =rownames(as.matrix(delete.na(exprs(xGlico),0))), minNrHK = as.numeric(user_number), log = TRUE) |
643 #normfinder | |
635 #intersection= intersect(normfinder$ranking, genorm$ranking[1:as.numeric(user_number)]) | 644 #intersection= intersect(normfinder$ranking, genorm$ranking[1:as.numeric(user_number)]) |
636 | 645 |
637 #cat("\n GeNorm and NormFinder transcripts selected as housekeeping for normalization! \n") | 646 #cat("\n GeNorm and NormFinder transcripts selected as housekeeping for normalization! \n") |
638 #intersection | 647 #intersection |
639 #dnorm <- normalizeCtData(xGlico , norm="deltaCt", deltaCt.genes=as.vector(intersection)) | 648 #dnorm <- normalizeCtData(xGlico , norm="deltaCt", deltaCt.genes=as.vector(intersection)) |