Skip to content

Instantly share code, notes, and snippets.

View tbrittoborges's full-sized avatar

Thiago Britto Borges tbrittoborges

View GitHub Profile
@tbrittoborges
tbrittoborges / prepared_gtf_to_igv.sh
Created September 7, 2023 08:04
Sort and index gtf file for vizualization. Requires htslib.
#!/bin/bash
if [ $# -ne 1 ]; then
echo "Usage: $0 <input_gtf_file>"
exit 1
fi
input_gtf="$1"
output_prefix="output"
sorted_gtf="${output_prefix}.sorted.gtf"
@tbrittoborges
tbrittoborges / save_conda_envs.sh
Created August 25, 2023 09:36
Saving conda envs programatically
#!/bin/bash env
conda activate
mkdir -p envs/.export
PREFIX=$(dirname "$CONDA_PREFIX")
for d in "$PREFIX"/*; do
BNAME=$(basename "$d")
echo "$BNAME"
@tbrittoborges
tbrittoborges / E-P_pairs.R
Created July 31, 2023 08:09 — forked from mikelove/E-P_pairs.R
New approach to computing correlations between pairs of overlapping features in terms of data matrices
library(plyranges)
set.seed(1)
x <- data.frame(seqnames=1, start=0:9 * 100 + 1,
width=20, id=1:10) %>%
as_granges()
y <- data.frame(seqnames=1, start=round(runif(4,100,900)),
width=10, id=letters[1:4]) %>%
as_granges() %>%
"""
This example shows how to use the streaming feature with functions.
"""
import json
import os
import sys
from collections.abc import Generator
from typing import Any, Dict, List
@tbrittoborges
tbrittoborges / leafcutter_ea.R
Created November 4, 2021 12:30
leafcutter result exploratory analysis
library(tidyverse)
library(ggrepel)
# load the data to variable x
x <- read_csv('leafcutter_junctions.csv')
x %>%
# filters the dataframe to keep only significant called junctions
filter(abs(deltapsi) > 0.1 & p.adjust < 0.05) %>%
# groups junctions by comparison
@tbrittoborges
tbrittoborges / delete_intermediate_RNASeq.py
Created February 5, 2020 10:54
deletes files in the rrna_free_reads and trimmed_reads to save space
#!/usr/bin/env python
# coding: utf-8
from pathlib import Path
import os
from itertools import chain
from datetime import datetime
__author__: tbrittoborges
__date__: 05/02/2020
@tbrittoborges
tbrittoborges / delete_intermediate_RNASeq.py
Created February 5, 2020 10:54
deletes files in the rrna_free_reads and trimmed_reads to save space
#!/usr/bin/env python
# coding: utf-8
from pathlib import Path
import os
from itertools import chain
from datetime import datetime
__author__: tbrittoborges
__date__: 05/02/2020
@tbrittoborges
tbrittoborges / majiq_error.sh
Created April 1, 2019 13:14
majiq error 1st april
(majiq) tbrittoborges@atlas:/prj/CellRNANetworks/Baltica$ majiq build -h
Traceback (most recent call last):
File "/home/tbrittoborges/miniconda3/envs/majiq/bin/majiq", line 7, in <module>
from majiq.run_majiq import main
File "/home/tbrittoborges/miniconda3/envs/majiq/lib/python3.5/site-packages/majiq/run_majiq.py", line 2, in <module>
from majiq.src.build import build
File "majiq/src/build.pyx", line 24, in init majiq.src.build
File "/home/tbrittoborges/miniconda3/envs/majiq/lib/python3.5/site-packages/voila/api/__init__.py", line 1, in <module>
from voila.api.matrix_hdf5 import Psi, DeltaPsi, Heterogen
File "/home/tbrittoborges/miniconda3/envs/majiq/lib/python3.5/site-packages/voila/api/matrix_hdf5.py", line 8, in <module>
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