Skip to content

Instantly share code, notes, and snippets.

View sgsfak's full-sized avatar
🦖

Stelios Sfakianakis sgsfak

🦖
  • Heraklion Greece
  • 06:05 (UTC +03:00)
  • LinkedIn in/sgsfak
View GitHub Profile
'''
Non-parametric computation of entropy and mutual-information
Adapted by G Varoquaux for code created by R Brette, itself
from several papers (see in the code).
These computations rely on nearest-neighbor statistics
'''
import numpy as np
/* curl_multi_test.c
Clemens Gruber, 2013
<clemens.gruber@pqgruber.com>
Code description:
Requests 4 Web pages via the CURL multi interface
and checks if the HTTP status code is 200.
Update: Fixed! The check for !numfds was the problem.
@sgsfak
sgsfak / Drugbank parse to DB
Last active December 23, 2018 08:11
Parse DrugBank XML file with xmlstarlet
We couldn’t find that file to show.
## gb_gpl17000.csv contains the Genbank ids of the cDNA EST transcripts, downloaded from
## http://www.ncbi.nlm.nih.gov/geo/query/acc.cgi?acc=GPL17000
## (the GB_ACC column)
## So for each of these accession numbers we download the corresponding page from NCBI (EST database)
## and search (grep) for the Entrez Gene id
cat gb_gpl17000.csv |
parallel -j4 --tagstring '{}' "curl -s http://www.ncbi.nlm.nih.gov/nucest/{} | fgrep '/sites/entrez?db=gene&amp;cmd=retrieve&amp;list_uids='" |
gawk '{print $1, gensub(/^.*list_uids=([0-9]+).*$/, "\\1", "g", $3)}' |
tee gb_gpl17000_eg_map.txt
@sgsfak
sgsfak / download_parse_unigene.sh
Created December 8, 2015 14:17
Downloads the UniGene data from NCBI, parses them with awk to get the information about the UniGene cluster, the gene symbol and Entrez Gene identifier, and the Genbank sequences
#!/bin/sh
wget ftp://ftp.ncbi.nih.gov/repository/UniGene/Homo_sapiens/Hs.data.gz
gunzip Hs.data.gz
<Hs.data awk -v OFS=',' 'BEGIN { print "unigene_id", "gene_id", "symbol", "gb_acc"}
/^ID /{ug=$2}
/^GENE_ID /{eg=$2}
/^GENE /{s=$2}
/^SEQUENCE /{
curl -d number=ND582501129GR https://www.elta-courier.gr/track.php | jq '.result|to_entries[].value.result'
@sgsfak
sgsfak / FilesWalkObservable.java
Last active October 1, 2016 21:50
Create an Observable that returns (recursively) all the entries below a given directory
import rx.Observable;
import rx.Observer;
import rx.observables.SyncOnSubscribe;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Iterator;
import java.util.stream.Stream;
@sgsfak
sgsfak / eventsource.js
Created October 18, 2016 07:11 — forked from mattpodwysocki/eventsource.js
Adding support for server-sent events for RxJS
if (!!root.EventSource) {
/**
* This method wraps an EventSource as an observable sequence.
* @param {String} url The url of the server-side script.
* @param {Observer} [openObserver] An optional observer for the 'open' event for the server side event.
* @returns {Observable} An observable sequence which represents the data from a server-side event.
*/
dom.fromEventSource = function (url, openObserver) {
return new AnonymousObservable(function (observer) {
@sgsfak
sgsfak / appserver.nginx.conf
Created May 1, 2017 06:15
Basic Nginx Gateway / App setup. DO NOT SIMPLY COPY PASTE WITHOUT UNDERSTANDING THE CONTENTS.
server {
# Listen on internal ports only. Do not expose this server directly.
listen 127.0.0.1:80;
listen 10.0.0.1:80; # Secure internal IP
# Hosts
server_name www.wieni.be;
# Root
@sgsfak
sgsfak / Install graph_tool with Anaconda.md
Last active September 11, 2017 14:18
Install graph_tool with Anaconda