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
@alienzj
alienzj / extract_fastq_bam.md
Created April 28, 2018 10:03 — forked from darencard/extract_fastq_bam.md
Extract paired FASTQ reads from a BAM mapping file

Extracting paired FASTQ read data from a BAM mapping file

Sometimes FASTQ data is aligned to a reference and stored as a BAM file, instead of the normal FASTQ read files. This is okay, because it is possible to recreate raw FASTQ files based on the BAM file. The following outlines this process. The useful software samtools and bedtools are both required.

From each bam, we need to extract:

  1. reads that mapped properly as pairs
  2. reads that didn’t map properly as pairs (both didn’t map, or one didn’t map)

For #1, the following command will work. This was taken from this webpage.

@alienzj
alienzj / custom_iterator.cpp
Created April 29, 2018 08:45 — forked from jeetsukumaran/custom_iterator.cpp
Sample C++/STL custom iterator
// Sample custom iterator.
// By perfectly.insane (http://www.dreamincode.net/forums/index.php?showuser=76558)
// From: http://www.dreamincode.net/forums/index.php?showtopic=58468
#include <iostream>
#include <vector>
#include <algorithm>
#include <iterator>
#include <cassert>
@alienzj
alienzj / memusg
Created June 19, 2018 10:00 — forked from netj/memusg
memusg -- Measure memory usage of processes
#!/usr/bin/env bash
# memusg -- Measure memory usage of processes
# Usage: memusg COMMAND [ARGS]...
#
# Author: Jaeho Shin <netj@sparcs.org>
# Created: 2010-08-16
############################################################################
# Copyright 2010 Jaeho Shin. #
# #
# Licensed under the Apache License, Version 2.0 (the "License"); #
#pragma once
#include <boost/noncopyable.hpp>
#include <boost/beast/websocket.hpp>
#include <boost/beast/websocket/ssl.hpp>
struct websocket_stream : boost::noncopyable
@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
@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 / 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 / hi.rb
Last active January 19, 2019 00:44
a sinatra app
require 'sinatra'
get '/hi' do
"Hello World!"
end
@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 / sge_status.md
Created April 29, 2019 02:42 — forked from cmaureir/sge_status.md
Sun Grid Engine SGE state letter symbol codes meanings