Skip to content

Instantly share code, notes, and snippets.

View jbellamycarter's full-sized avatar
🔬
Working from somewhere

Jedd Bellamy-Carter jbellamycarter

🔬
Working from somewhere
View GitHub Profile
@jbellamycarter
jbellamycarter / compare_semantic_numbering.py
Last active April 12, 2022 15:39
Python script for comparing software semantic version numbers
#!/usr/bin/env python3
# -*- coding:utf-8 -*-
import requests
import re
def _version_to_tuple(tag):
"""Converts major.minor.patch software version numbers to tuple.
Tolerates numbers starting with 'v' and alpha/beta post-numbering
@jbellamycarter
jbellamycarter / Beynon_Peptide_Sampling_Problem.ipynb
Last active March 10, 2021 11:28
Jupyter Notebook for solving a fun sampling problem posed by R. Beynon on Twitter.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jbellamycarter
jbellamycarter / CIU_IWAT_solver.py
Created September 26, 2020 18:33
Fit CIU data using intensity-weighted average arrival-time (IWAT) to sigmoid curve.
#!/usr/bin/env python3
# -*- coding:utf-8 -*-
# Copyright 2020 Jedd Bellamy-Carter
# MIT License
"""CIU IWAT solver.
Fit CIU data using intensity-weighted average arrival-time to a
four-parameter sigmoid curve. Optionally generates plot of fit.
INPUT: Standard CIU data representation.
@jbellamycarter
jbellamycarter / ccscalc_run_script.bat
Last active September 5, 2020 13:44
Running CCSCalc for IMS calibration. Requires CCSCalc from Waters (bundled with DriftScope).
:: This batch script will execute CCSCalc for the provided PDB file
:: and save the output in a file ending in "_ccscalc_out.txt".
::
:: Run with `Start-Process ccscalc_run_script.bat PDB_FILE_PATH` in PowerShell
:: or `ccscalc_run_script.bat PDB_FILE_PATH` in command prompt.
:: Save associated file `types_oplsaa.txt` in `DriftScope\docs\atom_types` directory
SETLOCAL
SET pdb_file=%1
SET atom_types="C:\DriftScope\docs\atom_types\types_oplsaa.txt"
@jbellamycarter
jbellamycarter / .pymolrc
Created June 11, 2020 11:57
Settings file for PyMOL #pymol
# PyMol start-up script with personal settings for visualisation
# Jedd Bellamy-Carter
set antialias, 2
#set ray_trace_mode, 1
set ray_interior_color, white
set cartoon_highlight_color, white
set cartoon_discrete_colors, on
set cartoon_side_chain_helper, on
set cartoon_dumbbell_length, 1.0
set cartoon_dumbbell_width, 0.2
@jbellamycarter
jbellamycarter / all_atom_rmsd.py
Last active June 4, 2020 20:04
Calculate the all-atom RMSD for a trajectory against reference. #python #molecular-modelling
def all_atom_rmsd(ref, traj):
"""Calculate the all-atom RMSD for a trajectory against reference.
Assumes that the same structure is being compared with all atoms
in the same order. `traj` can be a single frame or a full trajectory.
Parameters
----------
ref : list or ndarray
xyz coordinates for the reference positions (Nx3)
traj : list or ndarray
@jbellamycarter
jbellamycarter / multimol_split.py
Created June 2, 2020 11:40
PyMol Tkinter plugin that splits difficult multimolecule PDBs, such as those generated by SwissDock or CHARMM simulations.
"""
PyMol plugin that splits difficult multimolecule PDBs, such as those generated
by SwissDock or CHARMM simulations.
Writes a new file that treats each 'molecule' as a model which can then be parsed
by Pymol as 'states'.
Copyright 2018 Jedd Bellamy-Carter
Released under the terms of the MIT License (https://opensource.org/licenses/MIT)
"""
@jbellamycarter
jbellamycarter / .gitignore_global
Last active September 26, 2020 16:30
Global .gitignore file
# Run: git config --global core.excludesfile ~/.gitignore_global
# Created by https://www.gitignore.io/api/tex,linux,macos,python,backup,windows,archives,libreoffice,microsoftoffice
# Edit at https://www.gitignore.io/?templates=tex,linux,macos,python,backup,windows,archives,libreoffice,microsoftoffice
### Archives ###
# It's better to unpack these files and commit the raw source because
# git has its own built in compression methods.
*.7z
*.jar
*.rar
@jbellamycarter
jbellamycarter / pdb_reader.py
Last active May 22, 2020 11:32
Python Class Snippet for parsing simple .pdb and .pdbqt files
from collections import OrderedDict
# Uses OrderedDict for maintaining insertion order pre-Python3.7
class PDB():
"""
Class for parsing PDB files that follow the accepted format
https://www.wwpdb.org/documentation/file-format-content/format33/sect9.html#ATOM
Extracts ATOM and HETATM records.
HETATM with HOH resname are removed.
@jbellamycarter
jbellamycarter / all_atom_rmsd.py
Last active June 4, 2020 20:29
Snippets for useful calculations with atomic coordinates.
def all_atom_rmsd(ref, traj):
"""Calculate the all-atom RMSD for a trajectory against reference.
Assumes that the same structure is being compared with all atoms
in the same order. `traj` can be a single frame or a full trajectory.
Parameters
----------
ref : list or ndarray
xyz coordinates for the reference positions (Nx3)
traj : list or ndarray