Skip to content

Instantly share code, notes, and snippets.

View mnowotka's full-sized avatar

Michał Nowotka mnowotka

  • Bolt
  • Warsaw, PL
View GitHub Profile
public static void main(String[] args){
JokeSource source = new APIJokeSource();
JokeHistory history_provider = new FileHistoryProvider();
Set<JokeId> history = history_provider.load()
List<NorrisJoke> unique_jokes = new ArrayList<>();
while(unique_jokes.size() < 10){
List<NorrisJoke> jokes = source.getJokes(10);
for(joke: jokes){
[
[
"positive",
[
{
"_index": "ygo-search-20180403",
"_type": "entity",
"_id": "us_ba408765-a904-11e1-9412-005056900141",
Hello world
Hello world
#!/bin/bash
# This script will read a CSV file containing a list of compunds
# indentified by their chembl ids. For each compound it will download
# its image and save it to the output folder.
# Some constants first: we need to know the root URL of the ChEMBL API.
# We will also use a tool called "resty" and we first need to download it
# from the Internet so we need to know its adress.
DEFAULT_INPUT=${1-"./compounds_list.csv"}
#!/usr/bin/env RScript
# This scripts reads a list of compounds, identified by their chembl ids from a CSV file
# given as an input. For each compound it find related targets, optionally filtered by
# organism. It saves a mepping between the compound and targets in the output CSV file.
# First, we import useful libaries. We need a library to parse JSON and another one to
# make HTTP requests.
library(jsonlite)
library(httr)
#!/bin/bash
# This script will get a list of targets related to a compound.
# Each compound, identified by its chembl id will be read from
# the CSV file specified as the first argument.
# This script assumes that you have a 'jq' command line tool installed.
# Installation instructions can be found here:
# https://stedolan.github.io/jq/download/
# This scripts reads a list of compounds, identified by their chembl ids from a CSV file
# given as an input. For each compound it find related targets, optionally filtered by
# organism. It saves a mepping between the compound and targets in the output CSV file.
# import libraries for reading csv files, parsing command line arguments
# and the python client library
import csv
import argparse
from chembl_webresource_client.new_client import new_client
import csv
from chembl_webresource_client.new_client import new_client
# This will be our resulting structure mapping compound ChEMBL IDs into target uniprot IDs
compounds2targets = dict()
# First, let's just parse the csv file to extract compounds ChEMBL IDs:
with open('compounds_list.csv', 'rb') as csvfile:
reader = csv.reader(csvfile)
for row in reader:
import csv
from chembl_webresource_client.new_client import new_client
# This will be our resulting structure mapping compound ChEMBL IDs into target uniprot IDs
compounds2targets = dict()
# First, let's just parse the csv file to extract compounds ChEMBL IDs:
with open('compounds_list.csv', 'rb') as csvfile:
reader = csv.reader(csvfile)
for row in reader: