This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Split a multi fasta file into single fasta files (1.fasta, 2.fasta, ...) | |
# > ruby a.rb multi.fasta | |
require 'rubygems' | |
gem 'bio' | |
Bio::FlatFile.auto($<).each_with_index do |entry, i| | |
File.open("#{i+1}.fasta", "w") do |f| | |
f.puts entry.to_s | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
files = ["chembl_16_biocmpt.ttl", "chembl_16_target.ttl", "chembl_16_targetcmpt.ttl"] | |
def iotax(arg) | |
"<http://identifiers.org/taxonomy/#{arg}>" | |
end | |
def ncbitax(arg) | |
"<http://www.ncbi.nlm.nih.gov/Taxonomy/Browser/wwwtax.cgi?mode=Info&id=#{arg}>" | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#> | |
PREFIX skos:<http://www.w3.org/2004/02/skos/core#> | |
PREFIX owl:<http://www.w3.org/2002/07/owl#> | |
PREFIX bibo:<http://purl.org/ontology/bibo/> | |
PREFIX dc:<http://purl.org/dc/terms/> | |
PREFIX xsd:<http://www.w3.org/2001/XMLSchema#> | |
PREFIX up:<http://purl.uniprot.org/core/> | |
PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#> | |
Select ?protein ?geneLabel ?dMnemonic ?disease ?omim |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#> | |
PREFIX skos:<http://www.w3.org/2004/02/skos/core#> | |
PREFIX owl:<http://www.w3.org/2002/07/owl#> | |
PREFIX bibo:<http://purl.org/ontology/bibo/> | |
PREFIX dc:<http://purl.org/dc/terms/> | |
PREFIX xsd:<http://www.w3.org/2001/XMLSchema#> | |
PREFIX up:<http://purl.uniprot.org/core/> | |
PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#> | |
SELECT ?protein ?geneLabel ?hgsv ?omim ?citation |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'rdf' | |
require 'rest_client' | |
require 'json' | |
task "probeset.js" do | |
endpoint = "http://open-biomed.org:8890/sparql" | |
query = "SELECT * WHERE { GRAPH <http://open-biomed.org:8890/DAV/BH11Ujicha/HG-U133A.na31.annot> { ?subject ?predicate ?object } }" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'rdf' # gem install rdf | |
require 'rest_client' # gem install rest-client | |
require 'json' # gem install json | |
endpoint = "http://open-biomed.org:8890/sparql" | |
query = "SELECT * WHERE { <http://bio2rdf.org/affymetrix:1007_s_at> ?predicate ?object }" | |
# XML, "application/sparql-results+xml" ; CSV, "text/csv" | |
response = RestClient.post endpoint, :query => query, :format => "application/sparql-results+json" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://twitter.com/#!/pjacock/status/74029124242505728 | |
# https://twitter.com/#!/32nm/status/74070121219497984 | |
require 'rubygems' | |
require 'open-uri' | |
require 'nokogiri' | |
url = "http://togetter.com/li/140056" | |
doc = Nokogiri::HTML(open(url).read) | |
puts doc.xpath("//div[@class='status']/a").map {|x| x.attribute("href").value } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'bio' | |
class Bio::Sequence::NA | |
def self.compute_melting_temperature(nastr) | |
10 # code here ... | |
end | |
def melting_temperature | |
if @melting_temperature | |
@melting_temperature |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ruby tkana.rb http://twitter.com/synobu/status/20976018979 | |
require 'rubygems' | |
require 'nokogiri' | |
require 'open-uri' | |
require 'htmlentities' | |
url = ARGV[0] | |
doc = Nokogiri::XML.parse(open(url).read) | |
t = (doc/"span.entry-content").to_s.gsub(/<.+?>/,'') |