Skip to content

Instantly share code, notes, and snippets.

View telatin's full-sized avatar
:octocat:

Andrea Telatin telatin

:octocat:
View GitHub Profile
#!/usr/bin/env bash
# Version 2.1.0
# QIB Cloud Documentation: https://quadram-institute.atlassian.net/servicedesk/customer/portal/3/article/4423859?src=1372879570
# this is for QIB cloud where user can sudo
# ======================================================================
# HINT:
# Create a ~/.user file with storing your NBI username and password:
# echo -e "username=XX\npassword=YY" > ~/.user
# ======================================================================
@telatin
telatin / format-thousand-separator.nim
Last active June 7, 2022 07:52
Procedure to add a thousands separator to a float [nim]
# https://forum.nim-lang.org/t/8162#52466
import strutils
proc floatSeparator(f: float, s=","): string =
var s = ($f).split('.')
s[0] = s[0].insertSep(',')
return s.join(".")
let
@telatin
telatin / stderr-print.sh
Created June 22, 2021 10:10
Bash function to print a string to STDERR
#Function to print to STDERR
echoerr() { echo "$@" 1>&2; }
@telatin
telatin / .bashrc.sh
Created June 12, 2020 15:30
environment-modules: configuration
export MODULEPATH='/your/path/to/modules'
case "$0" in
-sh|sh|*/sh) modules_shell=sh ;;
-ksh|ksh|*/ksh) modules_shell=ksh ;;
-zsh|zsh|*/zsh) modules_shell=zsh ;;
-bash|bash|*/bash) modules_shell=bash ;;
esac
module() { eval `/usr/bin/modulecmd $modules_shell $*`; }
@telatin
telatin / merge_lanes.sh
Last active February 16, 2022 14:04
Merge the four lanes generated by Illumina NextSeq 500 sequencing machines. Assumes default file names and .fastq.gz extension.
#!/bin/bash
# Andrea Telatin 2017, Bash Training for Bioinformatics, Quadram Institute
# Defaults:
input_dir="./";
ext='fastq.gz'
# Usage:
echo " Merge Illumina lanes
@telatin
telatin / cutadapt-primers.sh
Created June 25, 2021 15:20
Remove primers from paired end reads using Cutadapt and SeqFu
#!/bin/bash
set -euo pipefail
FOR=CCTACGGGNGGCWGCAG
REV=GGACTACHVGGGTATCTAATCC
# Cutadapt options
MINL=250
EXTRA=" --report minimal --cores 0 --discard-untrimmed "
#!/usr/bin/env python3
# Parses a file with a list of URLs (GTR user) and prints
# a table with their projects details
import json
import sys
import traceback
import urllib3
import xmltodict
from pprint import pprint
library(dada2)
library(ggplot)
packageVersion("dada2")
library(ShortRead)
packageVersion("ShortRead")
library(Biostrings)
packageVersion("Biostrings")
path <- "/Volumes/Informatics/telatin/qibx/ITS/"
prmr_funcn <- function(prmr) {
prmr_dna <- DNAString(prmr)
#!/usr/bin/env python3
"""
A program to check that a list of programs is avalable retrieving their versions, if required.
Example configuration JSON (by default will look for 'checker.json' in the same directory as the program itself):
{
"binaries": {
"Zip": {
"params": ["-h"],
"binary": "zip",
"stdout": "Copyright",
Contig1 Contig2 Edge
Salmonella~virus~FSLSP030 k141_1850 82.900904361823
k141_1850 Salmonella~virus~FSLSP030 82.900904361823
Salmonella~virus~Chi k141_1850 77.68907855001756
k141_1850 Salmonella~virus~Chi 77.68907855001756
Salmonella~virus~FSLSP088 k141_1850 74.64006567255709
k141_1850 Salmonella~virus~FSLSP088 74.64006567255709
Salmonella~phage~118970_sal1 k141_1850 74.42229632318072
k141_1850 Salmonella~phage~118970_sal1 74.42229632318072