This file contains 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 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 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 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 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 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
This gist implements a proof-of-concept web server to provide remote access to multiple BAMs. You can launch the server with:
go run hts-server.go -e /path/to/samtools bam-dir1 bam-dir2
and test it with:
curl -s http://127.0.0.1:8000/
The server regards bam-dir1
and bam-dir2
as study accessions. For a BAM file bam-dir1/myfile1.bam
, the file accession is myfile1
. It is required that every file has a unique file name across all input directories (i.e. even in two directories, two files must be named differently).