Skip to content

Instantly share code, notes, and snippets.

@helios
helios / trinity-pipeline-template.pbs
Last active Aug 29, 2015
The file is an example of the command lines used to run Trinity and PASA, at the time of the original work (“LincRNAs landscape in human lymphocytes highlights modulation of T cell differentiation by linc-MAF-4” by Ranzani V. et al.) Recently Trinity and PASA were updated, the current command lines and options can differ.
View trinity-pipeline-template.pbs
#!/bin/bash
# Copyright (C) 2015 INGM
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
View gist:302339
irb(main):136:0> mySubject=myGenSemWeb.first.first
=> <RDFS::Resource:0xb74abcb4 @predicates={}, @uri="http://bio2rdf.org/geneid:578147">
View gist:302340
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]"]
View gist:302336
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">]
View BioSparqlDraft.rb
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
View gist:777672
# 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
@helios
helios / gist:804318
Created Jan 31, 2011
Recover stats from genes list using targetscan filtered by miRNA 125b
View gist:804318
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
@helios
helios / gist:885723
Created Mar 24, 2011
Esempio per il riassunto dei dati da sequenziamento
View gist:885723
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
#----------
@helios
helios / gist:887127
Created Mar 25, 2011
BioRuby & Google Summer of Code 2011
View gist:887127
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.
@helios
helios / gist:905246
Created Apr 6, 2011
bioruby-ngs tophat task with sorting and indexing
View gist:905246
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")