downloadSpataObject: Download a SPATA2 object

View source: R/download.R

downloadSpataObjectR Documentation

Download a SPATA2 object

Description

Downloads a single SPATA2 object and returns it.

Usage

downloadSpataObject(
  sample_name,
  overwrite = FALSE,
  file = FALSE,
  adjust_link = TRUE,
  timeout = 600,
  verbose = TRUE,
  ...
)

Arguments

sample_name

Character value. The name of the sample you want to download. Use validSampleNames() to obtain all valid input options.

overwrite

Logical. Must be set to TRUE if file directories under which downloaded files are to be saved already exist.

file

If you want to save the object on disc: The filename of the SPATA2 object. Must end with '.RDS' if provided as a character. If NULL, the function saves the object under the sample name with an '.RDS' suffix. If FALSE, the saving is skipped and the object is simply returned.

adjust_link

Logical value. Defaults to TRUE. Allows the function to adjust the link if the download fails due to Google Drive warnings. See section below for more information.

timeout

Numeric value. Indicates the number of seconds the function has time to download the object before the process is aborted. Defaults to 600s (10min).

verbose

Logical. If set to TRUE informative messages regarding the computational progress will be printed.

(Warning messages will always be printed.)

folder

Character value. If character, specifies the output folder in which the SPATA2 object is saved. Defaults to the working directory.

Details

If file is not FALSE. The downloaded SPATA2 object is immediately saved after the download before it is returned by the function. Note that the file directory is assembled by combining folder and file!

Value

The downloaded SPATA2 object.

Google Drive Warning

SPATA2 objects are stored in a Google Drive repository and downloaded via their weblink as stored in the source data.frame. Often, SPATA2 objects are too large for the automatic Google Drive virus scan. As a result, the weblink initially leads to a webpage that asks if you are okay with skipping this virus scan.

In cases where the Google Drive link leads to this warning page, the function will automatically adjust the download link to bypass the warning and attempt the download again. If the adjusted download still fails, an error message is displayed, prompting the user to manually download the file using the provided link.

Since the virus scan cannot be performed by Google Drive regardless of whether you download it from within R or manually, the function defaults to bypass this warning automatically. If you prefer not to bypass the warning, you can set adjust_link = FALSE. In this case, the function will give a warning and ask you to download the object manually.

The downloaded objects do not contain viruses. The way they have been created, uploaded as well as how the web links are added to the source data.frame can be reconstructed with the populate_ scripts provided on the SPATAData repository on github under /scripts/.

See Also

For convenient downloads of multiple SPATA2 objects check out downloadSpataObjects().

Examples


# download & assign (no saving on the disk)
object <- downloadSpataObject(sample_name = "UKF275T")

# download, assign and save on disk
# -> stores the file under ~/UKF275T.RDS (where '~' is your working directory)
object <- downloadSpataObject(sample_name = "UKF275T", file = TRUE)

# download, assign and save on disk in a specified directory
object <- downloadSpataObject(sample_name = "UKF275T", file = "my/path/to/spata_object.RDS")


theMILOlab/SPATAData documentation built on Aug. 27, 2024, 5:04 p.m.