Skip to content

Instantly share code, notes, and snippets.

View telatin's full-sized avatar
:octocat:

Andrea Telatin telatin

:octocat:
View GitHub Profile
@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 / 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 "
@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; }
#!/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

GitHub Emojis

People

Emoji Emoji Emoji
:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
@telatin
telatin / bactsnp.def
Created December 7, 2020 16:56
Singularity definition for BactSNP
Bootstrap: docker
From: centos:centos7.6.1810
%environment
source /opt/software/conda/bin/activate /opt/software/conda_env
%post
yum -y install epel-release wget which nano curl zlib-devel
@telatin
telatin / scholar_bibliography.py
Created December 2, 2020 11:57
Retrieve papers by author ID (Google Scholar)
#!/usr/bin/env python3
from scholarly import scholarly
import sys
def stderr(*args, **kwargs):
print(*args, file=sys.stderr, **kwargs)
author_id = 'Bua3yncAAAAJ'
author = scholarly.search_author_id(author_id).fill()