This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <unistd.h> | |
#include <assert.h> | |
#include <stdlib.h> | |
#include <stdio.h> | |
#include "kstring.h" | |
#include "sam.h" | |
#include "kbtree.h" | |
typedef struct { | |
int pos, n, sum; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stddef.h> | |
#include <stdio.h> | |
#include <string.h> | |
#include "getopt.h" | |
char *optarg; | |
int optind=1, opterr=1, optopt, __optpos, optreset=0; | |
#define optpos __optpos |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
use strict; | |
use warnings; | |
use Getopt::Std; | |
my %opts = (); | |
getopts('fd:', \%opts); | |
die("Usage: pexe.pl [options] <exe1> [exe2 [...]] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# OUTSIDE VM: launch an instance | |
gcloud compute instances create lh3test --machine-type n1-standard-1 --image-project ubuntu-os-cloud --image-family ubuntu-1604-lts | |
# | |
# INSIDE VM!!! | |
# | |
# install dependencies | |
sudo apt-get update | |
sudo apt-get install libboost-all-dev cmake libstdc++6 clang-3.8 cmake git-all python3 zlib1g-dev |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
use strict; | |
use warnings; | |
use Getopt::Std; | |
my %opts = (t=>'ct', m=>50); | |
getopts('t:m:3', \%opts); | |
my $type; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var getopt = function(args, ostr) { | |
var oli; // option letter list index | |
if (typeof(getopt.place) == 'undefined') | |
getopt.ind = 0, getopt.arg = null, getopt.place = -1; | |
if (getopt.place == -1) { // update scanning pointer | |
if (getopt.ind >= args.length || args[getopt.ind].charAt(getopt.place = 0) != '-') { | |
getopt.place = -1; | |
return null; | |
} | |
if (getopt.place + 1 < args[getopt.ind].length && args[getopt.ind].charAt(++getopt.place) == '-') { // found "--" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
use strict; | |
use warnings; | |
use Getopt::Std; | |
my %opts = (g=>37, l=>2, L=>100); | |
getopts('g:l:L:o:Huc', \%opts); | |
# check path |
Source | Dst. file type | Protocol | Time (s) | Command Line |
---|---|---|---|---|
NCBI | .sra | ftp | 296 | wget |
NCBI | .fastq.gz | sra toolkit | ~23000 | fastq-dump -Z --gzip --split-spot |
local file | sra=>fastq.gz | sra toolkit | ~15000 | fastq-dump --gzip --split-spot --split-3 |
EBI | .fastq.gz | aspera | 513+492 | aspera -QT -l 300m |
EBI | .fastq.gz | ftp | 1876+1946 | wget |
Notes:
This gist demonstrates fast BAM slicing without re-compressing the alignment data. It only works for BAMs generated by samtools-0.1.8+ and htslib, as it requires the BAM to be block aligned.
To use this gist, you need to first acquire and compile htslib. After that:
cd htslib; gcc -g -O2 -Wall -o fsi -I. /path/to/fsi.c libhts.a -lz
./fsi aln.bam > aln.fsi
perl fsi-get.pl aln.bam aln.fsi chr11:1000000-1200000 > slice.bam