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 / sif2docker.sh
Created March 11, 2025 20:22
Convert a Apptainer/Singularity SIF file to a Docker image.
#!/bin/bash
set -euo pipefail
function show_usage() {
echo "Usage: $0 <input.sif> [docker_image_name:tag]"
echo
echo "Converts a Apptainer/Singularity SIF file to a Docker image."
echo
echo "Arguments:"
@pansapiens
pansapiens / hmmer_tblout_parser.py
Last active February 20, 2025 21:45
HMMER tblout / domtblout to pandas.DataFrame
#!/usr/bin/env python
# MIT License
# Copyright (c) 2022 Zebulun Arendsee (rhmmer code)
# Copyright (c) 2025 Andrew Perry (port to Python)
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
@pansapiens
pansapiens / for-codes.tsv
Created January 23, 2025 01:57
ANZSRC 2020 Field of Research (FoR) codes
30 AGRICULTURAL, VETERINARY AND FOOD SCIENCES
3001 Agricultural biotechnology
300101 Agricultural biotechnology diagnostics (incl. biosensors)
300102 Agricultural marine biotechnology
300103 Agricultural molecular engineering of nucleic acids and proteins
300104 Genetically modified animals
300105 Genetically modified field crops and pasture
300106 Genetically modified horticulture plants
300107 Genetically modified trees
300108 Livestock cloning
@pansapiens
pansapiens / ollama-export.sh
Last active January 25, 2025 03:19 — forked from supersonictw/ollama-export.sh
Ollama Model Export Script
#!/bin/bash
# Ollama Model Export Script
# Usage: bash ollama-export.sh vicuna:7b
# License: MIT (https://ncurl.xyz/s/o_o6DVqIR)
# https://gist.github.com/supersonictw/f6cf5e599377132fe5e180b3d495c553
set -e
echo "Ollama Model Export Script"
echo "License: MIT (https://ncurl.xyz/s/RD0Yl5fSg)"
@pansapiens
pansapiens / appengine_leveldb2json.py
Last active July 13, 2024 05:34 — forked from xlfe/export.py
Export from Google App Engine Datastore Backup LevelDB format to JSON flat file
#!/usr/bin/env python2.7
# Export from Google App Engine Datastore Backup LevelDB format to JSON flat file
# Based on: https://gist.github.com/xlfe/af25f160256e4d52f499dee7e8fa212f
##
# 2024 instructions:
##
# Using the Google Cloud console (https://console.cloud.google.com), find "Firestore"
# and export your database to a Cloud Storage "Bucket". Download the content of the Bucket.
@pansapiens
pansapiens / bam2fq_softclip.py
Created June 13, 2024 03:22
Extract mapped reads from BAM, lowercase masking soft-clipping
#!/usr/bin/env python
###
# bam2fq_softclip.py
###
# A script for exploring soft-clipping of aligned reads.
# Extracts mapped reads from a BAM file as a FASTQ, but encodes 'soft-clipped' regions
# as lowercase. Soft-clipped regions can be quickly visualized in the terminal like:
#
# ./bam2fq_softclip.py aligned.bam | grep --color=always [atcg] |less -R
@pansapiens
pansapiens / .a_README.md
Last active June 13, 2024 03:25
schollz/hostyoself docker-compose
@pansapiens
pansapiens / mirdeep_csv_to_counts.py
Created May 21, 2024 08:10
Convert miRDeep2 counts CSV to nicer TSV tables
#!/usr/bin/env python
import argparse
import pandas as pd
import re
import sys
from typing import Optional, List
import logging
import glob
import io
@pansapiens
pansapiens / find_adapters.sh
Created April 20, 2024 10:33
Find likely adapter sequences in a set of paired end FASTQs
#!/bin/bash
# Given a directory of fastq files, use bbmerge to find adapters sequences for every sample,
# align and find the consensus.
# Final consensus is in r1_adapter.consensus.fa and r2_adapter.consensus.fa - trim by hand
# if the automatic trimming up the the first 'n' isn't sensible
# Requires: bbmerge.sh (bbmap), muscle, emboss (cons)
@pansapiens
pansapiens / R-kill-vscode-remote.sh
Last active April 29, 2024 06:02
tmux persistent R session for vscode-R
#!/bin/bash
R_TMUX_SESSION_NAME="${R_TMUX_SESSION_NAME:-vscode-r}"
TMUX_CMD=$(command -v tmux)
if ! [ -x "$(command -v tmux)" ]; then
echo "Error: tmux is not installed."
exit 1
fi