Skip to content

Instantly share code, notes, and snippets.

@fawaz-dabbaghieh
Created November 17, 2016 13:01
Show Gist options
  • Save fawaz-dabbaghieh/46c508a754bd4ba3da9c34bca1be5bc2 to your computer and use it in GitHub Desktop.
Save fawaz-dabbaghieh/46c508a754bd4ba3da9c34bca1be5bc2 to your computer and use it in GitHub Desktop.
Simple function for extracting metadata from he DeepBlue server in R
deepblue_extract_metadata <- function(epi_mark,epi_project, auth_key) {
#get sample ids
experiments_ids <- deepblue_list_experiments(epigenetic_mark = epi_mark,
project = epi_project,
user_key = auth_key)
#extracting all information
metadata <- deepblue_info(deepblue_extract_ids(experiments_ids), user_key = auth_key)
#making the data.frame
metadata_df <- unique(foreach(sample = metadata,
.combine = bind_rows,
.inorder = TRUE) %do% {
meta <- as.data.frame(sample$sample_info)
meta$epigenetic_mark <- sample$epigenetic_mark
meta$data_type <- sample$data_type
meta$genome <- sample$genome
meta$experiment <- sample$name
meta$technique <- sample$technique
meta <- cbind(meta, sample$extra_metadata)
return(meta)
})
return(metadata_df)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment