Skip to content

Instantly share code, notes, and snippets.

View tbrittoborges's full-sized avatar
🎯

Thiago Britto Borges tbrittoborges

🎯
View GitHub Profile
library(tidyverse)
library(lubridate) # for the days() function
library(fuzzyjoin) # for the fuzzy_left_join() function
climate <- read_tsv('./timetable.csv')
# date temperature
#1 2018-11-21 100
#2 2018-11-22 80
SIRV LexogenSIRVData exon 2001 2484 . - 0 gene_id "SIRV1"; transcript_id "SIRV101"; exon_assignment "SIRV101_0";
SIRV LexogenSIRVData exon 2001 2484 . - 0 gene_id "SIRV1"; transcript_id "SIRV103"; exon_assignment "SIRV103_0";
SIRV LexogenSIRVData exon 2001 2484 . - 0 gene_id "SIRV1"; transcript_id "SIRV104"; exon_assignment "SIRV104_0";
SIRV LexogenSIRVData exon 2001 2484 . - 0 gene_id "SIRV1"; transcript_id "SIRV106"; exon_assignment "SIRV106_0";
SIRV LexogenSIRVData transcript 2001 11763 . - 0 gene_id "SIRV1"; transcript_id "SIRV104";
SIRV LexogenSIRVData transcript 2001 11786 . - 0 gene_id "SIRV1"; transcript_id "SIRV101";
SIRV LexogenSIRVData transcript 2001 11786 . - 0 gene_id "SIRV1"; transcript_id "SIRV106";
SIRV LexogenSIRVData transcript 2001 11791 . - 0 gene_id "SIRV1"; transcript_id "SIRV103";
SIRV LexogenSIRVData gene 2001 12643 . - 0 gene_id "SIRV1";
SIRV LexogenSIRVData exon 2007 2484 . - 0 gene_id "SIRV1"; transcript_id "SIRV102"; exon_assignment "SIRV102_0";
@tbrittoborges
tbrittoborges / visit.md
Last active February 6, 2019 13:41
Places to visit in Heidelberg

Places to visit

The castle

A nice walk that you can start from the Old bridge or Bergstraße (Neuenheim). Also check the Neckarwiese, Alte brücke (old bridge) and Hauptstraße (main street)
Although it's winter, the botanical garden has a small greenhouse. The garden is also within the main University Campus, and so offers a good opportunity to check it out.
@tbrittoborges
tbrittoborges / .sh
Created January 31, 2019 10:00
install R package from the command line
# from https://stackoverflow.com/users/2490497/jangorecki
Rscript -e 'install.packages("eulerr", repos="https://cran.rstudio.com")'
#!/usr/bin/env python
# __author__ = 'tbrittoborges'
import subprocess
import tempfile
import sys
import utils
seqs = utils.fasta_parser('.fasta')
@tbrittoborges
tbrittoborges / chr_sizes.sh
Last active January 24, 2019 12:46
How to get the chromossomes sizes for an assembly
# from https://www.biostars.org/p/272373/#272461
cut -f1,2 genome.fa.fai > genome.size
@tbrittoborges
tbrittoborges / parse_abb.py
Last active November 13, 2018 09:41
parse medical abbreviations from wikipedia
import pandas as pd
x = pd.read_html('https://de.wikipedia.org/wiki/Medizinische_Abk%C3%BCrzungen')
x=pd.concat(x)
x.tail()
x.set_index(0)[1]
def read_fasta_from_str(fasta):
"""
:param str fasta: multiple sequences in fasta string
"""
from itertools import groupby
def is_header(line):
return line.startswith(">")
@tbrittoborges
tbrittoborges / mean_sd_read_length.sh
Created February 23, 2018 12:54
calculates the average and sd read length from https://www.biostars.org/p/243552/#243563
for f in raw_reads{39..50}.fq.gz
do
echo "$f "
gzip -cd $f | awk 'BEGIN { t=0.0;sq=0.0; n=0;} ;NR%4==2 {n++;L=length($0);t+=L;sq+=L*L;}END{m=t/n;printf("total %d avg=%f stddev=%f\n",n,m,sq/n-m*m);}'
done
@tbrittoborges
tbrittoborges / pd_latex_table.py
Last active February 9, 2018 22:14
Pandas recipe for better latex tables
def better_table(table, caption, name):
start = r"""
\begin{{table}}[!htb]
\sisetup{{round-mode=places, round-precision=2}}
\caption{{{}}}\label{{table:{}}}
\centering
""".format(caption, name)
end = r"\end{table}"