Skip to content

Instantly share code, notes, and snippets.

View Swarchal's full-sized avatar

Scott Warchal Swarchal

View GitHub Profile
#! /bin/env python
def write_batch_scripts(template, placeholder, batch_file):
"""
converts a template qub submission script and a batch output file produced
by cellprofiler to multiple consecutively numbered submission scripts
arguments:
----------
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
#include <iostream>
#include <string>
using namespace std;
// convert DNA to RNA
int main()
{
string s;
// take DNA string as input from stdin
cin >> s;
char n; // current nucleotide
#include <Rcpp.h>
using namespace Rcpp;
// cosine distance between two vectors
double cosv(NumericVector a, NumericVector b)
{
double theta;
theta = sum(a * b) / sqrt(sum(pow(a, 2)) * sum(pow(b, 2)));
return theta;
#include <iostream>
#include <string>
using namespace std;
int main()
{
//define variable s as DNA string
string s;
// get input from stdin
@Swarchal
Swarchal / confusion_matrix.py
Last active July 24, 2017 14:28
confusion matrix
from sklearn.metrics import confusion_matrix
import numpy as np
cm = confusion_matrix(y_test, predictions)
# normalise confusion matrix for diff sized groups
cm_norm = cm.astype("float") / cm.sum(axis=1)[:, np.newaxis]
# plot confusion matrix
plt.figure(figsize=(8,6))
plt.imshow(cm_norm, interpolation='nearest', cmap=plt.cm.Blues)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Swarchal
Swarchal / partial_permutations.ipynb
Created May 6, 2016 12:40
partial permutations
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.