Skip to content

Instantly share code, notes, and snippets.

@anamariaelek
anamariaelek / hr.R
Created April 1, 2023 11:34
Modify HR zone boundaries for existing Garmin activity (export .fit file from Garmin Connect and convert it to .csv file using fitcsvtool)
#!/usr/bin/env Rscript
library(data.table)
library(stringr)
# run example:
# Rscript --vanilla hr.R 99,119,139,158,178,198 ACTIVITY.csv
# params:
require(data.table)
require(stringr)
# GTF TO BED
gtf_to_bed <- function(gtf, feature="transcript", bed_file=NULL) {
if ("character" %in% class(gtf)) {
gtf <- fread(gtf)
} else if ("data.frame" %in% class(gtf)) {
setDT(gtf)
}
@anamariaelek
anamariaelek / bdg2bw.sh
Last active February 9, 2022 17:30
Convert BedGraph to bigWig
#!/bin/bash
#$ -N dg2bw
#$ -cwd
#$ -q long-sl7,mem_512_12h,mem_512
#$ -l virtual_free=50G,h_rt=12:00:00,disk=50G
#$ -o bdg2bw.out
#$ -pe smp 8
#$ -j y
bdg2bw () {
@anamariaelek
anamariaelek / sinto.sh
Last active May 15, 2021 22:08
Add unique cell identifiers, merge and split bams.
#!/bin/bash
#$ -N sinto
#$ -cwd
#$ -q long-sl7,mem_512_12h,mem_512
#$ -l virtual_free=50G,h_rt=12:00:00,disk=50G
#$ -M anamaria.elek@crg.eu
#$ -o sinto.out
#$ -pe smp 16
#$ -j y
@anamariaelek
anamariaelek / samtools.count.sh
Last active May 15, 2021 22:08
Count all reads, nucleosomal-free reads and mononucleosomal reads in a bam file.
#!/bin/bash
#$ -N samtools.count
#$ -cwd
#$ -q long-sl7,mem_512_12h,mem_512
#$ -l virtual_free=50G,h_rt=12:00:00,disk=50G
#$ -M anamaria.elek@crg.eu
#$ -o samtools.count.out
#$ -pe smp 16
#$ -j y
@anamariaelek
anamariaelek / CB2bam.sh
Last active May 15, 2021 22:09
Add cell barcode from read name to CB tag in bam file, subset nucleosome free reads, and save fragments file
#!/bin/bash
#$ -N cb
#$ -cwd
#$ -q long-sl7,mem_512_12h,mem_512
#$ -l virtual_free=50G,h_rt=12:00:00,disk=50G
#$ -M anamaria.elek@crg.eu
#$ -o cb.out
#$ -pe smp 16
#$ -j y
@anamariaelek
anamariaelek / comparison_app.R
Last active April 16, 2019 16:14
comparisons for GSEA
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# GLOBAL #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
if (!require(shiny)) install.packages("shiny")
if (!require(shinydashboard)) install.packages("shinydashboard")
require(shiny)
require(shinydashboard)
require(stringr)
require(data.table)
@anamariaelek
anamariaelek / lastexport.py
Created February 1, 2019 18:41 — forked from bitmorse/lastexport.py
lastfm scrobble exporter (from https://gitorious.org/fmthings/lasttolibre/blobs/master/lastexport.py // changed the script to try more often on failure )
#!/usr/bin/env python
#-*- coding: utf-8 -*-
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
@anamariaelek
anamariaelek / eutilPMIDcitations.sh
Created December 3, 2018 13:44
E-utilities pipeline for exploration and retrieval of PubMed citations
#!/bin/bash
# find interesting articles PMIDs
db='pubmed'
query='Metagenome[mesh]+AND+Gastrointestinal+Microbiome[mesh]+AND+2008:2018[pdat]+AND+Journal+Article[ptyp]'
base='https://eutils.ncbi.nlm.nih.gov/entrez/eutils/'
url=$base"esearch.fcgi?db=$db&term=$query&retmax=100000"
curl $url -g -o esearch_pmid.xml
# save list of PMIDs to a text file
@anamariaelek
anamariaelek / data.R
Last active January 16, 2020 15:31
Nanopore sequencing summary
require(shiny)
require(shinydashboard)
require(data.table)
require(ggplot2)
require(ggpubr)
require(stringr)
require(DT)
require(kableExtra)
require(knitr)
require(plotly)