Skip to content

Instantly share code, notes, and snippets.

@sbamin
sbamin / how-to-gdc-client-install-rhel6.md
Created February 7, 2018 20:11
Install NCI gdc-client on RHEL 6 to download GDC data

gdc-client on RHEL/CentOS 6

Linux 2.6.32-431.23.3.el6.x86_64

## Using conda 4.3.33

## remove unstable conda env
conda env remove --name rvlabpy2
@ARTICLE{Bakas2020-ee,
title = "{iGLASS}: imaging integration into the Glioma Longitudinal
Analysis Consortium",
author = "Bakas, Spyridon and Ormond, David Ryan and Alfaro-Munoz, Kristin
D and Smits, Marion and Cooper, Lee Alex Donald and Verhaak, Roel
and Poisson, Laila M",
journal = "Neuro. Oncol.",
volume = 22,
number = 10,
@sbamin
sbamin / cytotable_0.0.1p2.def
Created September 20, 2023 18:53
cytotable apptainer def file - for debug only
Bootstrap: docker
From: python:3.10.11
Stage: build
%environment
export my_appimg="cytotable_0.0.1p2"
%labels
Maintainer sbamin
Image CytoTable
@sbamin
sbamin / config
Created May 5, 2023 17:29
Persistent SSH connection via SSH ControlMaster.
## add following to mac ~/.ssh/config file after required edits
## then do ssh mcclearybg to start background session, typically
## once per day. This will require duo push
## then you can start additional ssh by ssh mccleary (note: no suffix bg)
## More at https://docs.ycrc.yale.edu/clusters-at-yale/access/advanced-config/ and
## https://www.anchor.com.au/blog/2010/02/ssh-controlmaster-the-good-the-bad-the-ugly/
################## Yale ##################
# Uncomment the ForwardX11 options line to enable X11 Forwarding by default (no -Y necessary)
@sbamin
sbamin / 1_highlight.js
Last active May 3, 2023 21:05
ChatGPT way of highlighting text in a html page and extracting it in a text file. https://shareg.pt/dIVonZZ
javascript:(function(){
// via ChatGPT, https://shareg.pt/dIVonZZ
var highlights = [];
var style = document.createElement("style");
style.type = "text/css";
style.innerHTML = ".highlight { background-color: yellow !important; color: black !important; }";
document.getElementsByTagName("head")[0].appendChild(style);
document.addEventListener("mouseup", function() {
@sbamin
sbamin / run_sleep_mx
Last active April 28, 2023 19:00
toggle sleep mode for mac os ventura on M2 macbook, especially with unplugged power, monitors attached, and closed lid (closed diplay mode or clamshell).
#!/usr/bin/env bash
## Enable/Disable sleep on closed display
## strict mode on
set -euo pipefail
## can be one of status|on|off
cmd="${1:-"status"}"
@sbamin
sbamin / how-to-uniq-vs-multiple-mapped-reads-bwa-mem.md
Last active April 5, 2023 00:54
get uniquely mapped reads vs reads mapped at multiple sites from `bwa mem` bam

get uniq mapped reads from bwa mem bam

Getting uniquelly mapped reads requires familiarity with SAM format, alignment flags, interpreting alignment types and Phread-scaled MAPQ, etc. These are some of useful discussion posts to go through before extracting reads mapped uniquely or at multiple sites.

  1. Unique vs reads mapped at multiple sites: stackexchange forum and biostars #150063
  2. Explain alignment flags in SAM/BAM file from picard website and biostar #206396
  3. About mapping qualities from Dave Tang's blog
  4. About Phread-scale scores

The Phred quality score (Q) is logarithmically related to the error probability (E).GATK #4260

@sbamin
sbamin / chkcpumem
Created March 10, 2023 17:23
Check CPU and Memory usage for a given user
#!/usr/bin/env bash
## Check CPU and Memory Usage for an USER
## @sbamin
## https://superuser.com/a/920158/213756
## default to current user unless an user is specified as
## a first positional argument.
userid="${1:-"${USER}"}"
@sbamin
sbamin / sracmd
Last active December 5, 2022 15:35
Interact with NCBI SRA using aspera ascp command line client
#!/bin/bash
## Wrapper to interact with NCBI SRA using aspera ascp command line interface
## v 2.5 | 04/2017
## @sbamin
# More info: http://download.asperasoft.com/download/docs/ascp/2.7/html/
# usage
show_help() {
This gist I write, because I couldn't find step by step instructions
how to install and start postgresql locally and not globally in the
operating system (which would require sudo).
I hope, this will help especially people new to postgresql!
####################################
# create conda environment
####################################