Skip to content

Instantly share code, notes, and snippets.

View janxkoci's full-sized avatar

Jeňa Kočí janxkoci

View GitHub Profile
@janxkoci
janxkoci / dropbox.patch
Created April 26, 2024 09:23 — forked from cvoltz/dropbox.patch
Patch to dropbox.py to get the correct PID when running Dropbox via flatpak
--- dropbox.py
+++ dropbox.py
@@ -134,11 +134,12 @@
FatalVisibleError("Platform not supported")
def is_dropbox_running():
- pidfile = os.path.expanduser("~/.dropbox/dropbox.pid")
-
try:
- with open(pidfile, "r") as f:
@janxkoci
janxkoci / bamfilter_oneliners.md
Created January 12, 2024 22:52 — forked from davfre/bamfilter_oneliners.md
SAM and BAM filtering oneliners
@janxkoci
janxkoci / unfold_fasta.sh
Last active January 8, 2024 13:21
reformats fasta from multiline format with columns (aka folded fasta) into one-line-per-sequence format (aka unfolded fasta)
#!/bin/bash
FASTA="$1"
awk 'ORS = $1~/>/ ? RS:FS' $FASTA | sed 's/ >/\n>/g' | sed '2~2s/ //g'
@janxkoci
janxkoci / estlgo2slendr.awk
Last active January 2, 2024 16:01
Convert legofit model with estimates to a slendr simulation script
#!/usr/bin/awk -f
function usage()
{
print "Convert legofit model with estimates to slendr simulation script." > "/dev/stderr"
print "usage: estlgo2slendr.awk model.lgo" > "/dev/stderr"
err_exit = 1
exit 1
}
@janxkoci
janxkoci / melt_table.sh
Last active October 20, 2023 09:41
Script takes output of GATK's VariantsToTable tool and melts it for better processing (with mysql or awk)
#!/bin/bash
## USAGE:
# bash melt_table.sh INFILE.tsv > OUTPUT.tsv
# set variables
outfile=/dev/stdout
tot_ncol=$(head -1 $1 | wc -w)
nsample=$(head -1 $1 | cut -f 3- | sed 's/\.[A-Z][A-Z]\>//g' | tr "\t" "\n" | uniq | wc -l)
ncol=$(expr $(expr $tot_ncol - 2) / $nsample)
@janxkoci
janxkoci / legofit_jobarray.sh
Created June 8, 2023 16:37
rerun failed legofit jobs from job array at MetaCentrum (PBS Pro)
#!/bin/bash
#PBS -l select=1:ncpus=64:mem=1gb,walltime=24:00:00
## GO TO WORKDIR
cd $PBS_O_WORKDIR || exit
## EXPORT PATH
export PATH="/storage/brno2/home/jena/bin:$PATH"
export PATH="/storage/brno2/home/jena/miniconda3/bin:$PATH"
@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 / meanfaslen.jl
Created January 24, 2023 12:37
my first ever Julia script - reads fasta from stdin and prints mean length of sequences
# julia shebang here
# mean fasta length
# non-fasta input may lead to division by zero !!
# use at your own risk
# add global constants for vars in loop below
# actually - requires julia v1.8+
nseq::Int = 0
len::Int = 0
@janxkoci
janxkoci / derived.awk
Last active February 1, 2023 12:27
get derived allele counts for set of populations (HQ archaics, africans)
#!/usr/bin/awk -f
BEGIN {
OFS = "\t"
print "chrom_pos", "ref", "alt", "aa", "da", "Altai", "Denisova3", "Chagyrskaya", "Vindija", "Africa"
}
$4 == $5 { # chimp matches gorilla
## concatenate African genotypes to a string (columns 10..NF)
@janxkoci
janxkoci / vcf2hetfa.sh
Created January 6, 2023 22:26
a wrapper script for vcf2hetfa,pl from the SGDP project
#!/bin/bash
## bash vcf2hetfa.sh input.vcf.gz
VCF=$1
OUT=$(basename -s .vcf.gz $VCF).hetfa.fa
TMP=${OUT}.tmp
rm $OUT # output build by appending, so remove old versions first