Skip to content

Instantly share code, notes, and snippets.

View suragnair's full-sized avatar

Surag Nair suragnair

View GitHub Profile
@ctokheim
ctokheim / UCSCTrackHub.md
Last active April 21, 2022 22:09
UCSC Genome Browser Track Hub

Overview

UCSC's track hubs allow multiple wig files to be displayed in a single custom track. Thus possibly overlaying multiple types of data or displaying strand specific read depth. Individual sub-tracks within a custom track can then be toggled on/off.

Getting Started

The official documentation of UCSC's track hubs can be found at http://genome.ucsc.edu/goldenPath/help/hgTrackHubHelp.html.

@fsteffenhagen
fsteffenhagen / sum_filesize.sh
Last active October 31, 2024 17:27
sum human readable file sizes with numfmt and awk
# Input: list of rows with format: "<filesize> filename", e.g.
# filesizes.txt
#######################
# 1000K file1.txt
# 200M file2.txt
# 2G file3.txt
#
# Output:
cat filesizes.txt | numfmt --from=iec | awk 'BEGIN {sum=0} {sum=sum+$1} END {printf "%.0f\n", sum}'
@aesuli
aesuli / csr_to_pytorch_sparse.py
Last active November 3, 2022 03:06
csr matrix to pytorch sparse
import numpy as np
from scipy.sparse import csr_matrix
import torch
__author__ = 'Andrea Esuli'
Acsr = csr_matrix([[1, 2, 0], [0, 0, 3], [4, 0, 5]])
print('Acsr',Acsr)
Acoo = Acsr.tocoo()
@loganbvh
loganbvh / zenodo_upload_progress.py
Last active November 10, 2024 02:15
Zenodo Python upload with progress bar
import os
import requests # pip install requests
from tqdm import tqdm # pip install tqdm
from tqdm.utils import CallbackIOWrapper
# See: https://gist.github.com/slint/92e4d38eb49dd177f46b02e1fe9761e1
# See: https://gist.github.com/tyhoff/b757e6af83c1fd2b7b83057adf02c139
def get_bucket_url(deposit_id: str, access_token: str) -> str: