Skip to content

Instantly share code, notes, and snippets.

View pansapiens's full-sized avatar

Andrew Perry pansapiens

  • Melbourne, Australia
View GitHub Profile
@pansapiens
pansapiens / grab_from_cloudstor_pw_protect.py
Last active March 2, 2021 22:52
Download a password protected file from CloudStor / ownCloud / NextCloud on the commandline
#!/usr/bin/env python3
# https://colab.research.google.com/drive/1CGOygPAmjTxWnmsywv178dh3u36ZRBgv
# You'll need to install the `robobrowser` Python package.
# Do it in a virtualenv like:
#
# python3 -m venv ~/.virtualenvs/cloudstor
# source ~/.virtualenvs/cloudstor/activate
# pip3 install robobrowser
@pansapiens
pansapiens / .bashrc
Last active March 13, 2024 04:15
Some SLURM aliases
alias default_account='sacctmgr --parsable2 show user -s andrewpe | tail -1 | cut -f 2 -d '\''|'\'''
alias fairshare='sshare -a --accounts $(default_account)'
alias jhistory='sacct -u ${USER} --starttime $(date -d "-1 month" +%Y-%m-%d) --format=User,JobID,Jobname,partition,state,exitcode,time,start,end,elapsed,MaxRss,MaxVMSize,nnodes,ncpus,nodelist'
alias jshow='scontrol show job'
alias jinfo='sacct --starttime $(date -d "-1 month" +%Y-%m-%d) --format=User,JobID,Jobname%64,partition,qos,ReqCPUS,ReqMem,state,exitcode,time,start,end,elapsed,MaxRss,MaxVMSize,nnodes,ncpus,nodelist -j'
alias node_types='sinfo -o '\''%c %m %n %R'\'' --sort '\''P'\'''
alias qhogs='sreport cluster UserUtilizationByAccount -t hours'
alias si='sinfo -o "%20P %5D %14F %8z %10c %10m %10d %11l %16f %N"'
alias sq='squeue -o "%8i %.60j %4t %10u %20q %20a %10g %20P %10Q %5D %2C %5m %11l %11L %R"'
alias squ='squeue -u $USER --format="%.18i %.9P %.60j %.8u %.8a %.2t %.10M %.6D %R"'
@pansapiens
pansapiens / Singularity.spec
Last active January 15, 2019 19:27 — forked from vsoch/Singularity.spec
A DeepVariant image for Singularity, reliant on a localimage pull of layers first
Bootstrap: localimage
From: deepvariant-0.6.1.simg
# Install Google Cloud SDK for the gcloud tool, then:
# We grab the official Docker image, push it to a locally running container repo, then get
# Singularity to pull it back.
# gcloud docker -- pull gcr.io/deepvariant-docker/deepvariant:0.6.1
# docker tag gcr.io/deepvariant-docker/deepvariant:0.6.1 localhost:5000/deepvariant:0.6.1
# docker run -d -p 5000:5000 --restart=always --name registry registry:2
# docker push localhost:5000/deepvariant:0.6.1
@pansapiens
pansapiens / csv_join_rm_mm.py
Last active September 7, 2018 06:59
Join CSVs for DART BLAST hits
#!/usr/bin/env python
from __future__ import print_function
import sys
from collections import OrderedDict
# Usage:
# python csv_join_rm_mm.py my_dart_ref.csv my_blast_hits.csv >joined_hits.csv 2>warnings.txt
REF_DART_ID_PREFIX = "SNP_"
@pansapiens
pansapiens / keybase.md
Created January 14, 2019 04:32
Keybase identification

Keybase proof

I hereby claim:

  • I am pansapiens on github.
  • I am pansapiens (https://keybase.io/pansapiens) on keybase.
  • I have a public key whose fingerprint is CC4E 5E55 3A06 BC36 2B20 F907 DB09 40BE B37B 0426

To claim this, I am signing this object:

@pansapiens
pansapiens / Dockerfile
Last active June 6, 2019 02:26
nullarbor Dockerfile
FROM continuumio/miniconda3
LABEL maintainer="Andrew Perry <andrew.perry@monash.edu>"
ARG KRAKEN_DB_URL=https://ccb.jhu.edu/software/kraken/dl/minikraken_20171019_4GB.tgz
ARG CENTRIFUGE_DB_URL=ftp://ftp.ccb.jhu.edu/pub/infphilo/centrifuge/data/p_compressed+h+v.tar.gz
ENV KRAKEN_DB_PATH=/databases/minikraken
ENV CENTRIFUGE_DB_PATH=/databases/centrifuge-db
ENV KRAKEN_DEFAULT_DB=$KRAKEN_DB_PATH/minikraken_20171013_4GB
ENV CENTRIFUGE_DEFAULT_DB=$CENTRIFUGE_DB_PATH/p_compressed+h+v
@pansapiens
pansapiens / 0README.md
Last active May 20, 2024 16:56
RStudio Server in Singularity (via rocker), M3 HPC flavour
@pansapiens
pansapiens / gff2gtf.R
Created August 8, 2019 03:25
gff2gtf.R
#!/usr/bin/env Rscript
# Based on https://www.biostars.org/p/45791/#45804
#
# Usage:
# ./gff2gtf.R genes.gff genes.gtf
#
# Dependencies can be easily installed like:
# conda create -n gff2gtf bioconductor-rtracklayer
# conda activate gff2gtf
@pansapiens
pansapiens / 00_README.md
Last active November 20, 2019 23:59
Quick scripts for setting up Data Carpentry Genomics: https://datacarpentry.org/genomics-workshop/setup.html (option B)
@pansapiens
pansapiens / aaindex.py
Created March 13, 2020 01:15
AAIndex parsing
import urllib.request as request
from collections import defaultdict
def parse_aaindex2(lines, default=None):
"""
Parse the lines of an AAIndex2 substitution matrix, return a dict of the entire database keyed by
AAIndex identifier.
The aaindex[id]['matrix'] dictionary is the same structure as Biopython's `Bio.SubsMat.MatrixInfo`
substitution matricies.