nm.unzip | R Documentation |
Many large files like XML output and covariance matrices are zipped by (qPharmetra's
tweaked version of) PsN. To enable the parsing function of the nm.xxx
domain to
operate well this function unzips these files. The unzip call is pulled from the system environment
variable UNZIP_CALL on startup, or defaulted as stated below. the %s in the call is replaced with the
basename (no extension) of the file to unzip. The unzip call can be modified by changing the
option unzip.call. Paths are specified relative to the current directory.
nm.unzip(
run,
extension = ".xml",
filename = paste(run, extension, sep = ""),
path = file.path(getOption("nmDir", ""), run),
tmpdir = tempfile("subdir"),
temp = FALSE,
outdir = ifelse(temp, tmpdir, path),
zip.filename = file.path(path, filename),
zip.call = getOption("unzip.call"),
command = paste0(sprintf(zip.call, gsub(" ", "\\\\ ", zip.filename)), " -o",
gsub(" ", "\\\\ ", outdir)),
target = file.path(outdir, filename),
quiet = TRUE,
...
)
run |
run rootname (e.g. |
extension |
file extension of the file to unzip. Could be ".xml", or ".cov", or ".cor" or anything else that has been zipped |
filename |
file name (excluding path) of the filename to extract. Is automatically populated with qP workflow defaults |
path |
directory where |
tmpdir |
directory to use if temp is true |
temp |
if true, unzip to a unique temporary file path |
outdir |
location for unzipped file |
zip.filename |
filename of the zip file to extract. Is automatically populated with qP workflow defaults |
zip.call |
full OS call to zip utility for unzipping. Defaults to "c:/progra~1/7-zip/7z e %s.7z" on windows. Option "-o" is currently appended by nm.unzip(). |
command |
zip.call with filename substituted; passes to system |
target |
path for expected result; possibly identical to zip.filename |
quiet |
whether to suppress process messages |
... |
ignored arguments |
(invisible) path to the unzipped file: especially useful if temp is true.
file.exists( file.path(getOption("qpExampleDir"),"example1"))
file.exists( file.path(getOption("qpExampleDir"),"example1/example1.cov"))
nm.unzip(run = "example1", extension = ".cov",
path = file.path(getOption("qpExampleDir"),"example1"),quiet = FALSE)
file.exists( file.path(getOption("qpExampleDir"),"example1/example1.cov"))
file.remove( file.path(getOption("qpExampleDir"),"example1/example1.cov"))
file.exists('c:/progra~1/7-zip/7z.exe')
# If the above does not exist, consider:
# options(unzip.call = 'C:/my-zip-path/7z e %s.7z') # or similar
tmp <- nm.unzip(
run = "example1",
extension = ".cov",
path = file.path(
getOption("qpExampleDir"),
"example1"
),
temp = TRUE
)
file.exists( file.path(getOption("qpExampleDir"),"example1/example1.cov"))
file.exists(tmp)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.