Skip to content

Instantly share code, notes, and snippets.

View taoliu's full-sized avatar
🌎
Working from the earth

Tao Liu (τν) taoliu

🌎
Working from the earth
View GitHub Profile
@taoliu
taoliu / merge_then_call_consensus.sh
Last active November 10, 2025 13:53
Merge multiple peak files (BED format) then call the consensus regions
#!/bin/bash
#
# This script will find the consensus peak regions from peak files (in
# BED format) of multiple samples by:
#
# 1. Converting the peak file of each sample into non-overlapping 3
# cols BED file and concatenating them;
#
# 2. Sorting the concatenated file and Building a genome coverage
# track in BedGraph, of which the value (the 3rd col) indicates the
@taoliu
taoliu / KNNsmoothing.R
Created November 11, 2020 21:57
kNN smoothing on a given feature x barcode matrix, based on a given sNN graph barcode x barcode matrix
# K-nearest neighbor smoothing based on sNN from clustering
# Inspired by knn-smooth.R: https://github.com/yanailab/knn-smoothing/blob/master/knn_smooth.R
# by Tao Liu <vladimir.liu@gmail.com>
#' kNN-smoothing on a given matrix based on a pre-calculated sNN matrix
#'
#' Note: sparse matrix will be converted to regular matrix, so memory
#' usage will be high.
#'
#' @param M A numeric matrix that will be smoothed. It should have
@taoliu
taoliu / wrapToSlurm
Last active December 30, 2021 19:10
Wrapper for submitting jobs to SLURM
#!/usr/bin/env python
# This script is a wrapper in Python to help submit jobs, that need to use CONDA environment, to SLURM.
import subprocess
import sys
import os
import time
import argparse as ap