Skip to content

Instantly share code, notes, and snippets.

@chasemc
Created January 31, 2020 15:38
Show Gist options
  • Save chasemc/ef01f0f9fe159f6f65d8df9d3f0ce431 to your computer and use it in GitHub Desktop.
Save chasemc/ef01f0f9fe159f6f65d8df9d3f0ce431 to your computer and use it in GitHub Desktop.
Outline of new IDBac functions for programming with IDBac
---
title: "Programming IDBac"
author: "Chase Clark"
date: "1/31/2020"
output: html_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(eval = FALSE, include = TRUE)
```
Things people want to do:
- Create IDBac database
```{r}
idbac_create(fileName = "idbac_experiment",
filePath = "C:/Users/my/path")[[1]]
```
- Connect to IDBac database
```{r}
idbac_connect(fileName = "idbac_experiment",
filePath = "C:/Users/my/path")[[1]]
```
Retrieve all sample IDs in the database
```{r}
idbac_available_samples(pool = pool,
whetherProtein = FALSE,
allSamples = TRUE)
```
Retrieve entire metadata table
```{r}
idbac_get_metadata(pool = pool)
```
Retrieve metadata table by ID
```{r}
idbac_get_metadata(strainID = c("my_strain_1", "my_strain_2"),
pool = pool)
```
Retrieve metadata column by ID
```{r}
idbac_get_metadata(strainID = c("my_strain_1", "my_strain_2"),
metadataColumn = "speccies",
pool = pool)
```
Retreive all spectra from the database by ID
```{r}
idbac_get_spectra(pool = pool,
sampleID = sampleID,
protein = TRUE,
smallmol = FALSE)
```
Collapse all replicates of retrieved spectra
```{r}
MALDIquant::averageMassSpectra(IDBacApp::idbac_get_spectra(pool = pool,
sampleID = sampleID,
protein = TRUE,
smallmol = FALSE))
```
Retreive all peaks from the database by ID
```{r}
idbac_get_peaks(pool = pool,
sampleIDs = sampleIDs,
protein = TRUE)
```
Collapse all replicates of retrieved peaks
```{r}
IDBacApp::collapseReplicates(pool = pool,
sampleIDs = sample_ids ,
peakPercentPresence = 0.6,
lowerMassCutoff = 3000,
upperMassCutoff = 15000,
minSNR = 10,
tolerance = .002,
protein = TRUE)
```
Plot mirror plot
```{r}
assembleMirrorPlots(sampleID1 = "sample_id_from_pool_1",
sampleID2 = "sample_id_from_pool_2",
peakPercentPresence = 0.7,
lowerMassCutoff = 3000,
upperMassCutoff = 15000,
minSNR = 4,
tolerance = 0.002,
pool1 = pool1,
pool2 = pool2) # pool2 can be the same as pool1
```
Create a protein-data dendrogram
```{r}
idbac_dendrogram_creator(bootstraps = 0 ,
distanceMethod = "cosine",
clusteringMethod = "average",
proteinMatrix = proteinMatrix)
```
Create a metabolite association network
MIA
Create a fuzzy vector matrix
```{r}
createFuzzyVector(massStart = 3000L,
massEnd = 15000L,
ppm = 500,
massList = lapply(peak_data, function(x) x@mass),
intensityList = lapply(peak_data, function(x) x@intensity))
```
Check IDBac database version
```{r}
idbac_db_version(pool = pool)
```
Update IDBac database version
```{r}
idbac_update_db(pool = pool)
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment