Download dataset files

Description

This method can download whole datasets (all FCS files and attachments of a flowRepData object) or individual files based on file proxies (fileProxy objects).

Usage

1
    download(object, ...)

Arguments

object

Object of class fileProxy or flowRepData.

...

Additional options, see the details section.

Details

The full dataset or the file represented by the file proxy will be downloaded to the local file system. If you are downloading the whole dataset (passing a flowRepData object), then you can specify the following additional options:

dirpath=NULL

The path to the directory where to download the files. By default, the files will be downloaded to a folder named based on the dataset identifier (FR-FCM-xxxx) that will be created in your working directory.

use.credentials=TRUE

Whether to use stored credentials to login before downloading the dataset. Credentials will only be used if use.credentials=TRUE and they are set (see setFlowRepositoryCredentials). If your credentials are set, but you are downloading a public dataset that does not need credentials, then you can use use.credentials=FALSE to avoid logging in.

show.progress=TRUE

Whether to show progress as individual files are being downloaded.

only.files=NULL

If not NULL then download only files with names matching a regular expression specified as a single string of characters in this argument. For example, the regular expression "pA.*fcs" will download only files whose name starts with "pA" and ends with "fcs"; the ".*" part of the regular expression means any character (.) repeated 0 or more times (*). This particular example can be used to download FCS files from IMPC panel A as their names are created as pA_specimenId_incrementvalue.fcs. Files will be skipped if the regular expression does not match.

If you are downloading a single file by (passing a fileProxy object), then you can specify the following additional options:

dirpath=NULL

The path to the directory where to download the file. By default, the file will be downloaded to your working directory. A filepath argument as specified below takes precedence over the dirpath argument.

filepath=NULL

The path where to download the file. If provided, this argument takes precedence over dirpath.

curlHandle=getCurlHandle(cookiefile="")

Used to pass cookies to keep track of sessions. This is intended for internal use, not to be used by regular users.

show.progress=TRUE

Whether to show progress as the file is being downloaded.

only.files=NULL

If not NULL then download the file only if its name is matching a regular expression specified as a single string of characters in this argument. For example, the regular expression "pA.*fcs" will download only files whose name starts with "pA" and ends with "fcs"; the ".*" part of the regular expression means any character (.) repeated 0 or more times (*). This particular example can be used to download FCS files from IMPC panel A as their names are created as pA_specimenId_incrementvalue.fcs. The file will be skipped if the regular expression does not match.

Value

A fileProxy object if object is a fileProxy object or a flowRepData object if object is a flowRepData object. This is an updated file proxy or a dataset that includes local path to the downloaded files.

Author(s)

Josef Spidlen

See Also

flowRep.get

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
    ## We will get a small dataset
    myDataset <- flowRep.get("FR-FCM-ZZJ7")
    summary(myDataset)
    
    ## And download a single attachment file
    ## mainly just to demonstrate that one can do one file at a time.
    att1 <- download(attachments(myDataset)[[1]])
    localpath(att1)
    
    ## We can also find out about individual FCS file proxies
    summary(fcs.files(myDataset)[[1]])

    ## A single FCS file proxy can be downloaded
    fcs1 <- download(fcs.files(myDataset)[[1]])
    summary(fcs1)

    ## The file is downloaded to your home directory
    localpath(fcs1)

    ## The code above is just to demonstrate that it is
    ## possible to get individial files. However, typically, 
    ## we will want to download the whole dataset.
    myDataset <- download(myDataset)
    summary(myDataset)

    ## This downloaded all the files to your home directory
    ## This is where you find your data
    unlist(lapply(fcs.files(myDataset), function(x) paste(localpath(x))))

    ## And this is where you find the attachments of that dataset
    unlist(lapply(attachments(myDataset), function(x) paste(localpath(x))))

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.