Skip to content

Instantly share code, notes, and snippets.

library(tidyverse)
ms_dial_filter <- function(df, adduct, annotatelevel, cv) {
df %>% dplyr::select(`Metabolite name`, `Adduct type`, `Annotation tag (VS1.0)`, `Total score`,
`RT similarity`, `Average Rt(min)`, INCHIKEY , 33:ncol(df)) %>%
filter(`Annotation tag (VS1.0)` %in% annotatelevel) %>%
filter(`Adduct type` %in% adduct) %>%
mutate(qc_mean = rowMeans(dplyr::select(., contains("QC")))) %>%
filter(qc_mean != 0) %>%
mutate(qc_cv = apply(dplyr::select(., contains("QC")), 1, sd)/ qc_mean * 100) %>%
# Reference: https://github.com/jjallaire/deep-learning-with-r-notebooks
library(keras)
use_backend(backend = "plaidml")
# 6-1 original ver
# get_layer(model, index = 2) %>%
# set_weights(list(embedding_matrix)) %>%
# freeze_weights()
# tensorflow backend
# original: https://github.com/jjallaire/deep-learning-with-r-notebooks/blob/master/notebooks/5.4-visualizing-what-convnets-learn.Rmd
library(keras)
model <- application_vgg16(
weights = "imagenet",
include_top = FALSE
)
layer_name <- "block3_conv1"
library(readxl)
library(tidyr)
library(dplyr)
df_XX <- read_excel(path = "hoge.xlsx",
sheet = 1,
na = "N/A")
Metabo <- df_XX %>% spread("Component Name", Area)
@siero5335
siero5335 / metabolo_test.csv
Last active May 7, 2016 10:33
本人の食前食後(各 n = 6)における尿中低分子代謝物の測定結果です。before, afterのサンプルは同一検体から採取されたサンプルとなります。食前食後に採取した同一サンプルを6分割後に前処理・測定しました。横軸はID, 採取タイミングのほかは測定物質名となります。NAは検出されなかった物質です。測定法は (Yuan, Min, et al. "A positive/negative ion-switching, targeted mass spectrometry-based metabolomics platform for bodily fluids, cells, and fresh and fixed tissue." Nature protocols 7.5 (20…
Component Name Food glyoxylate glycolate pyruvate lactate 2-oxobutanoate acetoacetate glycerate uracil fumarate Maleic acid 2-keto-isovalerate Guanidoacetic acid succinate Methylmalonic acid 3-S-methylthiopropionate nicotinate taurine Pyroglutamic acid Citraconic acid 2-ketohaxanoic acid N-Acetyl-L-alanine oxaloacetate Hydroxyisocaproic acid malate hypoxanthine anthranilate p-aminobenzoate p-hydroxybenzoate acetylphosphate Carbamoyl phosphate a-ketoglutarate Phenylpropiolic acid 2-oxo-4-methylthiobutanoate 2-Hydroxy-2-methylbutanedioic acid 3-methylphenylacetic acid xanthine Hydroxyphenylacetic acid 2,3-dihydroxybenzoic acid orotate dihydroorotate allantoin Aminoadipic acid Indole-3-carboxylic acid phenylpyruvate Atrolactic acid Phenyllactic acid quinolinate phosphoenolpyruvate Uric acid dihydroxy-acetone-phosphate D-glyceraldehdye-3-phosphate sn-glycerol-3-phosphate shikimate aconitate allantoate Ascorbic acid 2-Isopropylmalic acid N-carbamoyl-L-aspartate_neg Pyrophosphate glucono-D-lactone myo-inositol hy