comparison variant_effect_predictor/Bio/EnsEMBL/Pipeline/FASTA/Indexer.pm @ 0:1f6dce3d34e0

Uploaded
author mahtabm
date Thu, 11 Apr 2013 02:01:53 -0400
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:1f6dce3d34e0
1 package Bio::EnsEMBL::Pipeline::FASTA::Indexer;
2
3 use strict;
4 use warnings;
5
6 use base qw/Bio::EnsEMBL::Pipeline::FASTA::Base/;
7
8 use File::Copy qw/copy/;
9 use File::Spec;
10 use Bio::EnsEMBL::Utils::Exception qw/throw/;
11
12 sub decompress {
13 my ($self) = @_;
14 my $source = $self->param('file');
15 my $target_dir = $self->target_dir();
16 my ($vol, $dir, $file) = File::Spec->splitpath($source);
17 my $target = File::Spec->catdir($target_dir, $file);
18 my $gunzipped_target = $target;
19 $gunzipped_target =~ s/.gz$//;
20 $self->info('Copying from %s to %s', $source, $target);
21 copy($source, $target) or throw "Cannot copy $source to $target: $!";
22 $self->info('Decompressing %s to %s', $source, $gunzipped_target);
23 system("gunzip -f $target") and throw sprintf('Could not gunzip. Exited with code %d', ($? >>8));
24 return $gunzipped_target;
25 }
26
27 sub repeat_mask_date {
28 my ($self) = @_;
29 my $res = $self->get_DBAdaptor()->dbc()->sql_helper()->execute_simple(
30 -SQL => <<'SQL',
31 select max(date_format( created, "%Y%m%d"))
32 from analysis a join meta m on (a.logic_name = lower(m.meta_value))
33 where meta_key =?
34 SQL
35 -PARAMS => ['repeat.analysis']
36 );
37 return $res->[0] if @$res;
38 return q{};
39 }
40
41 sub run {
42 my ($self) = @_;
43 my $decompressed = $self->decompress();
44 $self->index_file($decompressed);
45 $self->cleanup_DBAdaptor();
46 return;
47 }
48
49 sub index_file {
50 die "Implement";
51 }
52
53 sub target_dir {
54 die "Implement";
55 }
56
57
58 1;