1#!/usr/local/bin/perl -w
2use strict;
3use Cwd qw(cwd);
4my ($O, $cmd);
5my $ACC = 'ERR2950949';
6
7my $ALL = 1;
8
9my $DEBUG = '';
10#$DEBUG = '-+ VFS';
11
12my $PRF_DEBUG = ''; # '-vv';
13
14my $VERBOSE = 0;
15#$VERBOSE = 1; # print what's executed'
16#$VERBOSE = 2; # print commands
17#$VERBOSE = 3; # print command output
18
19`echo '/LIBS/GUID = "8test002-6ab7-41b2-bfd0-prefetchpref"'               >  k`;
20
21`rm -r ERR2950949`;
22
23if ($ALL) {
24########## use site repository (if exists) from default configuration ##########
25print "########################################################\n" if($VERBOSE);
26print "vdb-dump - use site repository\n" if ($VERBOSE);
27$cmd = "vdb-dump $ACC -R 1489067 $DEBUG -CREAD";
28print "$cmd\n" if ($VERBOSE > 1);
29$O = `$cmd 2>&1`;
30print $O if ($VERBOSE > 2);
31die if ($?);
32}
33
34if ($ALL) {
35print "########################################################\n" if($VERBOSE);
36print "fastq-dump - use site repository\n" if ($VERBOSE);
37$cmd = "fastq-dump $ACC -N 1489067 -X 1489067 $DEBUG -Z";
38print "$cmd\n" if ($VERBOSE > 1);
39$O = `$cmd 2>&1`;
40print $O if ($VERBOSE > 2);
41die if ($?);
42}
43
44########## use remote repository ##########
45`echo '/repository/site/disabled = "true"' >> k`;
46
47if ($ALL) {
48print "########################################################\n" if($VERBOSE);
49print "vdb-dump - use remote repository\n" if ($VERBOSE);
50$cmd = "vdb-dump $ACC -R 1489067 $DEBUG -CREAD";
51print "$cmd\n" if ($VERBOSE > 1);
52$O = `$cmd 2>&1`;
53print $O if ($VERBOSE > 2);
54die if ($?);
55}
56
57if ($ALL) {
58print "########################################################\n" if($VERBOSE);
59print "fastq-dump - use remote repository\n" if ($VERBOSE);
60$cmd = "fastq-dump $ACC -N 1489067 -X 1489067 $DEBUG -Z";
61print "$cmd\n" if ($VERBOSE > 1);
62$O = `$cmd 2>&1`;
63print $O if ($VERBOSE > 2);
64die if ($?);
65}
66
67
68########## prefetch to AD ##########
69if ($ALL) {
70print "########################################################\n" if($VERBOSE);
71print "prefetch to AD\n" if ($VERBOSE);
72$cmd = "prefetch $ACC $DEBUG $PRF_DEBUG";
73print "$cmd\n" if ($VERBOSE > 1);
74$O = `$cmd 2>&1`;
75print $O if ($VERBOSE > 2);
76die if ($?);
77
78`echo '/repository/remote/disabled = "true"' >> k`;
79}
80
81
82if ($ALL) {
83print "########################################################\n" if($VERBOSE);
84print "vdb-dump - use AD\n" if ($VERBOSE);
85$cmd = "vdb-dump $ACC -R 1489067 $DEBUG -CREAD";
86print "$cmd\n" if ($VERBOSE > 1);
87$O = `$cmd 2>&1`;
88print $O if ($VERBOSE > 2);
89die if ($?);
90}
91
92if ($ALL) {
93print "########################################################\n" if($VERBOSE);
94print "fastq-dump - use AD repository\n" if ($VERBOSE);
95$cmd = "fastq-dump $ACC -N 1489067 -X 1489067 $DEBUG -Z";
96print "$cmd\n" if ($VERBOSE > 1);
97$O = `$cmd 2>&1`;
98print $O if ($VERBOSE > 2);
99die if ($?);
100}
101
102$O = `rm -rv $ACC`; die if ($?);
103print $O if ($VERBOSE > 2);
104
105########## prefetch to user repository ##########
106my $cwd = cwd();
107`echo '/LIBS/GUID = "8test002-6ab7-41b2-bfd0-prefetchpref"'               >  k`;
108`echo '/repository/site/disabled = "true"'                                >> k`;
109`echo '/repository/user/main/public/apps/refseq/volumes/refseq = "refseq"'>> k`;
110`echo '/repository/user/main/public/apps/sra/volumes/sraFlat = "sra"     '>> k`;
111`echo '/repository/user/main/public/apps/wgs/volumes/wgsFlat = "wgs"'     >> k`;
112`echo '/repository/user/main/public/root = "$cwd"\n'                      >> k`;
113
114if ($ALL) {
115print "########################################################\n" if($VERBOSE);
116print "prefetch to user repository\n" if ($VERBOSE);
117$cmd = "prefetch $ACC $DEBUG $PRF_DEBUG";
118print "$cmd\n" if ($VERBOSE > 1);
119$O = `$cmd 2>&1`;
120print $O if ($VERBOSE > 2);
121die if ($?);
122
123`echo '/repository/remote/disabled = "true"' >>  k`;
124}
125
126if ($ALL) {
127print "########################################################\n" if($VERBOSE);
128$_ = `which srapath`; chomp;
129$_ = readlink ( $_ );
130$_ = `which $_`; chomp;
131$_ = readlink($_);
132$_ = `which $_`; chomp;
133if (-l $_) {
134    print "skipped(remote dsb): vdb-dump - use user repository\n" if ($VERBOSE);
135} else {
136    print "vdb-dump - use user repository\n" if ($VERBOSE);
137    $cmd = "vdb-dump $ACC -R 1489067 $DEBUG -CREAD";
138    print "$cmd\n" if ($VERBOSE > 1);
139    $O = `$cmd 2>&1`;
140    print $O if ($VERBOSE > 2);
141    die if ($?);
142}
143}
144
145if ($ALL) {
146print "########################################################\n" if($VERBOSE);
147$_ = `which srapath`; chomp;
148$_ = readlink ( $_ );
149$_ = `which $_`; chomp;
150$_ = readlink($_);
151$_ = `which $_`; chomp;
152if (-l $_) {
153    print "skipped(remote dsb): fastq-dump - use user repository\n" if ($VERBOSE);
154} else {
155    print "fastq-dump - use  user repository\n" if ($VERBOSE);
156    $cmd = "fastq-dump $ACC -N 1489067 -X 1489067 $DEBUG -Z";
157    print "$cmd\n" if ($VERBOSE > 1);
158    $O = `$cmd 2>&1`;
159    print $O if ($VERBOSE > 2);
160    die if ($?);
161}
162}
163