Matlab engine
Ref: https://pypi.org/project/matlabengine/
https://www.mathworks.com/help/matlab/matlab_external/install-the-matlab-engine-for-python.html
```conda create -n matlab python=3.7
conda activate matlab
cd <matlabroot>/extern/engines/python
mkdir build
sudo chmod 777 build
python setup.py install
```
# Conda
## Miniconda
- Download link: [miniconda linux](https://www.anaconda.com/docs/getting-started/miniconda/install#macos-linux-installation:to-download-a-different-version)
```bash=
DIR=$HOME/miniconda3
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
bash Miniconda3-latest-Linux-x86_64.sh -b -p $DIR
source $DIR/bin/activate
conda init
# Install ...
conda create --name <your_env_name> python=<python_version> # e.g., your_env_name=test, python_version=3.11
pip install -r requirements.txt
```
## Anaconda
Installation website: https://www.anaconda.com/download#downloads
Choose proper version for Operating System, get the link
```bash=
# Download the installation file (e.g. Linux 64-Bit (x86) Installer (860 MB))
wget https://repo.anaconda.com/archive/Anaconda3-2023.03-1-Linux-x86_64.sh
# Run the Anaconda installation script with the following command:
bash Anaconda3-2023.03-1-Linux-x86_64.sh
# Activate the Anaconda environment
source ~/anaconda3/bin/activate
# Create new environments
conda create --name myenv
# Activate the new environment
conda activate myenv
# wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
# bash Miniconda3-latest-Linux-x86_64.sh
# conda create -n myenv python=3.7
# conda activate myenv
```
## Conda environment transferation across devices
```bash=
# Check conda env
(base) loci@Mac:~$ conda env list
# Head to loci_env
(loci_env) loci@Mac:~$ conda activate loci_env
# Export loci_env
(loci_env) loci@Mac:~$ conda env export > loci_env.yml
# Location loci_env.yml file to another device
# Create new env from loci_env.yml file
(base) loci@Typhoon:~$ conda env create -f loci.yml
# Activate loci_env
(loci_env) loci@Typhoon:~$ conda activate loci_env
```
# MATLAB
To get MATLAB lisence through NTHU, one needs to register NTHU email account (e.g. s111080421@m111.nthu.edu.tw) from [ccxp](https://www.ccxp.nthu.edu.tw/ccxp/INQUIRE/index.php?lang=english) system. Check this [instruction](https://learning.site.nthu.edu.tw/var/file/319/1319/img/2902/1090423NationalTsingHuaUniversity_ENGInstallationGuideline-V9.pdf).
1. Log in using NTHU account

2. Download installation file
Download: https://www.mathworks.com/downloads/
E.g.: matlab_R2023a_glnxa64.zip
3. Install MATLAB on [Ubuntu](https://www.mathworks.com/matlabcentral/answers/518584-how-do-i-install-on-ubuntu)
```bash=
cd /opt/matlab_R2023a_glnxa64
chmod +x ./*
cd /opt/matlab_R2023a_glnxa64/bin/glnxa64
chmod +x ./*
cd /opt/matlab_R2023a_glnxa64
./install
```
Up to now, if the Matlab Installer does not start, use the command below to fix the error.
```bash=
xhost +SI:localuser:root
```
## Docker MATLAB images: https://hub.docker.com/r/mathworks/matlab
Docker engine version: https://www.mathworks.com/support/requirements/python-compatibility.html
4. [Manually Activate Software on a Computer](https://www.mathworks.com/licensecenter/licenses/40638624/4628136/activations)
Step 1: Access to *License Center*
Step 2: Tag *Install and Activate*
Step 3: *View activated computers*
Step 4: *Activated a computer*
Step 5: Fill the form
The form should be filled out as follows (A100 machine):
```
Release: R2023a.
Operating System: Linux
Host ID: Enter the MAC address of your primary network interface without colons. If eth0 is your primary network interface, the Host ID would be ==00163eaa5605==.
Computer Login Name: yang_loci (as indicated by your command prompt)
Activation Label: yang_loci (or any other label you prefer)
```

Note:
```
# Host ID (MAC Address of Primary Network Interface):
ip link show
ifconfig -a | grep ether
# Find the Host ID in the License File
grep -i "hostid" license.lic
```
# Others
## CHARMM
Installation pyCHARM
http://charmm.chemistry.harvard.edu/main.php
Instruction pyCHARM
https://academiccharmm.org/documentation/installation#Install
## Modeller
Anaconda:
https://anaconda.org/salilab/modeller
Modeller instr:
https://salilab.org/modeller/10.4/release.html#osx
Registration for non-academic license:
https://salilab.org/modeller/registration.html
Modify license key in /Users/loctran/opt/anaconda3/envs/modeller_env/lib/modeller-10.4/modlib/modeller/config.py file
```python
install_dir = r'/Users/loctran/opt/anaconda3/envs/modeller_env/lib/modeller-10.4'
license = r'MODELIRANJE'
```
Run conda install `conda install -c salilab modeller`
## CMake
> Download: https://cmake.org/download/
> Installing CMake: https://cmake.org/install/
```bash
# apt or sudo apt
apt update
apt install gcc
export CC=gcc
apt install g++
export CXX=g++
apt install make
export MAKE=make
apt-get install libssl-dev
./bootstrap -- -DCMAKE_BUILD_TYPE:STRING=Release
make
make install
```
## Install DSSP
> Info link: https://bio.tools/dssp
> Manual: https://github.com/PDB-REDO/dssp/blob/trunk/doc/mkdssp.pdf
```bash
git clone https://github.com/PDB-REDO/dssp.git
cd dssp
mkdir build
export CXX=g++-9
export CC=gcc-9
sudo cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_COMPILER=g++-9 -DCMAKE_C_COMPILER=gcc-9
# Build files have been written to: /mnt/Tsunami_HHD/newloci/NativeEnsembleWeb_copy/dssp/build
cmake --build build
cmake --install build
```
Build
```bash
sudo cmake --install build
-- Install configuration: "Release"
-- Installing: /usr/local/lib/libdssp.a
-- Installing: /usr/local/lib/cmake/dssp/dsspTargets.cmake
-- Installing: /usr/local/lib/cmake/dssp/dsspTargets-release.cmake
-- Up-to-date: /usr/local/include/dssp.hpp
-- Installing: /usr/local/lib/cmake/dssp/dsspConfig.cmake
-- Installing: /usr/local/lib/cmake/dssp/dsspConfigVersion.cmake
-- Installing: /usr/local/lib/pkgconfig/libdssp.pc
-- Up-to-date: /usr/local/share/libcifpp/dssp-extension.dic
-- Installing: /usr/local/bin/mkdssp
-- Up-to-date: /usr/local/share/man/man1/mkdssp.1
```
## Install the [cif-tools](https://github.com/PDB-REDO/cif-tools)
> Check it: https://github.com/PDB-REDO/cif-tools/issues/5#issuecomment-1774519022
```bash=
git clone https://github.com/PDB-REDO/cif-tools.git
cd cif-tools
mkdir build
cd build
export CXX=g++-9
export CC=gcc-9
sudo cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_COMPILER=g++-9 -DCMAKE_C_COMPILER=gcc-9
>>> -- Build files have been written to: /mnt/Tsunami_HHD/newloci/NativeEnsembleWeb_copy/cif-tools/build
sudo cmake --build .
sudo cmake --install .
```
After installation
```bash=
-- Install configuration: "Release"
-- Installing: /usr/local/bin/pdb2cif
-- Installing: /usr/local/share/man/man1/pdb2cif.1
-- Installing: /usr/local/bin/cif2pdb
-- Installing: /usr/local/share/man/man1/cif2pdb.1
-- Installing: /usr/local/bin/cif-diff
-- Installing: /usr/local/share/man/man1/cif-diff.1
-- Installing: /usr/local/bin/cif-grep
-- Installing: /usr/local/share/man/man1/cif-grep.1
-- Installing: /usr/local/bin/cif-merge
-- Installing: /usr/local/share/man/man1/cif-merge.1
-- Installing: /usr/local/bin/cif-validate
-- Installing: /usr/local/share/man/man1/cif-validate.1
-- Installing: /usr/local/bin/mmCQL
-- Installing: /usr/local/share/man/man1/mmCQL.1
```
## Install [mrc](https://github.com/mhekkel/mrc)
```bash=
git clone https://github.com/mhekkel/mrc.git
cd mrc
mkdir build
cd build
export CXX=/usr/bin/g++-9
cmake ..
cmake --build .
sudo cmake --install .
```
After installation
```bash=
-- Install configuration: ""
-- Installing: /usr/local/bin/mrc
-- Installing: /usr/local/share/mrc/cmake/mrc-config.cmake
-- Installing: /usr/local/share/man/man1/mrc.1
-- Installing: /usr/local/share/doc/mrc//example
-- Installing: /usr/local/share/doc/mrc//example/CMakeLists.txt
-- Installing: /usr/local/share/doc/mrc//example/mrc-user.cpp
-- Installing: /usr/local/share/doc/mrc//example/hello.txt
```
## Install [libcifpp](https://github.com/PDB-REDO/libcifpp)
> Check it: https://github.com/PDB-REDO/libcifpp/issues/50
```bash=
git clone https://github.com/PDB-REDO/libcifpp.git --recurse-submodules
cd libcifpp
export CXX=g++-9
export CC=gcc-9
cmake -S . -B build -DCMAKE_INSTALL_PREFIX=/usr/local -DCMAKE_BUILD_TYPE=Release
cmake --build build
cmake --install build
```
Install libcifpp at /usr/local
:::spoiler `cmake -S . -B build -DCMAKE_INSTALL_PREFIX=/usr/local -DCMAKE_BUILD_TYPE=Release`
```bash=
-- The CXX compiler identification is GNU 9.4.0
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/g++-9 - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
Not trying to recreate symop_table_data.hpp since CCP4 is not defined
-- Performing Test GXX_LIBSTDCPP
-- Performing Test GXX_LIBSTDCPP - Success
-- Testing for known regex bug, since you're using GNU libstdc++
...
-- Build files have been written to: /mnt/Tsunami_HHD/newloci/NativeEnsembleWeb_copy/libcifpp/build
```
:::
:::spoiler `cmake --install build`
```bash=
-- Install configuration: "Release"
-- Installing: /usr/local/lib/libcifpp.a
-- Installing: /usr/local/lib/cmake/cifpp/cifppTargets.cmake
-- Installing: /usr/local/lib/cmake/cifpp/cifppTargets-release.cmake
-- Installing: /usr/local/include/cif++
-- Installing: /usr/local/include/cif++/matrix.hpp
-- Installing: /usr/local/include/cif++/item.hpp
-- Installing: /usr/local/include/cif++/datablock.hpp
-- Installing: /usr/local/include/cif++/forward_decl.hpp
-- Installing: /usr/local/include/cif++/point.hpp
-- Installing: /usr/local/include/cif++/parser.hpp
-- Installing: /usr/local/include/cif++/pdb
-- Installing: /usr/local/include/cif++/pdb/io.hpp
-- Installing: /usr/local/include/cif++/pdb/cif2pdb.hpp
-- Installing: /usr/local/include/cif++/pdb/pdb2cif.hpp
-- Installing: /usr/local/include/cif++/pdb/tls.hpp
-- Installing: /usr/local/include/cif++/dictionary_parser.hpp
-- Installing: /usr/local/include/cif++/exports.hpp
-- Installing: /usr/local/include/cif++/format.hpp
-- Installing: /usr/local/include/cif++/gzio.hpp
-- Installing: /usr/local/include/cif++/atom_type.hpp
-- Installing: /usr/local/include/cif++/utilities.hpp
-- Installing: /usr/local/include/cif++/iterator.hpp
-- Installing: /usr/local/include/cif++/symmetry.hpp
-- Installing: /usr/local/include/cif++/model.hpp
-- Installing: /usr/local/include/cif++/category.hpp
-- Installing: /usr/local/include/cif++/file.hpp
-- Installing: /usr/local/include/cif++/row.hpp
-- Installing: /usr/local/include/cif++/condition.hpp
-- Installing: /usr/local/include/cif++/validate.hpp
-- Installing: /usr/local/include/cif++/pdb.hpp
-- Installing: /usr/local/include/cif++/text.hpp
-- Installing: /usr/local/include/cif++/compound.hpp
-- Installing: /usr/local/include/cif++.hpp
-- Installing: /usr/local/share/libcifpp/mmcif_ddl.dic
-- Installing: /usr/local/share/libcifpp/mmcif_pdbx.dic
-- Installing: /usr/local/share/libcifpp/mmcif_ma.dic
-- Installing: /usr/local/share/libcifpp/components.cif
-- Installing: /usr/local/lib/cmake/cifpp/cifppConfig.cmake
-- Installing: /usr/local/lib/cmake/cifpp/cifppConfigVersion.cmake
-- Installing: /usr/local/etc/cron.weekly/update-libcifpp-data
-- Installing: /usr/local/var/cache/libcifpp
-- Installing: /usr/local/etc/libcifpp/cache-update.d
-- Installing: /usr/local/etc/libcifpp.conf
A configuration file has been written to /usr/local/etc/libcifpp.conf, please edit this file to enable automatic updates
```
:::
## [Rhapsody](https://github.com/prody/rhapsody) or [Rhapsody](https://github.com/luponzo86/rhapsody)
Installation, please refer to github website (python≤3.9)
```bash=
# Take as your reference
pip install -U prody-rhapsody
# We also can download the folder
git clone https://github.com/prody/rhapsody.git
cd rhapsody
pip install -e .
```
```python
import rhapsody as rd
import os
rd.initialSetup('./initialSetup')
os.chdir('./initialSetup/') # Change working dir
# Mapping SAV into PDB structure
SAV_coord = ['P06213 906 A G']
rd.Uniprot.mapSAVs2PDB(SAV_coord)
```
```bash=
# Print out on your screen should be like this
array([('P06213 906 A G', 'P06213 906 A G', '7PG0 A 867 A', 786)],
dtype=[('orig. SAV coords', '<U25'), ('unique SAV coords', '<U25'), ('PDB SAV coords', '<U100'), ('PDB size', '<i4')])
```
You then install a visualization software (e.g., VMD, PyMOL) to take a look at this mutation.
- UniProtID: P06213
- PDB ID: 7PG0
- PDB chainID: A
- PDB resID: 867
- Wild-type residue: A
- Mutant residue: G
```python!
# Generate features in Rhapsody study
# 1. Total 33 features
rhd = rd.Rhapsody(query=SAV_coord)
rhd.setFeatSet('all')
featMatrix = rhd.calcFeatures(filename=None)
# 2. 8 features used in TANDEM-DIMPLE
rhd.setFeatSet(['wt_PSIC', 'Delta_PSIC', 'BLOSUM', 'entropy', 'ranked_MI', 'ANM_effectiveness-chain', 'ANM_sensitivity-chain', 'stiffness-chain'])
featMatrix = rhd.calcFeatures(filename=None)
# Feature set
rhd.featSet
```
## Github
1. Setup SSH for GitHub repository
https://docs.github.com/en/authentication/connecting-to-github-with-ssh/about-ssh
2. git push
```bash=
git remote set-url origin git@github.com:locitran/locitran.github.io.git
git remote -v # it should show following
origin git@github.com:Loci-Tran/locitran.github.io.git (fetch)
origin git@github.com:Loci-Tran/locitran.github.io.git (push)
git push -u origin main
# Since you modify your file and wanna update it on github
git status # Check any files are modified or staged
git add . # Stage your changes
git add index.html # Stage a specific file
rm -f .git/index.lock # Remove the .lock file if needed
git commit -m "Updated index.html"
git push -u origin main
# Free jekyllthemes
https://www.youtube.com/watch?v=qZsgPgGdOzQ
```
## Github pages
```bash=
# ruby and gem are installed in Mac: Defaults
ruby -v
gem -v
gem install jekyll bundler
```
## A100
```bash=
squeue
sresource -u
sresource -n
```
# Synchronize and Mount
```bash
rsync -avzu --dry-run yang_loci@140.114.97.192:/mnt/nas_1/YangLab/loci/tandem/ tandem && \
rsync -aurtv tandem yang_loci@140.114.97.192:/mnt/nas_1/YangLab/loci/tandem/
rsync -avz --dry-run yang_loci@140.114.97.192:/mnt/nas_1/YangLab/loci/tandem/test tandem
rsync -hvrPt --dry-run yang_loci@140.114.97.192:/mnt/nas_1/YangLab/loci/tandem/ tandem
# Sync only new/changed files
## From Hurricane to A100
rsync -hvrPt yang_loci@140.114.97.192:/mnt/nas_1/YangLab/loci/tandem/ ~/tandem/
## From A100 to Hurricane
rsync -hvrPt ~/tandem/ yang_loci@140.114.97.192:/mnt/nas_1/YangLab/loci/tandem/
# --dry-run to see the files will be transfered
rsync -hvrPt --dry-run yang_loci@140.114.97.192:/mnt/nas_1/YangLab/loci/tandem/ ~/tandem/
sshpass -p Quangloc123 rsync -hrPt ~/tandem/ yang_loci@140.114.97.192:/mnt/nas_1/YangLab/loci/tandem/ && \
sshpass -p Quangloc123 rsync -hrPt yang_loci@140.114.97.192:/mnt/nas_1/YangLab/loci/tandem/ ~/tandem/
```
| Column 1 | Column 2 |
| -------- | -------- |
| `-a` | Archive mode (preserves permissions, timestamps, symbolic links, etc.) |
| `-v` | Verbose mode (shows progress) |
| `-z` | Compress data during transfer (reduces bandwidth) |
| `--progress` | Shows detailed progress during sync |
| `-u` | Skips identical files (same timestamp and size). |
Option Description
-a
-v Verbose mode (shows progress)
-z Compress data during transfer (reduces bandwidth)
--progress Shows detailed progress during sync
To setup synchronizing two directories:
```bash
# Add to ~/.bashrc file
## Sync both sites each 1 minute
nohup bash -c 'while true; do echo "$(date "+%Y-%m-%d %H:%M:%S") Running sync_rsync.sh" >> $HOME/sync_rsync.log; /bin/bash $HOME/sync_rsync.sh; sleep 60; done' >> $HOME/sync_rsync.log 2>&1 &
# sync_rsync.log
2025-03-08 13:49:19 Running sync_rsync.sh
sending incremental file list...
```
# [TensorFlow](https://www.tensorflow.org/install/pip) running on GPU and [Pytorch](https://pytorch.org/)
Take a look at this [site](https://www.tensorflow.org/install/source) to see which python/cuda version is available for GPU
## Installation
```bash!
conda create --name tf python=3.9
conda activate tf
python3 -m pip install tensorflow[and-cuda]
# Verify the installation:
python3 -c "import tensorflow as tf; print(tf.config.list_physical_devices('GPU'))"
```
For testing Pytorch running on GPU, we do similarly
```bash!
import torch
torch.__version__() # '2.6.0+cu124'
torch.cuda.is_available() # True
torch.cuda.device_count() # 4
torch.cuda.current_device() # 0
torch.cuda.device(0)
<torch.cuda.device at 0x7efce0b03be0>
torch.cuda.get_device_name(0) # 'NVIDIA GeForce RTX 3080'
# Set device
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
print('Using device:', device)
# Additional Info when using cuda
if device.type == 'cuda':
print(torch.cuda.get_device_name(0))
print('Memory Usage:')
print('Allocated:', round(torch.cuda.memory_allocated(0)/1024**3,1), 'GB')
print('Cached: ', round(torch.cuda.memory_reserved(0)/1024**3,1), 'GB')
```
## Docker images for: [pytorch:2.6.0-cuda12.6-cudnn9-devel](https://hub.docker.com/layers/pytorch/pytorch/2.6.0-cuda12.6-cudnn9-devel/images/sha256-faa67ebc9c9733bf35b7dae3f8640f5b4560fd7f2e43c72984658d63625e4487)
# Essential System Dependencies
## 1. Docker