comparison nmr_alignement/NmrAlignment_wrapper.R @ 2:908e1345d7ca draft

Uploaded
author marie-tremblay-metatoul
date Fri, 31 Mar 2017 09:56:39 -0400
parents 58eecef626da
children f3ec6799c435
comparison
equal deleted inserted replaced
1:58eecef626da 2:908e1345d7ca
55 ## Parameters Loading 55 ## Parameters Loading
56 ##------------------- 56 ##-------------------
57 # Inputs 57 # Inputs
58 ## Library of spectra to align 58 ## Library of spectra to align
59 if (!is.null(argLs[["zipfile"]])){ 59 if (!is.null(argLs[["zipfile"]])){
60 fileType="zip"
60 zipfile= argLs[["zipfile"]] 61 zipfile= argLs[["zipfile"]]
61 directory=unzip(zipfile, list=F) 62 directory=unzip(zipfile, list=F)
62 directory=paste(getwd(),strsplit(directory[1],"/")[[1]][2],sep="/") 63 directory=paste(getwd(),strsplit(directory[1],"/")[[1]][2],sep="/")
63 } else if (!is.null(argLs[["library"]])){ 64 } else if (!is.null(argLs[["library"]])){
65 fileType="zip"
64 directory=argLs[["library"]] 66 directory=argLs[["library"]]
65 if(!file.exists(directory)){ 67 if(!file.exists(directory)){
66 error_message=paste("Cannot access the directory :",directory,".Please verify if the directory exists or not.") 68 error_message=paste("Cannot access the directory :",directory,".Please verify if the directory exists or not.")
67 print(error_message) 69 print(error_message)
68 stop(error_message) 70 stop(error_message)
69 } 71 }
72 } else if (!is.null(argLs[["tsvfile"]])){
73 fileType="tsv"
74 directory <- read.table(argLs[["tsvfile"]],check.names=FALSE,header=TRUE,sep="\t")
70 } 75 }
71 76
72 77
73 ## Spectral width 78 ## Spectral width
74 leftBorder <- argLs[["left_border"]] 79 leftBorder <- argLs[["left_border"]]
108 stop(error.stock) 113 stop(error.stock)
109 114
110 115
111 ## Computation 116 ## Computation
112 ##------------ 117 ##------------
113 directory.alignement <- nmr.alignment(directory=directory,leftBorder=leftBorder,rightBorder=rightBorder,exclusionZones=exclusionZones, 118 directory.alignement <- nmr.alignment(fileType=fileType,directory=directory,leftBorder=leftBorder,rightBorder=rightBorder,exclusionZones=exclusionZones,
114 exclusionZonesBorders=exclusionZonesBorders, reference=reference, nDivRange=nDivRange, 119 exclusionZonesBorders=exclusionZonesBorders, reference=reference, nDivRange=nDivRange,
115 baselineThresh=baselineThresh, maxshift=50, verbose=FALSE) 120 baselineThresh=baselineThresh, maxshift=50, verbose=FALSE)
116 directory.raw <- directory.alignement[[1]] 121 directory.raw <- directory.alignement[[1]]
117 directory.aligned <- directory.alignement[[2]] 122 directory.aligned <- directory.alignement[[2]]
118 123