Skip to content

Instantly share code, notes, and snippets.

@jctoledo
jctoledo / gist:5931241
Last active December 19, 2015 09:09
Build VOS 6.1.6 from source in Ubuntu 13.04
sudo apt-get install dpkg-dev build-essential gawk automake autoconf libtool bison flex gperf libssl-dev
@jctoledo
jctoledo / gist:5931267
Last active December 19, 2015 09:09
VOS 6.1.6 set compiler class before running ./configure
# for 64-bit
~ $ export CFLAGS="-O2 -m64"
# for 32-bit
~ $ export CFLAGS="-O2"
@jctoledo
jctoledo / gist:5937718
Created July 5, 2013 22:49
Adding VOS to your user's path
# open ~/.bashrc with your favourite text editor and add the following line at the end of the file
export PATH=$PATH:/usr/local/virtuoso-opensource/bin
@jctoledo
jctoledo / instances.tab
Last active December 19, 2015 10:09
Sample instances.tab file used by https://github.com/micheldumontier/php-lib/blob/master/apps/manager.php This is a tab delimited file where its columns are: isql port, http port and desired instance name
#this is a comment
#isql-port http-port name
12001 12002 myFirstEndpoint
12003 12004 mySecondEndpoint
@jctoledo
jctoledo / gist:5938249
Created July 6, 2013 01:35
Editing virtuoso.ini such that it can read files anywhere in your filesystem
#Modify line 66 of virtuoso.ini from
DirsAllowed = ., /usr/local/virtuoso-opensource/share/virtuoso/vad
#to the following
DirsAllowed = ., /usr/local/virtuoso-opensource/share/virtuoso/vad, /
@jctoledo
jctoledo / gist:6054161
Created July 22, 2013 14:18
Using Limit and offset in a SPARQL query with PHP
<?php
$myQuery = "select * where{?x ?y ?z}";
$result = getFromEndpoint(urlencode($myQuery), 10, 10);
if($result != null){
print_r($result);
}
@jctoledo
jctoledo / gist:6426686
Created September 3, 2013 17:09
PDB FTP RSYNC mirroring script
#!/bin/sh
############################################################################
#
# Script for mirroring PDB FTP archive using rsync
#
############################################################################
# This script is being provided to PDB users as a template for using rsync
# to mirror the FTP archive from an anonymous rsync server. You may want
@jctoledo
jctoledo / gist:6581779
Last active December 23, 2015 04:39
Get a list of FTP files given a path and an extension
<?php
$list = getFtpFileList('ftp.ebi.ac.uk','/pub/databases/chembl/ChEMBL-RDF/16.0/', 'ttl.gz');
$total = count($list);
print_r($list);
/**
* Given an FTP uri get a non recursive list of all files of a given extension
* located inside a given path
*/
@jctoledo
jctoledo / gist:6622850
Created September 19, 2013 12:40
Find details about a given ligand in a PDB structure using biopython
from Bio.PDB import *
import sys
p = PDBParser(PERMISSIVE=1)
ligand_id = "ADE"
radius = 5.4
pdbl = PDBList()
structure_id = "1Y26"
pdbl.retrieve_pdb_file(structure_id, pdir="/tmp")
filename = "1y26.pdb"
#see for more details: http://biopython.org/DIST/docs/tutorial/Tutorial.html#htoc153
<?php
function write_type_counts($fh, $type_counts){
GLOBAL $options;
GLOBAL $dataset_uri;
if($type_counts !== null){
foreach($type_counts as $type => $count){
#now create a resource for the class partition
$partition_res = "http://bio2rdf.org/dataset_resource:".md5($options['url']).md5($options['url'].$type.$count."type_count");
fwrite($fh, Quad($partition_res, "http://www.w3.org/1999/02/22-rdf-syntax-ns#type", "http://rdfs.org/ns/void#Dataset"));
fwrite($fh, Quad($partition_res, "http://rdfs.org/ns/void#class", $type));