This file is indexed.

/usr/share/perl5/Genome/Model/Tools/Music/Galaxy.pm is in libgenome-model-tools-music-perl 0.04-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
package Genome::Model::Tools::Music::Galaxy;

use strict;
use warnings;

use Genome;
use File::Basename;

our $VERSION = $Genome::Model::Tools::Music::VERSION;

class Genome::Model::Tools::Music::Galaxy {
  is => "Genome::Model::Tools::Music::Play",
  has_input => [
    output_bundle => {
      is => 'Text',
      doc => 'Location where Galaxy would like the bundle of Music outputs to be saved',
    },
  ],
  has => [
    output_dir => {
      is_input => 0,
      is_output => 0,
      is_optional => 1,
      default => '',
    },
  ],
};

sub execute {
  my $self = shift;

  my $output_dir = Genome::Sys->create_temp_directory();
  $self->output_dir($output_dir);

  $self->bam_list($self->create_new_bam_list);

  $self->SUPER::_execute_body(@_);

  my $tar_path = $self->output_bundle;
  my $cmd = "tar -cf $tar_path -C $output_dir .";
  my $rv = Genome::Sys->shellcmd(
      cmd => $cmd,
  );

  return 1;
}

sub create_new_bam_list {
  my $self = shift;
  my $original_bam_file = $self->bam_list;
  my $output_dir = Genome::Sys->create_temp_directory();
  my $new_bam_list = "$output_dir/bam_list";
  my @bams = Genome::Sys->read_file($original_bam_file);
  my $new_bam_fh = Genome::Sys->open_file_for_writing($new_bam_list);

  for (@bams) {
    chomp;
    my ($sample, $first_bam, $second_bam) = split("\t", $_);
    my $first_new_path = $self->index_and_link_bam_file($output_dir, $first_bam);
    my $second_new_path = $self->index_and_link_bam_file($output_dir, $second_bam);
    $new_bam_fh->print("$sample\t$first_new_path\t$second_new_path\n");
  }

  $new_bam_fh->close();

  return $new_bam_list;
}

sub index_and_link_bam_file {
  my $self = shift;
  my $output_dir = shift;
  my $bam = shift;

  my $filename = $output_dir . "/" . basename($bam);

  Genome::Sys->create_symlink($bam, $filename);
  Genome::Sys->shellcmd( cmd => "samtools index $filename");

  return $filename;
}

1;