Entering edit mode
Davide
•
0
@23029b76
Last seen 3.3 years ago
I'm trying to use curatedMetagenomicData
. However, I did not find the way to filter data based on rownames
(which shoud be sample's unique IDs).
Let's say:
alcoholStudy <-
filter(sampleMetadata, age >= 18) %>%
filter(!is.na(alcohol)) %>%
filter(body_site == "stool") %>%
select(where(~ !all(is.na(.x)))) %>%
returnSamples("relative_abundance")
# I want to analize only these samples
my_rownames <- as.list("JAS_1", "JAS_10", "JAS_2", "JAS_3", "JAS_4", "JAS_5", "JAS_6")
How can I achieve this goal?
Thank You in advance Davide
Thank you Lucas for your suggestions! However, as you can verify,
subject_id
, has duplicates whilerownames
has not. This is the reason why I would use rownames instead ofsubject_id
for filtering data. Just to show you this point I would share with you this code:.
If I'm right, in the example, M2072 has 23 duplicated
While it seems that
rownames
has no duplicatesIf you'll look closely, you will notice I filtered by
sample_id
and notsubject_id
– the rownames correspond tosample_id
and are therefore always unique. In theMyStudy
code above, some of your samples areHMP_2019_ibdmdb
subjects, where there are multiple samples per subject because of longitudinal follow-up. You can verify this by removing thereturnSamples("relative_abundance")
line and looking at the metadata. Hope that helps.You are absolutely right !!! Thank you!!!