Skip to content

Instantly share code, notes, and snippets.

View PlethoraChutney's full-sized avatar

Rich PlethoraChutney

View GitHub Profile
@PlethoraChutney
PlethoraChutney / myheader.py
Created April 4, 2024 20:55
Header to read 16-bit MRC files
#!/usr/bin/env python
import sys
import struct
with open(sys.argv[1], "rb") as f:
[nx, ny, nz] = [x[0] for x in struct.iter_unpack('i', f.read(12))]
# don't care about mode, start
_ = f.read(16)
#!/usr/bin/env python
from cryosparc.tools import CryoSPARC
import json
import argparse
import numpy as np
# you would need to enter your information for CryoSPARC here
with open('/u/rposert/instance-info.json', 'r') as f:
instance_info = json.load(f)
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@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
return {
Span = function (elem)
if quarto.doc.is_format('docx') then
if elem.classes:includes('aside') then
return ""
else
return elem
end
end
end
#!/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