Skip to content

Instantly share code, notes, and snippets.

View zhangj5's full-sized avatar

Jinsong Zhang zhangj5

View GitHub Profile
@zhangj5
zhangj5 / upload.php
Created March 22, 2018 18:59 — forked from taterbase/upload.php
Simple file upload in php
<!DOCTYPE html>
<html>
<head>
<title>Upload your files</title>
</head>
<body>
<form enctype="multipart/form-data" action="upload.php" method="POST">
<p>Upload your file</p>
<input type="file" name="uploaded_file"></input><br />
<input type="submit" value="Upload"></input>
@zhangj5
zhangj5 / VarScan2_format_converter.py
Created November 24, 2017 17:09 — forked from PoisonAlien/VarScan2_format_converter.py
Takes output file generated by VarScan2 somatic programme and converts the formats.
__author__ = "Anand M"
'''
Takes output file generated by VarScan2 somatic programme and converts the formats.
'''
import argparse, math, re
parser = argparse.ArgumentParser(
description="Converts VarScan2 somatic vcf to native format and vice-versa.\nInput is automatically detected")
@zhangj5
zhangj5 / rna_seq_variant_pipeline.sh
Created November 14, 2017 21:27 — forked from PoisonAlien/rna_seq_variant_pipeline.sh
RNA seq Variant calling pipeline according to gatk best practices
#!/bin/bash
#
# AUTHOR: Anand M.
# RNA-Seq variant calling pieline accoring to GATK Best practices.
# https://www.broadinstitute.org/gatk/guide/article?id=3891
#
# Call with following arguments
# bash rna_seq_variant_pipeline.sh <Input_Reads1.fq.gz> <Input_Reads2.fq.gz> <output_basename>
#
# Assumes STAR aligner is under path
@zhangj5
zhangj5 / gist:971fdc9b274c5249915df598b5e73aef
Created July 16, 2017 02:54 — forked from brandonwillard/gist:dab0b21099ea88ad3545
glmnet work-around for a single column design matrix
local({
myglmnet = function(x, y, family = c("gaussian", "binomial", "poisson", "multinomial", "cox", "mgaussian"), weights, offset = NULL, alpha = 1, nlambda = 100, lambda.min.ratio = ifelse(nobs < nvars, 0.01, 1e-04), lambda = NULL, standardize = TRUE, intercept = TRUE, thresh = 1e-07, dfmax = nvars + 1, pmax = min(dfmax * 2 + 20, nvars), exclude, penalty.factor = rep(1, nvars), lower.limits = -Inf, upper.limits = Inf, maxit = 1e+05, type.gaussian = ifelse(nvars < 500, "covariance", "naive"), type.logistic = c("Newton", "modified.Newton"), standardize.response = FALSE, type.multinomial = c("ungrouped", "grouped")) {
family = match.arg(family)
if (alpha > 1) {
warning("alpha >1; set to 1")
alpha = 1
}
if (alpha < 0) {
warning("alpha<0; set to 0")
@zhangj5
zhangj5 / random_region.R
Created April 22, 2017 16:52 — forked from davetang/random_region.R
Sampling random regions of the hg19 genome and obtaining the corresponding sequence
#how many regions to sample?
number <- 50000
#how many bp to add to start
span <- 4
#some necessary packages
#install if necessary
source("http://bioconductor.org/biocLite.R")
biocLite("BSgenome")
@zhangj5
zhangj5 / graph_101.cpp
Created October 31, 2016 22:37 — forked from abrarShariar/graph_101.cpp
Graph implementation using C++
/*
Graph implementation following tutorial http://www.geeksforgeeks.org/graph-and-its-representations/
*/
#include<iostream>
#include<cstdlib>
using namespace std;
//struct for an adjacency list node
struct AdjListNode{
int data;
stat_smooth_func <- function(mapping = NULL, data = NULL,
geom = "smooth", position = "identity",
...,
method = "auto",
formula = y ~ x,
se = TRUE,
n = 80,
span = 0.75,
fullrange = FALSE,
level = 0.95,