Skip to content

Instantly share code, notes, and snippets.

View tbrittoborges's full-sized avatar
🎯

Thiago Britto Borges tbrittoborges

🎯
View GitHub Profile
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 / dorina_example.py
Created February 8, 2018 21:41
code for the Carina website
def analyse(genome, set_a, match_a='any', region_a='any',
set_b=None, match_b='any', region_b='any',
combine='or', genes=None, window_a=-1, window_b=-1,
datadir=None):
# It takes the name of the genome assembly to use, and at least a list of set A regulator names.
# A simple analysis run with a custom regulator would be:
from dorina.run import analyse
results = analyse('hg19', ['/path/to/custom/regulator.bed', 'PARCLIP_PUM2_hg19'])
@tbrittoborges
tbrittoborges / Junction_type_classification.py
Created January 22, 2018 12:58
Junction type classification
def junction_type2(row):
"""Junction type classification"""
# if there is no exons supported by realible junctions
# return a interable with empty strings
if row['exons_w_junct_sup'] is None:
return ['', '']
type_ = []
# each row is a junction
j_start, j_end, exons, strand = row.loc[[