Skip to content

Instantly share code, notes, and snippets.

View campenr's full-sized avatar
👾

Richard Campen campenr

👾
View GitHub Profile
@campenr
campenr / tidy_mothur_output.py
Created February 22, 2018 21:21
Function for cleaning up mothur output directory based on current files and an optional whitelist.
def tidy_output_dir(mothur_obj, whitelist=list()):
"""
Removes files from the output directory that are not listed in the current_files attribute or a whitelist.
USE WITH CAUTION: This will delete any files in the mothur objects output directory (which may just be the current working
directory) which can have unintended consequences.
This function was breifly included in mothur-py.utils, but the danger of its accidental use deleting important files has
relegated it to a gist.
@campenr
campenr / openGL_on_WLSS.md
Created February 17, 2018 00:40
Developing openGL on Ubuntu on the Windows Linux Subsystem
  1. Install Ubuntu through the Windows store

  2. Enable rendering of GUI applications from Ubuntu/WLSS in Windows using a Windows X-server

  • Install VxSrv on Windows
  • On Ubuntu/WLSS open .bashrc and add the following lines to the end, then save file and restart:
# tell GUI display to use the Windows X-server listening on localhost:0.0
export DISPLAY=localhost:0.0
# make rendering happen on the Windows side of things rather than Ubuntu
@campenr
campenr / make_old_colormap.py
Created March 20, 2017 19:40
Recreating the pre version 2.0 matplotlib qualitative colormaps
"""
Richard Campen, 2017
Before matplotlib version 2.0 the set of qualitative colormaps 'Accent', 'Dark2', 'Paired', 'Pastel1', 'Pastel2', 'Set1',
'Set2', and 'Set3' were continuous colormaps. As of matplotlib 2.0 these colormaps are discrete as per the change logs
(http://matplotlib.org/users/whats_new.html#qualitative-colormaps).
To recreate the continuous form of these colormaps as per pre 2.0 use the below code, changing the name of the colormap
as necessary.