GenomicDataCommons
?From https://support.bioconductor.org/p/9138939/.
library(GenomicDataCommons,quietly = TRUE)
I made a small change to the filtering expression approach based on
changes to lazy evaluation best practices. There is now no need to
include the ~
in the filter expression. So:
q = files() |>
GenomicDataCommons::filter(
cases.project.project_id == 'TCGA-COAD' &
data_type == 'Aligned Reads' &
experimental_strategy == 'RNA-Seq' &
data_format == 'BAM')
And get a count of the results:
count(q)
## [1] 1188
And the manifest.
manifest(q)
id <chr> | proportion_reads_mapped <dbl> | access <chr> | |
---|---|---|---|
901014ff-2f5f-4239-9508-f8306a28e3d5 | 0.9914613 | controlled | |
19a34c33-0285-4c24-8f15-4f5d9eb33a26 | 0.9857066 | controlled | |
6836903b-024c-493a-a25c-619e93495cd1 | NA | controlled | |
0895c68d-9f23-4416-ad62-88a74f6f2a6b | 0.9848592 | controlled | |
5057570c-1707-4123-8c4f-db2a3e9902ee | 0.9803607 | controlled | |
806215cc-4608-44a7-bbb7-4a11b9a49989 | NA | controlled | |
26866748-cc8d-4151-ba45-34ec3c054e2a | 0.9862453 | controlled | |
b9c05160-ac76-4570-801f-be9fa85ce86d | NA | controlled | |
cdf407b5-ff29-4b08-945d-9d45b1e9ec57 | NA | controlled | |
959d1afe-1bf7-4e7f-9a8e-3822c7ff73c1 | NA | controlled |
Your question about race and ethnicity is a good one.
all_fields = available_fields(files())
And we can grep for race
or ethnic
to get potential matching fields
to look at.
grep('race|ethnic',all_fields,value=TRUE)
## [1] "cases.demographic.ethnicity"
## [2] "cases.demographic.race"
## [3] "cases.follow_ups.hormonal_contraceptive_type"
## [4] "cases.follow_ups.hormonal_contraceptive_use"
## [5] "cases.follow_ups.other_clinical_attributes.hormonal_contraceptive_type"
## [6] "cases.follow_ups.other_clinical_attributes.hormonal_contraceptive_use"
## [7] "cases.follow_ups.scan_tracer_used"
Now, we can check available values for each field to determine how to complete our filter expressions.
available_values('files',"cases.demographic.ethnicity")
## [1] "not hispanic or latino" "not reported" "hispanic or latino"
## [4] "unknown" "_missing"
available_values('files',"cases.demographic.race")
## [1] "white"
## [2] "not reported"
## [3] "black or african american"
## [4] "asian"
## [5] "unknown"
## [6] "other"
## [7] "american indian or alaska native"
## [8] "native hawaiian or other pacific islander"
## [9] "not allowed to collect"
## [10] "_missing"
We can complete our filter expression now to limit to white
race only.
q_white_only = q |>
GenomicDataCommons::filter(cases.demographic.race=='white')
count(q_white_only)
## [1] 695
manifest(q_white_only)
id <chr> | proportion_reads_mapped <dbl> | access <chr> | |
---|---|---|---|
0895c68d-9f23-4416-ad62-88a74f6f2a6b | 0.9848592 | controlled | |
26866748-cc8d-4151-ba45-34ec3c054e2a | 0.9862453 | controlled | |
b9c05160-ac76-4570-801f-be9fa85ce86d | NA | controlled | |
cdf407b5-ff29-4b08-945d-9d45b1e9ec57 | NA | controlled | |
959d1afe-1bf7-4e7f-9a8e-3822c7ff73c1 | NA | controlled | |
8db18318-ef7a-49eb-bd74-8fea80ff8813 | NA | controlled | |
4c18b2cc-5308-4dfe-b034-806b2d3f1bdf | 0.9853948 | controlled | |
293c5e5c-9c2d-437c-ae34-f1cda2be32e8 | NA | controlled | |
96f71862-50ee-428f-976a-5f5d117b98ec | NA | controlled | |
dab25d0e-c259-41a8-9048-abbb8d24625b | NA | controlled |
GenomicDataCommons
?I would like to get the number of cases added (created, any logical datetime would suffice here) to the TCGA project by experiment type. I attempted to get this data via GenomicDataCommons package, but it is giving me I believe the number of files for a given experiment type rather than number cases. How can I get the number of cases for which there is RNA-Seq data?
library(tibble)
library(dplyr)
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:GenomicDataCommons':
##
## count, filter, select
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
library(GenomicDataCommons)
cases() |>
GenomicDataCommons::filter(
~ project.program.name=='TCGA' & files.experimental_strategy=='RNA-Seq'
) |>
facet(c("files.created_datetime")) |>
aggregations() |>
unname() |>
unlist(recursive = FALSE) |>
as_tibble() |>
dplyr::arrange(dplyr::desc(key))
doc_count <int> | key <chr> | |||
---|---|---|---|---|
271 | 2024-06-14t14:27:00.916424-05:00 | |||
412 | 2024-06-14t13:28:10.644120-05:00 | |||
151 | 2023-03-09t00:35:51.387873-06:00 | |||
79 | 2023-02-19t04:41:11.008116-06:00 | |||
458 | 2023-02-19t04:36:10.605050-06:00 | |||
80 | 2023-02-19t04:28:49.400023-06:00 | |||
178 | 2023-02-19t04:23:49.092629-06:00 | |||
516 | 2023-02-19t04:18:49.453628-06:00 | |||
179 | 2023-02-19t04:13:47.877168-06:00 | |||
290 | 2023-02-19t04:08:47.478925-06:00 |