Class: GalaxyUtil

Inherits:
Object
  • Object
show all
Defined in:
lib/protk/galaxy_util.rb

Class Method Summary collapse

Class Method Details

.for_galaxy?Boolean

Returns:

  • (Boolean)


9
10
11
12
13
# File 'lib/protk/galaxy_util.rb', line 9

def self.for_galaxy?
  for_galaxy = ARGV[0] == "--galaxy"
  ARGV.shift if for_galaxy
  return for_galaxy
end

.stage_protxml(input_protxml_path) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/protk/galaxy_util.rb', line 16

def self.stage_protxml(input_protxml_path)
  # This method takes in the path to a protxml created in Galaxy,
  # finds the dependent pepxml and peak lists (mzml files), creates
  # symbolic links to the peak lists with the correct extension and
  # and indexes them if needed (both seem required for TPP quant
  # tools) and then produces new protxml and pepxml files with paths
  # updated to these new peak list files.

  protxml_path="interact.prot.xml"
  FileUtils.copy(input_protxml_path, "interact.prot.xml")

  protxml = ProtXML.new(protxml_path)
  pepxml_path = protxml.find_pep_xml()

  protxml_stager = GalaxyStager.new(protxml_path, :extension => ".prot.xml", :force_copy => true)
  pepxml_stager = GalaxyStager.new(pepxml_path, :name => "interact", :extension => ".xml", :force_copy => true)
  pepxml_path = pepxml_stager.staged_path
  pepxml_stager.replace_references(protxml_path)
  runs = PepXML.new(pepxml_stager.staged_path).find_runs()

  run_stagers = runs.map do |base_name, run|
    run_stager = GalaxyStager.new(base_name, :extension => ".#{run[:type]}")
    ConvertUtil.ensure_mzml_indexed(run_stager.staged_path)
    run_stager.replace_references(pepxml_path, :base_only => true)
    run_stager
  end

  protxml_path
end