Skip to content

Commit

Permalink
Merge pull request #49 from MoTrPAC/replace-aorta
Browse files Browse the repository at this point in the history
aorta -> vena cava
  • Loading branch information
nicolerg authored Nov 10, 2023
2 parents 5aeaa6c + 7e4863a commit 874814b
Show file tree
Hide file tree
Showing 15 changed files with 110 additions and 8 deletions.
1 change: 1 addition & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@
^docs$
^pkgdown$
^\.github$
CODEOWNERS
1 change: 1 addition & 0 deletions CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @nicolerg
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Type: Package
Package: MotrpacRatTraining6moData
Title: Data for analysis of the MoTrPAC endurance exercise training study
in 6-month-old rats
Version: 1.9.1
Version: 2.0.0
Authors@R: c(
person("Nicole", "Gay", , "nicole.r.gay@gmail.com", role = c("cre", "aut")),
person("Pierre", "Jean Beltran", , "pjeanbeltran@gmail.com", role = "aut"),
Expand Down
4 changes: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# MotrpacRatTraining6moData 2.0.0 (2023-11-08)

* Replace all instances of `t65-aorta` with `t99-vena-cava`, and `Aorta` with `Vena Cava`.

# MotrpacRatTraining6moData 1.9.1 (2023-06-02)

* Update `MotrpacRatTraining6mo` version requirement.
Expand Down
4 changes: 2 additions & 2 deletions data-raw/OUTLIERS.R
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@ OUTLIERS[assay_code == "immunoassay-rat-mag27plex", assay_code := "immunoassay"]
OUTLIERS[,group := gsub(",", "_", group)]

# add all 1w, 2w vena cava samples
venacv = data.table(PHENO[PHENO$specimen.processing.sampletypedescription == "Aorta",])
venacv = data.table(PHENO[PHENO$specimen.processing.sampletypedescription == "Vena Cava",])
table(venacv[,specimen.processing.sampletypedescription])
venacv = venacv[sex == "female" & group %in% c("1w","2w")]
venacv[,.(viallabel, sex, group)]
out2 = data.table(viallabel = as.character(venacv[,viallabel]),
tissue = "VENACV",
tissue_code = "t65-aorta",
tissue_code = "t99-vena-cava",
pid = venacv[,pid],
group = sprintf("female_%s", venacv[,group]),
reason = "BAT contamination")
Expand Down
6 changes: 3 additions & 3 deletions data-raw/outliers.tsv
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ viallabel tissue pid group platform reason
90439016105 t61-colon 10486003 male,2w immunoassay-rat-mag27plex large fraction of missing values: 0.7037037
90449016105 t61-colon 10641858 male,2w immunoassay-rat-mag27plex large fraction of missing values: 0.8148148
90292016105 t61-colon 10220917 male,4w immunoassay-rat-mag27plex large fraction of missing values: 0.7037037
all t65-aorta (vena cava) female,1w all brown adipose contamination
all t65-aorta (vena cava) female,2w all brown adipose contamination
all t99-vena-cava female,1w all brown adipose contamination
all t99-vena-cava female,2w all brown adipose contamination
90406015204 t52-hippocampus,stanford 10306471 female,4w epigen-atac-seq PC1
90423015204 t52-hippocampus,stanford 10424911 male,1w epigen-atac-seq PC1
90217015204 t52-hippocampus,stanford 10023259 male,control epigen-atac-seq PC1
Expand Down Expand Up @@ -51,7 +51,7 @@ all t65-aorta (vena cava) female,2w all brown adipose contamination
90571016002 t60-adrenal 10953744 female,1w transcript-rna-seq PC1
90229016102 t61-colon 10026355 male,control transcript-rna-seq PC2
90289016302 t63-testes 10185585 male,4w transcript-rna-seq PC2
90564016502 t65-aorta 10833331 female,1w transcript-rna-seq PC2
90564016502 t99-vena-cava 10833331 female,1w transcript-rna-seq PC2
90441016702 t67-small-intestine 10502300 male,2w transcript-rna-seq PC3
90218016803 t68-liver 10024735 male,8w transcript-rna-seq PC2
90266016902 t69-brown-adipose 10046380 female,control transcript-rna-seq PC3
Expand Down
Binary file modified data/METAB_VENACV_DA.rda
Binary file not shown.
Binary file modified data/METAB_VENACV_DA_METAREG.rda
Binary file not shown.
Binary file modified data/OUTLIERS.rda
Binary file not shown.
Binary file modified data/PHENO.rda
Binary file not shown.
Binary file modified data/TRAINING_REGULATED_FEATURES.rda
Binary file not shown.
Binary file modified data/TRNSCRPT_VENACV_DA.rda
Binary file not shown.
96 changes: 96 additions & 0 deletions inst/scripts/replace_aorta.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
library(data.table)
library(devtools)
load_all()

# copied from MotrpacRatTraining6mo
list_available_data = function(package=NULL){
res = utils::data(package=package)
obj = res$results[,3]
# remove objects that can't be called directly
obj = obj[!grepl("\\(", obj)]
return(obj)
}

# list all available data objects
objs = list_available_data(package="MotrpacRatTraining6moData")

# identify data objects with "aorta" in them
has_aorta = c()
for (obj in objs){
print(obj)
# skip ATAC data, which doesn't have vena cava data
if(grepl("ATAC", obj)){
next()
}
# skip GENE_UNIVERSES, which already uses VENACV
if(obj=="GENE_UNIVERSES"){
next()
}

data = get(obj)
if (is.data.frame(data)){
if (any(data == "t65-aorta", na.rm=TRUE)){
has_aorta = c(has_aorta, obj)
}
if (any(data == "aorta", na.rm=TRUE)){
has_aorta = c(has_aorta, obj)
}
if (any(data == "Aorta", na.rm=TRUE)){
has_aorta = c(has_aorta, obj)
}
}else if (is.vector(data)){
if("t65-aorta" %in% data){
has_aorta = c(has_aorta, obj)
}
}else{
print(sprintf("Not sure what type %s is", obj))
}
}

# manually edit data objects
unique(has_aorta)

data("METAB_VENACV_DA_METAREG")
METAB_VENACV_DA_METAREG$tissue_code[METAB_VENACV_DA_METAREG$tissue_code == "t65-aorta"] = "t99-vena-cava"
stopifnot(!any(METAB_VENACV_DA_METAREG == "t65-aorta", na.rm = TRUE))
usethis::use_data(METAB_VENACV_DA_METAREG, overwrite = T)

data("METAB_VENACV_DA")
METAB_VENACV_DA$tissue_code[METAB_VENACV_DA$tissue_code == "t65-aorta"] = "t99-vena-cava"
stopifnot(!any(METAB_VENACV_DA == "t65-aorta", na.rm = TRUE))
usethis::use_data(METAB_VENACV_DA, overwrite = T)

data("OUTLIERS")
OUTLIERS$tissue_code[OUTLIERS$tissue_code == "t65-aorta"] = "t99-vena-cava"
stopifnot(!any(OUTLIERS == "t65-aorta", na.rm = TRUE))
usethis::use_data(OUTLIERS, overwrite = T)

data("TISSUE_ABBREV_TO_CODE")
TISSUE_ABBREV_TO_CODE[TISSUE_ABBREV_TO_CODE == "t65-aorta"] = "t99-vena-cava"
stopifnot(!any(TISSUE_ABBREV_TO_CODE == "t65-aorta", na.rm = TRUE))
usethis::use_data(TISSUE_ABBREV_TO_CODE, overwrite = T)

data("TISSUE_CODE_TO_ABBREV")
names(TISSUE_CODE_TO_ABBREV)[names(TISSUE_CODE_TO_ABBREV) == "t65-aorta"] = "t99-vena-cava"
stopifnot(!any(TISSUE_CODE_TO_ABBREV == "t65-aorta", na.rm = TRUE))
stopifnot(!any(names(TISSUE_CODE_TO_ABBREV) == "t65-aorta", na.rm = TRUE))
usethis::use_data(TISSUE_CODE_TO_ABBREV, overwrite = T)

data("TRAINING_REGULATED_FEATURES")
TRAINING_REGULATED_FEATURES$tissue_code[TRAINING_REGULATED_FEATURES$tissue_code == "t65-aorta"] = "t99-vena-cava"
stopifnot(!any(TRAINING_REGULATED_FEATURES == "t65-aorta", na.rm = TRUE))
usethis::use_data(TRAINING_REGULATED_FEATURES, overwrite = T)

data("TRNSCRPT_VENACV_DA")
TRNSCRPT_VENACV_DA$tissue_code[TRNSCRPT_VENACV_DA$tissue_code == "t65-aorta"] = "t99-vena-cava"
stopifnot(!any(TRNSCRPT_VENACV_DA == "t65-aorta", na.rm = TRUE))
usethis::use_data(TRNSCRPT_VENACV_DA, overwrite = T)

data("PHENO")
PHENO[PHENO$tissue_code_no == "T65",]
PHENO$tissue_code_no[PHENO$tissue_code_no == "T65"] = "T99"
PHENO$tissue_description[PHENO$tissue_description == "Aorta"] = "Vena Cava"
PHENO$specimen.processing.aliquotdescription = gsub("Aorta", "Vena Cava", PHENO$specimen.processing.aliquotdescription)
PHENO$specimen.processing.sampletypedescription[PHENO$specimen.processing.sampletypedescription == "Aorta"] = "Vena Cava"
stopifnot(!any(PHENO == "t65-aorta", na.rm = TRUE))
usethis::use_data(PHENO, overwrite = T)
2 changes: 1 addition & 1 deletion inst/scripts/save_sample_level_data_metabolomics.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ separate(dataset,into=c("phase","tissue","ome","modality","platform"),
#5. Remove vena cava contaminated samples---------------------------------------
# First remove female 1w and 2w vena cava samples from data
mutate(data_for_dea = pmap(list(tissue,data_for_dea,pheno), function(tissue,dat,pheno){
if(tissue == "t65-aorta"){
if(tissue == "t99-vena-cava"){
to_include <- pheno %>% filter(!((sex == "F") &
(tr_group == "1_0" | tr_group == "2_0")))
return(dat[,to_include$viallabel])
Expand Down
2 changes: 1 addition & 1 deletion vignettes/MotrpacRatTraining6moData.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ div.yellow {

<div class = "yellow">

This vignette is under construction. If something is unclear or obviously missing,
If you run into problems,
please submit an issue [here](https://github.com/MoTrPAC/MotrpacRatTraining6moData/issues).

</div>
Expand Down

0 comments on commit 874814b

Please sign in to comment.