This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from glob import glob | |
def decode_encode_pdb(input_file, output_file): | |
with open(input_file, 'r', encoding='utf-8') as file: | |
lines = file.readlines() | |
decoded_lines = [line.encode('utf-8').decode('utf-8', 'replace') for line in lines] | |
with open(output_file, 'w', encoding='utf-8') as file: | |
file.writelines(decoded_lines) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Run using the terminal command: pymol loadpdb.py | |
from glob import glob | |
from pymol import cmd | |
files = glob("*.pdb") | |
for pdb in files: | |
cmd.load(pdb, object=pdb[:-4]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
pdbs=$(ls *.pdb) | |
for pdb in $pdbs | |
do | |
prefix=${pdb:0:4} | |
grep -vf residues.txt $pdb > $prefix-ensemble-nores.pdb | |
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int CharToInt(char Digit) | |
{ | |
return (int)Digit - 48; | |
} | |
int main() | |
{ | |
int Int6 = CharToInt('6'); | |
printf("Int: %d", Int6); | |
return 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Add this keyword into plt.hist: weights=np.ones(len(data)) / len(data) | |
# Also make sure that density=False |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# assuming you already have com coordinates, com1 and com2, which can be generated using centerofmass and appropriate input | |
pseudoatom com1_particle, pos=com1 | |
pseudoatom com2_particle, pos=com2 | |
dist distance_com, com1_particle, com2_particle | |
save file.pse |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
c=".c" | |
for i in {1..10} ; do echo "#include <stdio.h>" > file$i$c | |
# the loop takes the #include statement and appends it into the first line of each file; done to avoid writing it out every time. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
resdict = {"ALA": "A","CYS": "C","ASP": "D","GLU": "E","PHE": "F","GLY": "G","HIS": "H","ILE": "I","LYS": "K","LEU": "L","MET": "M","ASN": "N","PRO": "P","GLN": "Q","ARG": "R","SER": "S","THR": "T","VAL": "V","TRP": "W","TYR": "Y"} | |
resdict_inv = {one_let: three_let for three_let, one_let in resdict.items()} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import matplotlib.pyplot as plt | |
plt.style.use('seaborn') # I personally prefer seaborn for the graph style, but you may choose whichever you want. | |
params = {"ytick.color" : "black", | |
"xtick.color" : "black", | |
"axes.labelcolor" : "black", | |
"axes.edgecolor" : "black", | |
"text.usetex" : True, | |
"font.family" : "serif", | |
"font.serif" : ["Computer Modern Serif"]} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# %%file build_dimer.py | |
import os | |
from PeptideBuilder import Geometry | |
import PeptideBuilder | |
import Bio.PDB | |
from simtk.unit import * | |
from simtk.openmm.app import * | |
import numpy as np | |
def buildPeptide(peptide, customAngles=False, phi=-40, psi=60, omega=180): |