Skip to content
This repository has been archived by the owner on May 16, 2023. It is now read-only.

Add base for c++ xeus-cling notebooks to run google collab, mybinder.org #1

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 27 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,27 @@
# cling-notebooks
# cling-notebooks

This repository contains xeus-cling notebooks of OpenMS C++ code example files.

Users can run in local or try it online on mybinder.org.

## To run in local

1. Create conda environment `cling-notebooks` using: `conda create -n cling-notebooks`.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not just use the environment.yml?

2. Activate conda environment using: `conda activate cling-notebooks`.
3. Install xeus-cling using: `conda install xeus-cling -c conda-forge`.
4. Install jupyterlab using: `conda install jupyterlab -c conda-forge`.
5. Install openms using conda or bioconda following the instructions given [here](https://openms.readthedocs.io/en/latest/installations/installation-on-macos.html#install-via-conda-or-bioconda).
6. Browse for the `.ipynb` notebooks and click on run.

## Browse the C++ notebooks online on mybinder.org

https://mybinder.org/v2/gh/OpenMS/OpenMS/develop?urlpath=https%3A%2F%2Fgithub.com%2Ftapaswenipathak%2FOpenMS%2Fblob%2Fdevelop%2FTutorial_AASequence.ipynb

## Browse the C++ notebooks on Google Collab

## Troubleshooting

Please read the issues having documentation on common errors you might get and how
to resolve them.

Let us know if you get errors not already mentioned.
66 changes: 66 additions & 0 deletions Tutorial_AASequence.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"id": "182ebb96",
"metadata": {},
"outputs": [],
"source": [
"#include <iostream>\n",
"#pragma base add_include_path(\"/Users/tapaswenipathak/miniconda3/envs/cling/include/OpenMS/\")\n",
"#include \"OpenMS/CHEMISTRY/AASequence.h\"\n",
"\n",
"using namespace OpenMS;\n",
"using namespace std;\n",
"\n",
"\n",
" // generate AASequence object from String\n",
" const String s = \"DEFIANGER\";\n",
" AASequence peptide1 = AASequence::fromString(s);\n",
"\n",
" // generate AASequence object from string literal\n",
" AASequence peptide2 = AASequence::fromString(\"PEPTIDER\");\n",
"\n",
" // extract prefix and suffix\n",
" AASequence prefix(peptide1.getPrefix(2));\n",
" AASequence suffix(peptide1.getSuffix(3));\n",
" cout << peptide1.toString() << \" \"\n",
" << prefix << \" \"\n",
" << suffix << endl;\n",
" \n",
" // create chemically modified peptide\n",
" AASequence peptide_meth_ox = AASequence::fromString(\"PEPTIDESEKUEM(Oxidation)CER\");\n",
" cout << peptide_meth_ox.toString() << \" \"\n",
" << peptide_meth_ox.toUnmodifiedString()\n",
" << endl;\n",
"\n",
" // mass of the full, uncharged peptide\n",
" double peptide_mass_mono = peptide_meth_ox.getMonoWeight();\n",
" cout << \"Monoisotopic mass of the uncharged, full peptide: \" << peptide_mass_mono << endl;\n",
"\n",
" double peptide_mass_avg = peptide_meth_ox.getAverageWeight();\n",
" cout << \"Average mass of the uncharged, full peptide: \" << peptide_mass_avg << endl;\n",
"\n",
" // mass of the 2+ charged b-ion with the given sequence\n",
" double ion_mass_2plus = peptide_meth_ox.getMonoWeight(Residue::BIon, 2);\n",
" cout << \"Mass of the doubly positively charged b-ion: \" << ion_mass_2plus << endl;\n",
"\n",
" // mass-to-charge ratio (m/z) of the 2+ charged b-ion and full peptide with the given sequence\n",
" cout << \"Mass-to-charge of the doubly positively charged b-ion: \" << peptide_meth_ox.getMZ(2, Residue::BIon) << endl;\n",
" cout << \"Mass-to-charge of the doubly positively charged peptide: \" << peptide_meth_ox.getMZ(2) << endl;\n",
"\n",
" // ... many more\n"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "C++17",
"language": "C++17",
"name": "xeus-cling-cpp17"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
7 changes: 7 additions & 0 deletions environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
name: openms
channels:
- openms
- conda-forge
dependencies:
- xeus-cling
- openms