Skip to content

Instantly share code, notes, and snippets.

Avatar

Toshiaki Katayama ktym

  • Database Center for Life Science
  • Japan
View GitHub Profile
@ktym
ktym / miriam-xml2csv.rb
Created Jan 24, 2012
MIRIAM XML to CSV
View miriam-xml2csv.rb
#!/usr/bin/env ruby
#
# Convert MIRIAM Registry XML file (http://www.ebi.ac.uk/miriam/main/export/) to CSV
# for browsing at TogoDB (http://semantic.togodb.dbcls.jp/togodb/view/miriam)
#
# Copyright (C) 2012 Toshiaki Katayama <k@bioruby.org>
#
# Pre requirements:
# % curl http://www.ebi.ac.uk/miriam/main/export/xml/ > resources_all.xml
# % gem install nokogiri
@ktym
ktym / taxid2name.rq
Created Aug 18, 2012
taxonomy id <-> scientific name
View taxid2name.rq
# http://beta.sparql.uniprot.org/
prefix up: <http://purl.uniprot.org/core/>
prefix tax: <http://purl.uniprot.org/taxonomy/>
select *
where {
tax:9606 up:scientificName ?name .
}
@ktym
ktym / sparql.rb
Last active Jun 30, 2016
SPARQL query interface
View sparql.rb
#!/usr/bin/env ruby
require "rubygems"
require "net/http"
require "uri"
require "cgi"
require "json" # gem install json
class SPARQL
@ktym
ktym / ft_so.json
Last active Oct 10, 2015
INSDC feature table to OBO sequence ontology mapping based on http://sequenceontology.org/resources/mapping/FT_SO.html
View ft_so.json
{
"-": {
"so_id": "SO:0000110",
"so_term": "located_sequence_feature",
"ft_desc": "\"-\" is a placeholder for no key; should be used when the need is merely to mark region in order to comment on it or to use it in another feature's location",
"so_desc": "A biological feature that can be attributed to a region of biological sequence."
},
"-10_signal": {
"so_id": "SO:0000175",
"so_term": "minus_10_signal",
@ktym
ktym / refseq2rdf.rb
Created Sep 12, 2012
Convert RefSeq genome entry into RDF/Turtle using FALDO (BH12)
View refseq2rdf.rb
#!/usr/bin/env ruby-1.9
require 'rubygems'
require 'bio'
require 'json'
require 'securerandom'
# [TODO] true to combine the result with the EdgeDB
if $DEBUG
$edgedb = true
@ktym
ktym / refseq2rdf_urn.rb
Created Oct 1, 2012
Convert RefSeq genome entry into RDF/Turtle using FALDO (BH12) and URN
View refseq2rdf_urn.rb
#!/usr/bin/env ruby-1.9
require 'rubygems'
require 'uri'
require 'bio'
require 'json'
require 'securerandom'
# [TODO] integrate this into BioRuby
module Bio
@ktym
ktym / PfCRT.ttl
Created Oct 1, 2012
Example of refseq2rdf_urn.rb (PfCRT gene in NC_004328.2)
View PfCRT.ttl
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
# SO:chromosome, SO:linear
<urn:uuid:63a091c1-1409-4a91-9f46-db9b04bce8f6>
<http://genome.db/sw/feature_chromosome> 7 ;
<http://genome.db/sw/feature_isolate> "3D7" ;
<http://genome.db/sw/length> 1501717 ;
<http://genome.db/sw/location> "1..1501717" ;
<http://genome.db/sw/molecularType> "genomic DNA" ;
<http://genome.db/sw/organism> "Plasmodium falciparum 3D7" ;
@ktym
ktym / biogitax.rb
Created Oct 1, 2012
Classify NCBI GI numbers into given clades (NCBI taxids)
View biogitax.rb
#!/usr/bin/env ruby-1.9
ENV["BIO_GITAX_DB"] = "#{ENV['HOME']}/ncbi/taxonomy/gitax"
require "rubygems"
require "open-uri"
require "fileutils"
begin
require "kyotocabinet"
@ktym
ktym / miriam_xml2rdf.rb
Created Oct 31, 2012
MIRIAM XML to RDF
View miriam_xml2rdf.rb
#!/usr/bin/env ruby
#
# Convert MIRIAM Registry XML file (http://www.ebi.ac.uk/miriam/main/export/) to RDF
#
# Copyright (C) 2012 Toshiaki Katayama <k@bioruby.org>
#
# Pre requirements:
# % curl http://www.ebi.ac.uk/miriam/main/export/xml/ > miriam.xml
# % gem install nokogiri
# % miriam_xml2rdf.rb miriam.xml > miriam.rdf
@ktym
ktym / rs_id.json
Last active Oct 13, 2015
RefSeq db_xref to Identifiers.org mapping
View rs_id.json
{
/*
* NCBI RefSeq
*/
"RefSeq": {
"label": "NCBI RefSeq", // custom
"class": "RefSeq",
"prefix": "http://identifiers.org/refseq/"
},
You can’t perform that action at this time.