Loader: A file choser utility file.

Description Usage Arguments Details Value Warning Author(s) References See Also Examples

View source: R/Loader.R

Description

Uses a template file (typically an Excel spreadsheet with file names as one column) to select a set of files and either combine them into one file or copy them individually to a new directory. The files to be used must be specified in a contiguous set of rows of the template file.

Usage

1
Loader(input=file.path(system.file(package="agilp"),"input",""),output=file.path(system.file(package="agilp"),"output",""),t=file.path(system.file(package="agilp"),"input1","template.txt"),f="TRUE",r=2,A=2,B=5)

Arguments

input

full path of directory where input data files are put; default is a folder named input within the agilp package directory;

output

full path of directory where output data files are put; default is a folder named output within the agilp package directory;

t

full name and path of template file

f

if f="TRUE", each file is copied individually to output folder; if "f" IS NOT true, all files are merged into one big dataframe , with each original file data as column; this file is called "all_data.txt" and written to output folder; it is also returned as an R dataframe object called dataout

r

The column of template which contains the file names

A

The first row of template to be used; note a header row is NOT ignored.

B

The last row of template to be used

Details

This function is a tool for working with selected files output by AAProcess. Typical usage would be to hold all the array file names with relevant experimental detail and annotation in a file called template. The filenames would then be sorted according to some annoation (e.g. tissue type, date, experimenter etc and then this list is used to pull out the relevant raw data files corresponding to those epxeriments from a big collection of such files. A toy example of a template file is provided in data folder

Value

rawdata files

If f is "TRUE" the function simply copies the files defined by template from input to output folder.

dataout

If f is not = "TRUE" , the individual data files are merged by rows. The rownames are the probe names; each column contains a set of expression data with the column name giving the file name from which the data were derived

all_data

If f is not = "TRUE" the function also writes a tab delimited txt file corresponding to dataout, called all_data.txt to the output directory.

Warning

The function checks that files listed in template exist in folder, and outputs a list of all file names not found

Author(s)

Benny Chain; b.chain@ucl.ac.ucl

References

In preparation

See Also

AAProcess filenamex IDswop Baseline Equaliser AALoess

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
inputdir<-file.path(system.file(package="agilp"),"extdata","raw/","", fsep = .Platform$file.sep)
outputdir<-file.path(system.file(package="agilp"),"output/", "", fsep = .Platform$file.sep)
template<-file.path(system.file(package="agilp"),"extdata","sample_template.txt", fsep = .Platform$file.sep)

#This will copy the files with names given in column 2 , rows 2:3 of the sample_#template file from input to output. 
Loader(input=inputdir,output=outputdir,t=template,f="TRUE",r=2,A=2,B=5)

#Alternatively this will output a single file all_data.txt with the same data in a merged file. The file is also output back to R as object dataout
Loader(input=inputdir,output=outputdir,t=template,f="FALSE",r=2,A=2,B=5)

dim(dataout)

## Not run: 
#to remove the output files again and empty the output directory use 
unlink(paste(file.path(system.file(package="agilp"),"output",""),"*.*",sep=""), recursive=FALSE)

## End(Not run)

agilp documentation built on Nov. 8, 2020, 5:45 p.m.