Skip to content

Instantly share code, notes, and snippets.

View janxkoci's full-sized avatar

Jeňa Kočí janxkoci

View GitHub Profile
@janxkoci
janxkoci / est2lgo.awk
Created January 27, 2022 16:46
(g)awk script to rewrite a lgo file using legofit estimates, for use with legosim
#!/usr/bin/awk -f
## USAGE
## awk -f est2lgo.awk model_est.txt model.lgo
BEGIN {OFS="\t"}
# read EST file and save param values into array
# note: array includes also header, but that won't match, so nobody cares
NR==FNR {a[$1]=$2; next}
@janxkoci
janxkoci / base-hpc.yml
Last active November 24, 2022 10:37
conda base env with two flavours - HPC and PC (aka remote and localhost, resp.)
name: base
channels:
- conda-forge
- bioconda
dependencies:
## TOOLS
- mamba # faster conda
- pip
- mawk # faster awk
- miller # data processor
@janxkoci
janxkoci / admix.yml
Last active August 6, 2022 12:05
conda environment for admixtools2
name: admix
channels:
- conda-forge
- bioconda
dependencies:
# R packages
- r-base=4
- r-rcpp
- r-tidyverse
- r-igraph
@janxkoci
janxkoci / add_to_bashrc.sh
Created October 27, 2021 10:31
add to ~/.bashrc
cd() { builtin cd "$@"; ll; } # Always list directory contents upon 'cd' (macOS style)
@janxkoci
janxkoci / bigfiles.sh
Last active November 15, 2022 10:57
See size of your top 10 largest files and folders.
#!/bin/bash
## Takes path as argument ($1) or uses current path instead (.) if no argument given.
path="${1:-.}"
## Gets size for items in path and reports the top 10 files and folders.
du -sh ${path}/* | sort -rh | head -n ${2:-10}
@janxkoci
janxkoci / conda_cheatsheet.md
Last active May 23, 2022 15:32
conda cheatsheet

Conda cheatsheet

Simple cheatsheet for conda - a package manager designed for scientists and HPCs, that works without root/sudo permissions.

Get conda

The conda manager is available for all platforms in two main versions:

  • Anaconda - best for Python-heavy workflows, includes 200+ packages for scientific computing.
  • Miniconda - best for other workflows - only the conda manager and its dependencies. It also allows installing any or all packages from Anaconda distribution, and thousands more.

Conda basics

@janxkoci
janxkoci / bigdata.yml
Last active September 4, 2022 13:44
environment for processing BigData
name: bigdata
channels:
- conda-forge
- bioconda
dependencies:
- mawk
- miller
- radian # jupyter/julia style R console
- r-base=4
- r-essentials
@janxkoci
janxkoci / ijob.sh
Last active April 5, 2023 11:57
convenience scripts for Torque PBS submission system (keep them in $HOME/bin)
#!/bin/bash
## Launch interactive session for testing purposes (Torque PBS & PBS Pro / OpenPBS)
# set CPUs and RAM (defaults = 8, 16gb)
cores=${1:-8}
ram=${2:-16}
## Torque PBS
qsub -I -N ijob -d . -v PATH -l nodes=1:ppn=${cores},mem=${ram}gb,walltime=48:00:00
@janxkoci
janxkoci / rbio.yml
Last active September 4, 2022 13:46
conda R environment for biological and phylogenetic data
name: rbio
channels:
- conda-forge
dependencies:
- r-base=4
- r-essentials
- r-magrittr
- r-ape
- r-seqinr
- r-poppr
@janxkoci
janxkoci / ir.sh
Last active March 28, 2022 22:22
Launch R in Jupyter Console (useful on headless servers)
#!/bin/bash
## R in Jupyter Console
## Usage:
# ir.sh # jupyter-console
# ir.sh qt # jupyter-qtconsole
## Install Jupyter Console & R kernel (optional: install Jupyter Qtconsole too)
# conda install -c conda-forge jupyter_console r-base r-irkernel # qtconsole