Skip to content

Instantly share code, notes, and snippets.

View PlethoraChutney's full-sized avatar

Rich PlethoraChutney

View GitHub Profile

Keybase proof

I hereby claim:

  • I am plethorachutney on github.
  • I am plethorachutney (https://keybase.io/plethorachutney) on keybase.
  • I have a public key ASCNhMxyDzdrBvmhlN1W1u8lln0lwMH4G38UAhsueU3WJgo

To claim this, I am signing this object:

#!/usr/bin/env python3
import sys
if len(sys.argv) == 1:
diam = input('Particle diameter (A): ')
defocus = input('Mean defocus (um): ')
res = input('Target resolution (A): ')
ps = input('Pixel size (a/pix): ')
elif len(sys.argv) != 5:
print('Usage: box-sizer.py {diameter in A} {defocus in um} {resolution in A} {apix in A/pix}')
sys.exit(1)
#!/usr/bin/env python3
import re
import sys
char_pattern = re.compile('color:#7f7f7f[^>]*>([^<]*)')
with open(sys.argv[1], 'r') as f:
lines = [x.rstrip() for x in f]
line = ''.join(lines)
library(tidyverse)
data <- read_csv('~/Downloads/data-precs.csv')
counted <- data |>
filter(!is.na(res_id)) |>
select(pdb_id, name, secondary) |>
group_by(pdb_id) |>
mutate(
previous = lag(secondary)
@PlethoraChutney
PlethoraChutney / fix-blender.sh
Last active February 2, 2023 15:13
MolNodes blender fix commands
conda create --name blender python==3.10 biotite==0.35.0 mdanalysis==2.2.0 -c conda-forge -y
CONDAENV=$(conda info --envs | grep blender | awk -F ' ' '{print $2}')
pushd /Applications/Blender.app/Contents/Resources/3.4/ > /dev/null
mv python old_python
ln -s $CONDAENV python
popd > /dev/null
#!/bin/bash
# Test to make sure csparc2star.py is in PATH and installed correctly:
csparc2star.py -h &> /dev/null
if [ $? -ne 0 ]; then
echo Failed to run csparc2star.py. Are you in the correct virtual environment? Did you check your path?
exit
fi
# Change this to your csparc scratch directory. This should be where all your P* dirs are
#!/usr/bin/env python
import numpy as np
import pandas as pd
import umap
import sys
import matplotlib.pyplot as plt
import seaborn as sns
from sklearn.preprocessing import StandardScaler
from cryosparc.dataset import Dataset
return {
Span = function (elem)
if quarto.doc.is_format('docx') then
if elem.classes:includes('aside') then
return ""
else
return elem
end
end
end
@PlethoraChutney
PlethoraChutney / revert_symmexp_particles.py
Created October 5, 2023 19:51
Un-downsample a symmetry-expanded particle stack
from cryosparc.tools import CryoSPARC
import numpy as np
cs = CryoSPARC(
# you'll need env variables here, or just set stuff directly
)
cs.test_connection()
# we will filter fullsize_particles so that only the intersection with
# downsampled particles are retained. ctf, alignments, etc. will all
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.