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 'active_rdf' | |
class Bio | |
class SPARQL | |
def initialize(params ={}) | |
@adapter=ConnectionPool.add(:type => :sparql, :url => 'http://geneid.bio2rdf.org/sparql', :engine => :virtuoso) | |
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
irb(main):137:0>mySubject.property_accessors | |
=> ["type", "label", "title", "comment", "identifier", "url", "created", "modified", "replaced", "isReplacedBy", "seeAlso", "symbol", "subType", "location", "chromosome", "fromInterval", "toInterval", "xGI", "xGenBank", "xProteinID", "xTaxon", "xRef", "xEC", "synonym"] | |
irb(main):141:0> mySubject.xGI | |
=> [<RDFS::Resource:0xb7434650 @predicates={}, @uri="http://bio2rdf.org/gi:72015298">, <RDFS::Resource:0xb74345d8 @predicates={}, @uri="http://bio2rdf.org/gi:72015290">, <RDFS::Resource:0xb7434538 @predicates={}, @uri="http://bio2rdf.org/gi:72015291">] | |
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
irb(main):136:0> mySubject=myGenSemWeb.first.first | |
=> <RDFS::Resource:0xb74abcb4 @predicates={}, @uri="http://bio2rdf.org/geneid:578147"> | |
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
irb(main):134:0> myGenSemWeb.fisrt | |
=> [<RDFS::Resource:0xb74abcb4 @predicates={}, @uri="http://bio2rdf.org/geneid:578147">, <RDFS::Resource:0xb74abc50 @predicates={}, @uri="http://www.w3.org/2000/01/rdf-schema#label">, "similar to TP53 regulating kinase (p53-related protein kinase) (Nori-2)[geneid:578147]"] | |
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
# Recode a vector based on a block | |
class Pippo | |
def recode!(vector_name) | |
0.upto(@cases-1) {|i| | |
@vectors[vector_name].data[i]=yield case_as_hash(i) | |
} | |
@vectors[vector_name].set_valid_data | |
end | |
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
def gene_list(genes_str) | |
genes_str.split("\n").select{|gene| !(gene.empty? || gene.match(/LOC/))} | |
end | |
def targetted_genes(genes_ary) | |
Bio::Kb::Targetscan::Prediction.where(['gene_symbol IN (?) and species = 9606', genes_ary]).select("distinct gene_symbol").count | |
end | |
def targetted_125b(genes_ary) | |
Bio::Kb::Targetscan::Prediction.search(genes_ary,'hsa-miR-125b').count |
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 'yaml' | |
stats=YAML::load_stream(File.open("CD4_Th1_forward.stats")) | |
ary_stats=stats.documents | |
sum=0 | |
ary_stats.each do |record| | |
sum += record[:stats] [: reads_total] | |
end | |
#in sum troverai il risultato | |
#---------- |
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
Dear All, | |
our project, is looking for students to participate at GSoC 2011, thanks to OBF and NESCENT | |
Please feel free to forward this message to your university-ml, lab or local ruby group. | |
Use our ml to discuss ideas and feel free to contact the mentors or any other member for the development team. | |
March 18-27: Would-be student participants discuss application ideas with mentoring organizations. | |
March 28: Student application period opens. | |
April 8 19:00 UTC Student application deadline. |
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
desc "tophat DIST INDEX OUTPUTDIR FASTQS", "run tophat as from command line, default 6 processors and then create a sorted bam indexed." | |
method_option :paired, :type => :boolean, :default => false, :desc => 'Are reads paired? If you chose this option pass just the basename of the file without forward/reverse and .fastq' | |
Bio::Ngs::Tophat.new.thor_task(self, :tophat) do |wrapper, task, dist, index, outputdir, fastqs| | |
wrapper.params = task.options #merge passed options to the wrapper. | |
wrapper.params = {"mate-inner-dist"=>dist, "output-dir"=>outputdir, "num-threads"=>6, "solexa1.3-quals"=>true} | |
fastq_files = task.options[:paired] ? ["#{fastqs}_forward.fastq","#{fastqs}_reverse.fastq"] : ["#{fastqs}"] | |
wrapper.run :arguments=>[index, fastq_files ].flatten, :separator=>"=" | |
accepted_hits_bam_fn = File.join(outputdir, "accepted_hit.bam") |
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
# @abstract Merge multiple sorted BAM. | |
# @param is_by_qname whether to sort by query name | |
# @param out output BAM file name | |
# @param headers name of SAM file from which to copy '@' header lines, | |
# or NULL to copy them from the first file to be merged | |
# @param n number of files to be merged | |
# @param fn names of files to be merged | |
# | |
# @discussion Padding information may NOT correctly maintained. This | |
# function is NOT thread safe. |
OlderNewer