Skip to contents

This function downloads both transcription factor and cofactor data from the AnimalTFDB4 database. The downloaded files are saved as .txt files in the specified directory. If the files already exist locally and overwrite is not set to TRUE, the function will not download them again. The files will be stored in the data/derived-data/ folder, which will be created if necessary.

Usage

dl_regulation_data(
  url_tf,
  url_cof,
  path,
  filename_tf,
  filename_cof,
  overwrite = FALSE
)

Arguments

url_tf

The URL for the transcription factor data.

url_cof

The URL for the transcription co-factor data.

path

The directory for saving the downloaded files.

filename_tf

The name associated with the downloaded transcription factor file.

filename_cof

The name associated with the downloaded co-factor factor file.

overwrite

If TRUE, the function overwrites existing output files; otherwise, it reads the existing files. (default is set to FALSE).

Value

No return value; files are downloaded and stored in the specified directory.

Examples

# \donttest{
dl_regulation_data(
  url_tf = "https://guolab.wchscu.cn/AnimalTFDB4_static/download/TF_list_final/Danio_rerio_TF",
  url_cof = "https://guolab.wchscu.cn/AnimalTFDB4_static/download/Cof_list_final/Danio_rerio_Cof",
  path = tempdir(),
  filename_tf = "Danio_rerio_TF_example.txt",
  filename_cof = "Danio_rerio_Cof_example.txt"
)
#> Warning: downloaded length 0 != reported length 2657
#> Warning: cannot open URL 'https://guolab.wchscu.cn/AnimalTFDB4_static/download/TF_list_final/Danio_rerio_TF': HTTP status was '405 Method Not Allowed'
#> Error in utils::download.file(url = paste0(url_tf), destfile = file.path(path,     filename_tf), mode = "wb"): cannot open URL 'https://guolab.wchscu.cn/AnimalTFDB4_static/download/TF_list_final/Danio_rerio_TF'

# Files are saved to tempdir() and will be automatically cleaned up
# To see where files were saved:
list.files(tempdir(), pattern = "Danio_rerio.*example", full.names = TRUE)
#> character(0)
# }