Skip to contents

Fetches files from the 4DN data portal and caches them using the BiocFileCache system.

Arguments

experimentSetAccession

Any 4DN-provided experimentSet Accession number (check https://data.4dnucleome.org/browse/) for a browser-based explorer.

type

any of c('pairs', 'hic', 'mcool', 'boundaries', 'insulation', 'compartments')

.fetch_pairs

Whether to also download the associated pairs file

Value

fourDNData() returns the local path of the queried file cached with BiocFileCache. fourDNHiCExperiment() returns a HiCExperiment object with populated metadata and topologicalFeatures ( if available).

Examples

####################################
## Importing individual 4DN files ##
####################################

head(fourDNData())
#>   experimentSetAccession     fileType     size organism experimentType details
#> 1           4DNES18BMU79        pairs 10151.53    mouse   in situ Hi-C   DpnII
#> 3           4DNES18BMU79          hic  5285.82    mouse   in situ Hi-C   DpnII
#> 4           4DNES18BMU79        mcool  6110.75    mouse   in situ Hi-C   DpnII
#> 5           4DNES18BMU79   boundaries     0.12    mouse   in situ Hi-C   DpnII
#> 6           4DNES18BMU79   insulation     7.18    mouse   in situ Hi-C   DpnII
#> 7           4DNES18BMU79 compartments     0.18    mouse   in situ Hi-C   DpnII
#>                                dataset
#> 1 Hi-C on Mouse Olfactory System cells
#> 3 Hi-C on Mouse Olfactory System cells
#> 4 Hi-C on Mouse Olfactory System cells
#> 5 Hi-C on Mouse Olfactory System cells
#> 6 Hi-C on Mouse Olfactory System cells
#> 7 Hi-C on Mouse Olfactory System cells
#>                                                         condition
#> 1 Mature olfactory sensory neurons with conditional Ldb1 knockout
#> 3 Mature olfactory sensory neurons with conditional Ldb1 knockout
#> 4 Mature olfactory sensory neurons with conditional Ldb1 knockout
#> 5 Mature olfactory sensory neurons with conditional Ldb1 knockout
#> 6 Mature olfactory sensory neurons with conditional Ldb1 knockout
#> 7 Mature olfactory sensory neurons with conditional Ldb1 knockout
#>                 biosource biosourceType             publication
#> 1 olfactory receptor cell  primary cell Monahan K et al. (2019)
#> 3 olfactory receptor cell  primary cell Monahan K et al. (2019)
#> 4 olfactory receptor cell  primary cell Monahan K et al. (2019)
#> 5 olfactory receptor cell  primary cell Monahan K et al. (2019)
#> 6 olfactory receptor cell  primary cell Monahan K et al. (2019)
#> 7 olfactory receptor cell  primary cell Monahan K et al. (2019)
#>                                                                                                                                   URL
#> 1 https://4dn-open-data-public.s3.amazonaws.com/fourfront-webprod/wfoutput/49504f97-904e-48c1-8c20-1033680b66da/4DNFIC5AHBPV.pairs.gz
#> 3      https://4dn-open-data-public.s3.amazonaws.com/fourfront-webprod/wfoutput/6cd4378a-8f51-4e65-99eb-15f5c80abf8d/4DNFIT4I5C6Z.hic
#> 4    https://4dn-open-data-public.s3.amazonaws.com/fourfront-webprod/wfoutput/01fb704f-2fd7-48c6-91af-c5f4584529ed/4DNFIVPAXJO8.mcool
#> 5   https://4dn-open-data-public.s3.amazonaws.com/fourfront-webprod/wfoutput/5c07cdee-53e2-43e0-8853-cfe5f057b3f1/4DNFIR3XCIMA.bed.gz
#> 6       https://4dn-open-data-public.s3.amazonaws.com/fourfront-webprod/wfoutput/d1f4beb9-701f-4188-abe2-6271fe658770/4DNFIXKKNMS7.bw
#> 7       https://4dn-open-data-public.s3.amazonaws.com/fourfront-webprod/wfoutput/3d429647-51c8-4e3a-a18b-eec0b1480905/4DNFIN13N8C1.bw
mcf <- fourDNData(experimentSetAccession = '4DNESDP9ECMN', type = 'mcool')
mcf
#> [1] "/github/home/.cache/R/fourDNData/713b50be238e_4DNFI4988896.mcool"

####################################
## Importing full 4DN experiments ##
####################################

id <- fourDNData() |>
  dplyr::filter(
     experimentType == 'in situ Hi-C', 
     biosource == 'GM12878', 
     publication == 'Sanborn AL et al. (2015)'
  ) |> 
  dplyr::arrange(size) |> 
  dplyr::pull(experimentSetAccession) |> 
  unique()
id[1]
#> [1] "4DNES4JNDDVX"
x <- fourDNHiCExperiment(id[1])
#> Fetching local Hi-C contact map from Bioc cache
#> Fetching local compartments bigwig file from Bioc cache
#> Insulation not found for the provided experimentSet accession.
#> Borders not found for the provided experimentSet accession.
#> Importing contacts in memory
#> Consider using the `HiContacts` package to perform advanced genomic operations 
#> on `HiCExperiment` objects.
#> 
#> Read "Orchestrating Hi-C analysis with Bioconductor" online book to learn more:
#> https://js2264.github.io/OHCA/
x
#> `HiCExperiment` object with 763,795 contacts over 12,366 regions 
#> -------
#> fileName: "/github/home/.cache/R/fourDNData/7343612954c4_4DNFIN8OYCB3.mcool" 
#> focus: "whole genome" 
#> resolutions(13): 1000 2000 ... 5000000 10000000
#> active resolution: 250000 
#> interactions: 370150 
#> scores(2): count balanced 
#> topologicalFeatures: compartments(4950) borders(0) 
#> pairsFile: N/A 
#> metadata(2): 4DN_info eigens
HiCExperiment::topologicalFeatures(x)
#> List of length 2
#> names(2): compartments borders
S4Vectors::metadata(x)$`4DN_info`
#>     experimentSetAccession     fileType   size organism experimentType details
#> 679           4DNES4JNDDVX        pairs  11.19    human   in situ Hi-C    MboI
#> 681           4DNES4JNDDVX          hic 184.89    human   in situ Hi-C    MboI
#> 682           4DNES4JNDDVX        mcool  41.59    human   in situ Hi-C    MboI
#> 683           4DNES4JNDDVX compartments   0.20    human   in situ Hi-C    MboI
#>                                         dataset
#> 679 Hi-C on GM12878 cells - protocol variations
#> 681 Hi-C on GM12878 cells - protocol variations
#> 682 Hi-C on GM12878 cells - protocol variations
#> 683 Hi-C on GM12878 cells - protocol variations
#>                                                             condition biosource
#> 679 in situ Hi-C on GM12878 crosslinking titration - 1% FA, 5 min, RT   GM12878
#> 681 in situ Hi-C on GM12878 crosslinking titration - 1% FA, 5 min, RT   GM12878
#> 682 in situ Hi-C on GM12878 crosslinking titration - 1% FA, 5 min, RT   GM12878
#> 683 in situ Hi-C on GM12878 crosslinking titration - 1% FA, 5 min, RT   GM12878
#>              biosourceType              publication
#> 679 immortalized cell line Sanborn AL et al. (2015)
#> 681 immortalized cell line Sanborn AL et al. (2015)
#> 682 immortalized cell line Sanborn AL et al. (2015)
#> 683 immortalized cell line Sanborn AL et al. (2015)
#>                                                                                                                                     URL
#> 679 https://4dn-open-data-public.s3.amazonaws.com/fourfront-webprod/wfoutput/5641d395-969d-4a93-844d-a8428b51f00d/4DNFIAWYLYMQ.pairs.gz
#> 681      https://4dn-open-data-public.s3.amazonaws.com/fourfront-webprod/wfoutput/5c5612fa-18c2-47fb-8074-693b1054e254/4DNFI57QGL6U.hic
#> 682    https://4dn-open-data-public.s3.amazonaws.com/fourfront-webprod/wfoutput/b487a5b7-4bf0-4a4a-898b-761995e12e3c/4DNFIN8OYCB3.mcool
#> 683       https://4dn-open-data-public.s3.amazonaws.com/fourfront-webprod/wfoutput/2aa30376-040a-4e9e-8ecc-9d0c7a4b167a/4DNFICY2KUGU.bw