Sha256: ae75feadd8bf5ed6ac4ca60c8f36ad4e668af3434f80eced74efb37b4588684a

Contents?: true

Size: 712 Bytes

Versions: 6

Compression:

Stored size: 712 Bytes

Contents

#!/usr/local/bin/ruby-1.9

# usage:
# ./num-gene-exon <genomic-interval>
# example:
# ./num-gene-exon chr1:12345-45678
#
# Based on hg18-RefSeq genes table, print a list of included genes,
# number of genes, and maximum number of exons.
#

require 'bio-ucsc'

interval = Bio::GenomicInterval.parse(ARGV[0])

DB = Bio::Ucsc::Hg18
DB.connect

genes = DB::RefGene.with_interval(interval).find(:all).map{|e|e.name2}.uniq
puts "Included  genes:"
puts genes
puts "Number of genes:"
puts genes.size

total_exons = 0
genes.each do |gene|
  total_exons +=
    DB::RefGene.
    with_interval(interval).
    find_all_by_name2(gene).
    map{|e|e.exonCount}.
    max
end

puts "Number of exons (maximum):"
puts total_exons

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
bio-ucsc-api-0.6.5 samples/num-gene-exon.rb
bio-ucsc-api-0.6.4 samples/num-gene-exon.rb
bio-ucsc-api-0.6.3 samples/num-gene-exon.rb
bio-ucsc-api-0.6.2 samples/num-gene-exon.rb
bio-ucsc-api-0.6.1 samples/num-gene-exon.rb
bio-ucsc-api-0.6.0 samples/num-gene-exon.rb