Skip to content

Instantly share code, notes, and snippets.

View alienzj's full-sized avatar
🦀
MAGs lives matter

Jie Zhu alienzj

🦀
MAGs lives matter
View GitHub Profile
pigz -d -c in.fastq.gz |
| awk 'BEGIN {LN=0; } { if (LN == 1 || LN == 3) { print substr($0, 0, 26) } else { print $0 } ; if (LN == 3) { LN = 0 } else { LN++ } }' \
| pigz -c - > out.fastq.gz
@alienzj
alienzj / basicOncoPrint.R
Created February 5, 2020 03:49 — forked from armish/basicOncoPrint.R
A simple R script to visualize OncoPrints out of an alteration matrix
# This function sorts the matrix for better visualization of mutual exclusivity across genes
memoSort <- function(M) {
geneOrder <- sort(rowSums(M), decreasing=TRUE, index.return=TRUE)$ix;
scoreCol <- function(x) {
score <- 0;
for(i in 1:length(x)) {
if(x[i]) {
score <- score + 2^(length(x)-i);
}
}
@alienzj
alienzj / combiner.py
Created October 22, 2019 15:08 — forked from SJShaw/combiner.py
Combine antiSMASH 5 result JSON files
#!/usr/bin/env python3
import json
import sys
def merge(inputs):
""" Merges the data in the given input handles and returns the result """
assert len(inputs) > 1
record_ids = set()
@alienzj
alienzj / sge_status.md
Created April 29, 2019 02:42 — forked from cmaureir/sge_status.md
Sun Grid Engine SGE state letter symbol codes meanings
@alienzj
alienzj / snakemake-pure-python.py
Created March 29, 2019 08:55 — 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:
@alienzj
alienzj / hi.rb
Last active January 19, 2019 00:44
a sinatra app
require 'sinatra'
get '/hi' do
"Hello World!"
end
@alienzj
alienzj / makepkg_overview.rst
Created January 17, 2019 02:02 — forked from Earnestly/makepkg_overview.rst
A brief overview of the process involved in creating a pacman package.

A Brief Tour of the Makepkg Process: What Makes a Pacman Package

Introduction

This is a terse document covering the anatomy of a package built for the pacman package manager.

The following example commands can mostly run verbatim to manually create a

@alienzj
alienzj / README.md
Created December 25, 2018 14:34 — forked from joyrexus/README.md
Perl one-liners

Hi:

perl -e 'print "hello world!\n"'

A simple filter:

perl -ne 'print if /REGEX/'

Filter out blank lines (in place):

@alienzj
alienzj / spacemacs-cheshe.md
Created December 21, 2018 07:28 — forked from robphoenix/spacemacs-cheshe.md
Spacemacs Cheat Sheet

Useful Spacemacs commands

  • SPC q q - quit
  • SPC w / - split window vertically
  • SPC w - - split window horizontally
  • SPC 1 - switch to window 1
  • SPC 2 - switch to window 2
  • SPC w c - delete current window
  • SPC TAB - switch to previous buffer
  • SPC b b - switch buffers
#pragma once
#include <boost/noncopyable.hpp>
#include <boost/beast/websocket.hpp>
#include <boost/beast/websocket/ssl.hpp>
struct websocket_stream : boost::noncopyable