-
Notifications
You must be signed in to change notification settings - Fork 0
/
Cobalt_60_radiation_metadata.Rmd
58 lines (40 loc) · 2.24 KB
/
Cobalt_60_radiation_metadata.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
---
title: "single_ion_assay_table_curation"
output: html_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
Load Packages
```{r}
library(readxl)
library(janitor)
library(tidyverse)
```
Read in sample table and make the column names R friendly with clean_names.
We'll have to switch them back to the column names expected by ISA at the end
```{r}
s_OSD_508 <- read.delim("~/Desktop/OSD-508-ISA/s_GLDS-508 copy.txt") %>% clean_names()
```
This workflow assumes you have already create the irradiation protocol itself, so the investigation file (i_investigation.txt) already reports the existence of a Protocol REF column for 'irradiation protocol'
Adding parameter: absorbed radiation dose, the associated units column and ontology columns.
```{r}
# Adding column based on other column. In this case 'factor_value_ionizing_radiation' is the existing column we are using as a key. The new parameters are the names after mutate()
s_OSD_508_copy <- s_OSD_508 %>%
mutate(absorbed_radiation_dose = case_when(
endsWith(factor_value_ionizing_radiation, "non-irradiated") ~ "",
endsWith(factor_value_ionizing_radiation, "Cobalt-60 gamma radiation") ~ "100"
),.after = protocol_ref_1) %>% #You need to make sure this is the name of your column that contains 'irradiation protocol' or this code chunk will put your new parameters in the wrong place
mutate(absorbed_radiation_dose_unit = case_when(
endsWith(factor_value_ionizing_radiation, "non-irradiated") ~ "Not Applicable",
endsWith(factor_value_ionizing_radiation, "Cobalt-60 gamma radiation") ~ "gray"
),.after = absorbed_radiation_dose) %>%
mutate(absorbed_radiation_dose_unit_TSREF = case_when(
endsWith(factor_value_ionizing_radiation, "non-irradiated") ~ "NCIT",
endsWith(factor_value_ionizing_radiation, "Cobalt-60 gamma radiation") ~ "UO"
),.after = absorbed_radiation_dose_unit) %>%
mutate(absorbed_radiation_dose_unit_TSACCESSION = case_when(
endsWith(factor_value_ionizing_radiation, "non-irradiated") ~ "http://ncicb.nci.nih.gov/xml/owl/EVS/Thesaurus.owl#C48660",
endsWith(factor_value_ionizing_radiation, "Cobalt-60 gamma radiation") ~ "http://purl.obolibrary.org/obo/UO_0000134"
), .after= absorbed_radiation_dose_unit_TSREF)
```