Skip to content

Instantly share code, notes, and snippets.

View alexholehouse's full-sized avatar

Alex Holehouse alexholehouse

View GitHub Profile
# Once complete we expect CAMPARI_HOME, INCLUDE_DIRS and LIB_DIRS to be defined above.
#
# Makefile.local
# Written by Alex Holehouse for CAMPARI compilation with GNU compilers. Developed
# for ubuntu docker container autodeployment
#
SRC_DIR=${CAMPARI_HOME}/source
@alexholehouse
alexholehouse / emacs_bug.py
Last active October 23, 2022 23:33
emacs_bug
## ...........................................................................
## DEMO CODE
## ...........................................................................
## Note - this file may crash emacs on opening. If this is the case,
## edit the docstring in function0() to close the triple double-quotes (not using emacs!), and the
## file should open fine. You can then crash emacs by deleting one of the triple double quotes!
error: subprocess-exited-with-error

× pip subprocess to install build dependencies did not run successfully.
│ exit code: 1
╰─> [3660 lines of output]
    Ignoring numpy: markers 'python_version == "3.6"' don't match your environment
    Ignoring numpy: markers 'python_version == "3.7"' don't match your environment
    Ignoring numpy: markers 'python_version == "3.9"' don't match your environment
    Ignoring numpy: markers 'python_version == "3.10"' don't match your environment

Ignoring numpy: markers 'python_version >= "3.11"' don't match your environment

@alexholehouse
alexholehouse / vmd_on_hdpi_displays.md
Last active October 14, 2023 13:02
Guide on running VMD on high DPI screens

Guide on running VMD on high DPI screens

Running VMD on HDPI (high DPI - i.e. high resolution) screens in Linux remains a challenge due in part to the underlying FLTK library.

After exploring this for a while I came across the current solution which works reasonably well and should be relatively robust across cross-linux platforms. I'd be delighted if there were a simpler way, so please pull-request and update this if/when a better solution emerges. I wanted to write this so that someone with a minimal background in Linux could still get this up and running, as many people who use VMD may be new to Linux computing. If this describes you and things remain unclear, please

Setting up run_scaled

run_scaled is a simple but incredibly helpful bash script written by Alexander Kauer. It can be downloaded from here and added into your $PATH. If you know wha

## Code snippet for calculating the omega aro value for the WT A1-LCD sequence, as
## described in Martin, E. W., Holehouse, A. S., Peran, I., Farag, M., Incicco, J. J.,
## Bremer, A., Grace, C. R., Soranno, A., Pappu, R. V. & Mittag, T. Valence and
## patterning of aromatic residues determine the phase behavior of prion-like domains.
## Science 367, 694–699 (2020).
##
## This requires the localcider package (https://pypi.org/project/localcider/)
##
from localcider.sequenceParameters import SequenceParameters
@alexholehouse
alexholehouse / analyse_sequence_data.py
Created February 26, 2017 21:43
Simple code for reading in a FASTA file and accessing each sequence for analysis in localCIDER
from localcider.sequenceParameters import SequenceParameters
from pyfasta import Fasta
#
# This assumes you have previously installed localCIDER and pyfasta (both
# are available via pip)
#
# read in the FASTA file using pyfasta
F = Fasta('swissprot_human_proteome.fasta')
@alexholehouse
alexholehouse / campari_install.md
Last active January 27, 2024 13:19
CAMPARI installation guide

Installing CAMPARI from scratch

May 2014, Alex Holehouse - Pappulab

Last updated February 2016

CAMPARI can be challenging for users new to Linux/UNIX to install. To try and alleviate this, we provide here a more extended tutorial/guide for installing. This guide describes the process with both the Intel compilers (ifort, icc, and icpc) and GNU compilers too. Please note that your first port of call with respect to CAMPARI installation should be the CAMPARI documentation. This tutorial provides key information on correctly installing the dependencies (bits of software CAMPARI relies on to work). Although these dependencies are not part of CAMPARI, they can represent a barrier for getting CAMPARI running, so it seemed sensible to explicitly address their installation in the context of CAMPARI.

These steps have been tested successfully on several different Linux distros/setups (laptops, desktops, HPC cluster and Ubuntu,

@alexholehouse
alexholehouse / gist:6190193
Last active December 4, 2018 17:03
n-dimensional arrays in Python
## Function to create an n-dimensional array
# Main function to call
# typeOfitem
# Should be a class which can generate objects
# e.g. float, int, complex, or any other type, such as
# myCoolClass
#
# dimensions
# value for a 1D array, or a list or tuple defining the
@alexholehouse
alexholehouse / gist:2999989
Created June 26, 2012 23:07
CITPP correction
## The script [I'd edited] used to be;
#-----------------------------------------
cur.marker.id <- cbind(cur.marker.id, abs((cur.gene$startcoord+cur.gene$endcoord)/2 - cur.marker.id$chr_pos))
names(cur.marker.id)[6] <- c("dis_from_cur_gene")
cur.marker.id <- which.min(cur.marker.id$dis_from_cur_gene) # cur.marker.id is now the row in the cur.marker.id matrix which represents the marker closest to the current gene
## having found the closes cna, we assign it's values to the cur.marker
cur.marker <- cna[,cur.marker.id]
#-----------------------------------------
@alexholehouse
alexholehouse / JuliaQuicksort.jl
Created May 6, 2012 19:43
Julia Quicksort algorithm
function qsort!(a,lo,hi)
i, j = lo, hi
while i < hi
pivot = a[(lo+hi)>>>1]
while i <= j
while a[i] < pivot; i = i+1; end
while a[j] > pivot; j = j-1; end
if i <= j
a[i], a[j] = a[j], a[i]
i, j = i+1, j-1