Skip to content

Instantly share code, notes, and snippets.

@helios

helios/gist:1315778

Created Oct 26, 2011
Embed
What would you like to do?
CuffDiff output iterator, preliminar example
#CLASS DEFINITION Bio::Ngs::Cufflinks
class Diff
include Bio::Command::Wrapper
include Bio::Ngs::Cufflinks::Diff::Utils
set_program Bio::Ngs::Utils.binary("cuffdiff")
add_option "output-dir", :type => :string, :aliases => '-o', :default => "./"
add_option "time-series", :type => :boolean, :aliases => '-T'
add_option "min-alignment-count", :type => :numeric, :aliases => '-c'
add_option "FDR", :type => :numeric, :aliases => '-F'
#TODO:FIX add_option "mask-file", :type => :string, :aliases => '-M'
#TODO:FIX add_option "frag-bias-correct", :type =>
add_option "multi-read-correct", :type => :boolean, :aliases => '-u'
add_option "upper-quartile-norm", :type => :boolean, :aliases => 'N'
add_option "labels", :type => :array, :aliases => '-L'
add_option "num-threads", :type => :numeric, :aliases => '-p'
add_option "library-type", :type => :string, :aliases => '-l'
add_option "frag-len-mean", :type => :numeric, :aliases => '-m'
add_option "frag-len-std-dev", :type => :numeric, :aliases => '-s'
add_option "num-importance-samples", :type => :numeric, :aliases => '-i'
add_option "max-mle-iterations", :type => :numeric, :aliases => '-e'
add_option "compatible-hits-norm", :type => :boolean, :aliases => '-h'
add_option "total-hits-norm", :type => :boolean, :aliases => '-t'
add_option "poisson-dispersion", :type => :boolean, :aliases => '-d'
add_option "verbose", :type => :boolean, :aliases => '-v'
add_option "quiet", :type => :boolean, :aliases => '-q'
add_option "no-update-check", :type => :boolean, :aliases => '-j'
add_option "emit-count-tables", :type => :boolean, :aliases => '-b'
#define iterators
add_iterator_for :genes
add_iterator_for :isoforms
add_iterator_for :cds
add_iterator_for :tss_groups
end #Diff
#HOW TO USE THE functionality
Bio::Ngs::Cufflinks::Diff.foreach_gene_tracked("path_to_cuffdiff_output_directory") do |gene_fpkm_track|
expression_profile = (1..7).map do |sample_idx|
gene_fpkm_track["q#{sample_idx}_FPKM"].to_f
end
#do your stuff accessing this tabular file with gene_fpkm_track["name of the field"]
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment