Skip to content

Instantly share code, notes, and snippets.

View thanhleviet's full-sized avatar
🤗
Focusing

Thanh Lee thanhleviet

🤗
Focusing
View GitHub Profile
@thanhleviet
thanhleviet / job_submit.lua
Created June 21, 2023 17:40 — forked from treydock/job_submit.lua
SLURM job_submit lua script
--[[
SLURM job submit filter for QOS
Some code and ideas pulled from https://github.com/edf-hpc/slurm-llnl-misc-plugins/blob/master/job_submit.lua
--]]
--########################################################################--
--
@thanhleviet
thanhleviet / snakemake-pure-python.py
Created June 24, 2021 22:44 — forked from marcelm/snakemake-pure-python.py
pure Python module that uses snakemake to construct and run a workflow
#!/usr/bin/env python3
"""
Running this script is (intended to be) equivalent to running the following Snakefile:
include: "pipeline.conf" # Should be an empty file
shell.prefix("set -euo pipefail;")
rule all:
input:
@thanhleviet
thanhleviet / README.md
Created July 28, 2020 11:12 — forked from hkwi/README.md
libvirt + prometheus + grafana
@thanhleviet
thanhleviet / find.sh
Created July 10, 2020 10:32 — forked from gr1ev0us/find.sh
Cheatsheet for find linux
# List of cheatsheet for linux find.
# Taken from here http://alvinalexander.com/unix/edu/examples/find.shtml
# basic 'find file' commands
# --------------------------
find / -name foo.txt -type f -print # full command
find / -name foo.txt -type f # -print isn't necessary
find / -name foo.txt # don't have to specify "type==file"
find . -name foo.txt # search under the current dir
find . -name "foo.*" # wildcard
@thanhleviet
thanhleviet / bamfilter_oneliners.md
Created August 4, 2018 15:37 — forked from davfre/bamfilter_oneliners.md
SAM and BAM filtering oneliners
@thanhleviet
thanhleviet / wget-gdrive.sh
Created August 28, 2017 06:46 — forked from lvzongting/wget-gdrive.sh
download google drive file only with wget 仅通过wget 在bash命令行下载谷歌网盘(狗哥网盘)上的文件
#reference https://unix.stackexchange.com/questions/136371/how-to-download-a-folder-from-google-drive-using-terminal
#get cookie and code
wget --save-cookies cookies.txt --keep-session-cookies --no-check-certificate 'https://docs.google.com/uc?export=download&id=FILEID' -O- | sed -rn 's/.*confirm=([0-9A-Za-z_]+).*/Code: \1\n/p'
#download the file
wget --load-cookies cookies.txt 'https://docs.google.com/uc?export=download&confirm=CODE_FROM_ABOVE&id=FILEID'
@thanhleviet
thanhleviet / sam_to_consensus_fa.sh
Created May 22, 2017 23:44 — forked from bede/sam_to_consensus_fa.sh
Bioinformatics code golf: SAM to consensus FASTA
# SAM to consensus FASTA code golf, inspired by http://lab.loman.net/2015/07/28/calling-haploid-consensus-sequence/
# Starting with a SAM:
samtools view -bS seqs.sam | samtools sort - seqs # Generate and sort BAM
samtools index seqs.bam # Index BAM
# Starting with an indexed BAM:
samtools mpileup -ud 1000 -f seqs_ref.fasta seqs.bam | bcftools call -c | vcfutils.pl vcf2fq | seqtk seq -a - > seqs.consensus.fa # Generate pileup, call variants, convert to fq, convert to fa
# Who can do better? The bar is set low...
@thanhleviet
thanhleviet / had_crut_spider_plot.R
Created June 7, 2016 15:58 — forked from jebyrnes/had_crut_spider_plot.R
R code to reproduce the awesome visualization of global temperature change from Ed Hawkins at http://www.climate-lab-book.ac.uk/2016/spiralling-global-temperatures/ using R and ggplot2 (with the animations package)
library(dplyr)
library(tidyr)
library(ggplot2)
library(animation)
#Data from https://crudata.uea.ac.uk/cru/data/temperature/
#As well as data read in script
source("read_cru_hemi.R")
temp_dat <- read_cru_hemi("./HadCRUT4-gl.dat")
#remove cover
@thanhleviet
thanhleviet / server.py
Created April 11, 2016 03:15 — forked from peterkuma/server.py
A flask server for serving all JPEG images in a local directory and subdirectories. Uses unveil.js for lazy-loading of images. Thumbnails are created on the fly by PIL.
#!/bin/python
import os
from flask import Flask, Response, request, abort, render_template_string, send_from_directory
import Image
import StringIO
app = Flask(__name__)
WIDTH = 1000
@thanhleviet
thanhleviet / example_tool.py
Created March 8, 2016 04:47 — forked from kantale/example_tool.py
How to setup galaxy with TORQUE in Amazon's cloud
#!/usr/bin/python
import sys
'''
Just a simple tool that adds the line number at
the end of each line
'''
with open(sys.argv[1]) as f_in, open(sys.argv[2], 'w') as f_out: