Git Product home page Git Product logo

concentr8r's Introduction

concentr8r

concentr8r is a collection of normalisation functions that are intended for magnetic resonance spectroscopy (MRS) spectra, more specifically that from nuclear magnetic resonance (NMR) and mass spectrometry (MS). Normalisation is a crucial yet context-dependent aspect of analysing MRS data meaning that one method may work perfectly with one study but make the spectra in another study worse so having a diverse range of techniques available is useful. This is a collection of such methods sourced from published literature.

Installation

concentr8r is currently only available on GitHub and can be sourced using the code below:

# install.packages("devtools")
devtools::install_github("kylebario/concentr8r")

Standard Pipeline

The intended use of concentr8r is to manipulate your NMR spectra so that they are as comparable as possible. This includes properly preprocessing the spectra, removing regions that are non-quantative, as well as correcting/flattening the baseline. It also includes normalising your spectra and removing the effects of dilution so that their concentrations are comparable.
Below is the code for the standard pipeline used to preprocess NMR spectra:

library(concentr8r)
read_in(path=system.file('extdata',package='concentr8r'),exp_type=list(exp=c("PROF_URINE_NOESY")), n_spec = 'multiple')
plot(ppm, X[2,], type = 'l', col = 'red', main = 'The Same NMR Spectrum (Processed vs. Non Processed)', xlab = 'Chemical Shift (ppm)', ylab = 'Intensity', xlim = c(10,-1))
preproc(X, ppm, meta, flip = TRUE, cali = TRUE, calib = 'tsp')
#> �[0;34mFlipping the spectra... �[0m�[1;32mDone.
#> �[0m�[0;34mCalibrating to tsp... �[1;32mDone.
#> �[0m�[0;34mChecking line width of spectra... �[0m�[1;32mAll spectra have linewidths under 1 
#> �[0m�[0;34mRemoving non-quantative regions... �[0m�[1;32mDone.
#> �[0m�[0;34mPerforming baseline correction... �[0m�[1;32mDone.
#> �[0m�[0;34mCalculating Noise Estimations... �[0m�[1;32mDone.
#> �[0m�[0;34mChecking that X and meta rows match... �[0m�[1;32mDone.
#> �[0m�[0;34mChecking that ppm length and X columns match... �[0m�[1;32mDone.
#> �[0m
points(ppm, X[2,], type = 'l', col = 'blue')
legend('topleft', legend = c("Unprocessed", "Processed"), col = c('red', 'blue'), lty = 1)

plot(ppm, X[2,], type = 'l', col = 'red', main = 'Two Spectra Unnormalised', xlab = 'Chemical Shift (ppm)', ylab = 'Intensity', xlim = c(9.5,0.25))
points(ppm, X[1,], type = 'l', col = 'blue')
legend('topleft', legend = c("Spectrum 1", "Spectrum 2"), col = c('red', 'blue'), lty = 1)

pqNorm(X, noi)
#> �[0;34mPreparing Spectra and Reference...
#> �[0m�[0;34mSelecting ppm and Removing Noise... �[0m�[1;32mDone.
#> �[0m�[0;34mBinning... �[0m�[1;32mDone.
#> �[0m�[0;34mCalculating Reference Spectrum... �[0m�[1;32mDone.
#> �[0;34mCalculating Dilfs... �[0m�[0;34mUsing the Mode... �[0m�[1;32mDone.
#> �[0m�[0;34mNormalising X... �[0m�[1;32mDone.
#> �[0m
plot(ppm, X_pqn[2,], type = 'l', col = 'red', main = 'Two Spectra Normalised', xlab = 'Chemical Shift (ppm)', ylab = 'Intensity', xlim = c(9.5,0.25))
points(ppm, X_pqn[1,], type = 'l', col = 'blue')
legend('topleft', legend = c("Spectrum 1", "Spectrum 2"), col = c('red', 'blue'), lty = 1)

As you can see there are multiple stages in preprocessing, that build to producing highly comparable spectra which is made all the easier by concentr8r.

Data Manipulation Functions

Data Manipulation ranges from ensuring the spectra are correctly orientated to scaling spectra based on their relationship to a reference. Here are some of the functions within concentr8r designed to do just that.

Flip

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.