Top Level Namespace

Includes:
Bio::MAF

Defined Under Namespace

Modules: Bio, BioMaf

Constant Summary collapse

PRINTERS =
{
  'flat' => :FlatPrinter,
  'stack' => :CallStackPrinter
}

Constants included from Bio::MAF

Bio::MAF::FASTA_LINE_LEN, Bio::MAF::LOG, Bio::MAF::TYPE_PROPS

Instance Method Summary collapse

Methods included from Bio::MAF

handle_logging_options

Instance Method Details

#apply_options(options, tiler) ⇒ Object



21
22
23
24
25
# File 'bin/maf_tile', line 21

def apply_options(options, tiler)
  tiler.reference = options.ref if options.ref
  tiler.species = options.species
  tiler.species_map = options.species_map
end

#build_index(maf, index) ⇒ Object



23
24
25
26
27
28
29
# File 'bin/maf_index', line 23

def build_index(maf, index)
  parser = Bio::MAF::Parser.new(maf,
                                :chunk_reader => $options.reader,
                                :parse_extended => false)
  idx = Bio::MAF::KyotoIndex.build(parser, index, $options.ref_only)
  idx.close
end

#desc(seq) ⇒ Object



7
8
9
# File 'bin/find_overlaps', line 7

def desc(seq)
  "#{seq.source}:#{seq.start}-#{seq.end}"
end

#handle_interval_spec(int) ⇒ Object



24
25
26
27
28
29
30
# File 'bin/maf_extract', line 24

def handle_interval_spec(int)
  if int =~ /(.+):(\d+)-(\d+)/
    Bio::GenomicInterval.zero_based($1, $2.to_i, $3.to_i)
  else
    raise "Invalid interval specification: #{int}"
  end
end

#handle_list_spec(spec) ⇒ Object



16
17
18
19
20
21
22
# File 'bin/maf_extract', line 16

def handle_list_spec(spec)
  if spec =~ /^@(.+)/
    File.read($1).split
  else
    spec.split(',')
  end
end

#parse_interval(line) ⇒ Object



9
10
11
12
13
14
# File 'bin/maf_tile', line 9

def parse_interval(line)
  src, r_start_s, r_end_s, _ = line.split(nil, 4)
  r_start = r_start_s.to_i
  r_end = r_end_s.to_i
  return Bio::GenomicInterval.zero_based(src, r_start, r_end)
end

#target_for(base, interval, &blk) ⇒ Object



16
17
18
19
# File 'bin/maf_tile', line 16

def target_for(base, interval, &blk)
  path = "#{base}_#{interval.zero_start}-#{interval.zero_end}.fa"
  File.open(path, 'w', &blk)
end

#usage(msg) ⇒ Object



117
118
119
120
121
# File 'bin/maf_extract', line 117

def usage(msg)
  $stderr.puts msg
  $stderr.puts $op
  exit 2
end