Skip to content

Instantly share code, notes, and snippets.

View knmkr's full-sized avatar

Kensuke Numakura knmkr

  • Genomelink
  • SF Bay Area || Tokyo, Japan
View GitHub Profile
@knmkr
knmkr / README.md
Created September 28, 2020 08:06 — forked from nimezhu/README.md
A simple example using tabix C library in GO language.

A simple example to link tabix C library into GO language.

  1. download tabix C source code
  2. make dynamic libtabix.so.1 [ or make to get libtabix.a]
  3. cp libtabix.so.1 to your LD_LIBRARY_PATH [ or use the static version libtabix.a ]
  4. mv query_tabix_example.go query_tabix.go query_tabix_example_static.go into tabix directory which contains example.gtf.gz and example.gtf.gz.tbi and libtabix.a
  5. go run query_tabix_example.go [ or go run query_tabix_example_static.go ]
  6. go run query_tabix.go [file.bed] [file.gz]
  7. query_tabix_bed6.go are designed for query motifs and coordinates translate to query region.
@knmkr
knmkr / tabix-s3-example.md
Last active February 20, 2021 08:37
tabix s3 example

Tabix command of htslib can query a locus to a remote s3 file using s3:// protocol.

$ aws s3 ls s3://your_bucket/
vcf.gz
vcf.gz.tbi

$ tabix -l s3://your_bucket/vcf.gz
chr1
chr2
@knmkr
knmkr / github_flask_oauth2.py
Created September 28, 2017 20:33 — forked from ib-lundgren/github_flask_oauth2.py
Example of how to use Flask with requests-oauthlib to fetch a GitHub user profile using an OAuth 2 token.
from requests_oauthlib import OAuth2Session
from flask import Flask, request, redirect, session, url_for
from flask.json import jsonify
import os
app = Flask(__name__)
# This information is obtained upon registration of a new GitHub
client_id = "<your client key>"
@knmkr
knmkr / reports.md
Last active September 21, 2017 01:18
G-Supernova Hackathon 201706 | API Doc | reports

/reports

Endpoints

GET /v1-dev/reports/<phenotype_name>?population=<population>

param types key required description
path param phenotype_name TRUE
query param population TRUE currently only european is a valid value. other population is not available now.
@knmkr
knmkr / genomes.md
Last active September 21, 2017 01:18
G-Supernova Hackathon 201706 | API Doc | genomes

/genomes

Endpoints

GET /v1-dev/genomes/sequence/?<params>

Query params

params style description
@knmkr
knmkr / snsToSlack.js
Last active May 3, 2017 09:38 — forked from terranware/snsToSlack.js
AWS Lambda function to Slack Channel hookup
var https = require('https');
var util = require('util');
exports.handler = function(event, context) {
console.log(JSON.stringify(event, null, 2));
console.log('From SNS:', event.Records[0].Sns.Message);
var postData = {
"text": "*" + event.Records[0].Sns.Subject + "*",
};
@knmkr
knmkr / import.sh
Created March 24, 2017 07:24 — forked from martijnvermaat/import.sh
Mutalyzer transcript mapping imports
# NCBI36
wget ftp://ftp.ncbi.nlm.nih.gov/genomes/MapView/Homo_sapiens/sequence/BUILD.36.3/initial_release/seq_gene.md.gz -O - \
| zcat | sort -t $'\t' -k 11,11 -k 2,2 > /tmp/hg18.seq_gene.sorted.md
mutalyzer-admin assemblies import-mapview -a hg18 /tmp/hg18.seq_gene.sorted.md 'reference'
mutalyzer-admin assemblies import-reference -a hg18 'NC_001807.4'
# GRCh37
wget ftp://ftp.ncbi.nlm.nih.gov/genomes/MapView/Homo_sapiens/sequence/ANNOTATION_RELEASE.105/initial_release/seq_gene.md.gz -O - \
| zcat | sort -t $'\t' -k 11,11 -k 2,2 > /tmp/hg19.seq_gene.sorted.md
mutalyzer-admin assemblies import-mapview -a hg19 /tmp/hg19.seq_gene.sorted.md 'GRCh37.p13-Primary Assembly'
@knmkr
knmkr / README.md
Created December 24, 2016 09:51 — forked from stephenash/README.md
Django on ElasticBeanstalk - HTTP to HTTPS redirects

I needed a way to have my Django ElasticBeanstalk application automatically redirect HTTP requrests to HTTPS. Rick Christianson wrote a post [1] about how to do this by overwriting the wsgi.conf file with one that was slightly modified to support the HTTP to HTTPS redirect.

Building off the shoulders of giants, I wanted to do the same, but not have to keep a copy of the config file in my local source directory. Christianson even points out in his post that if ElasticBeanstalk ever changes it's template for the wsgi.conf file, those updates would not be overwritten and you wouldn't get their benefits. To get around that problem, I used sed to insert the new lines into the wsgi.conf file.

References

  1. http://rickchristianson.wordpress.com/2013/11/02/updating-wsgi-automatically-in-amazon-aws/
  2. http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/customize-containers-ec2.html#customize-containers-format-container_commands
@knmkr
knmkr / send_mail.py
Created November 1, 2016 07:30
Send mail via gmail
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import argparse
import smtplib
FROM = 'myserveradmin@gmail.com'
def _main():
parser = argparse.ArgumentParser(description='')
@knmkr
knmkr / bash_logging.sh
Created October 4, 2016 02:21
bash logging
#!/usr/bin/env bash
# https://raw.githubusercontent.com/andsens/homeshick/master/lib/log.sh
# https://raw.githubusercontent.com/andsens/homeshick/master/lib/exit_status.sh
source "lib/exit_status.sh"
source "lib/log.sh"
info 'foo' 'bar'
warn 'foo' 'bar'