blib/script/track_hub_constructor.pl untested

filter: Statementstmt 0.0% 0 / 48 Branchbran 0.0% 0 / 10 Conditioncond 0.0% 0 / 2 MC/DCmcdc n/a Subroutinesub 0.0% 0 / 8 Podpod n/a totaltotal 0.0% 0 / 68 CC 1 SCAR 6.9
CC
1
Cov
0%
BEGIN
2.0
BEGIN
2.0
BEGIN
2.0
CRAP 2.0
1 #!/usr/bin/env perl
2 # -*-CPerl-*-
3 # Last changed Time-stamp: <2014-12-19 23:16:22 mtw>
4 #
5 # Construct UCSC genome browser Track Hub and display various
6 # genomic sequence annotation data within the Hub
7 #
8 # ***********************************************************************
9 # * Copyright notice
10 # *
11 # * Copyright 2014 Michael T. Wolfinger <michael@wolfinger.eu>
12 # * Florian Eggenhofer <florian.eggenhofer@univie.ac.at>
13 # * All rights reserved
14 # *
15 # * This program is free software: you can redistribute it and/or modify
16 # * it under the terms of the GNU General Public License as published by
17 # * the Free Software Foundation, either version 3 of the License, or
18 # * (at your option) any later version.
19 # *
20 # * This program is distributed in the hope that it will be useful,
21 # * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 # * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 # * GNU General Public License for more details.
24 # *
25 # * You should have received a copy of the GNU General Public License
26 # * along with this program. If not, see <http://www.gnu.org/licenses/>.
27 # *
28 # * This copyright notice MUST APPEAR in all copies of the script!
29 # ***********************************************************************
30  
31 use strict;
32 use warnings;
33 use Getopt::Long;
34 use Pod::Usage;
35 use Data::Dumper;
36 use File::Basename;
37 use Path::Class;
38 use Bio::ViennaNGS::UCSC qw( make_assembly_hub make_track_hub );
39  
40 #^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^#
41 #^^^^^^^^^^ Variables ^^^^^^^^^^^#
42 #^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^#
43  
44 my ($track_hub_return_value,$lf);
45 my $logname = "log.txt";
46 my $genome_identifier = '-';
47 my $folder_in = '-';
48 my $dest = '.';
49 my $base_URL = '-';
50 my $big_bed_urls = '-';
51 my $big_wig_urls = '-';
52 #^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^#
53 #^^^^^^^^^^^^^^ Main ^^^^^^^^^^^^^#
54 #^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^#
55 Getopt::Long::config('no_ignore_case');
56 pod2usage(-verbose => 1) unless GetOptions("gi|g=s" => \$genome_identifier,
57 "out|o=s" => \$dest,
58 "baseurl|u=s" => \$base_URL,
59 "bigbeds|b=s" => \$big_bed_urls,
60 "bigwigs|w=s" => \$big_wig_urls,
61 "man" => sub{pod2usage(-verbose => 2)},
62 "help|h" => sub{pod2usage(1)}
63 );
64  
65 unless ($genome_identifier){
66 warn "Please provide genome identifier via --g option";
67 pod2usage(-verbose => 0);
68 }
69 unless ($base_URL =~ /^http/) {
70 warn "Base URL must be given in full format, eg http://foo.bar.com/Hubs/";
71 pod2usage(-verbose => 0);
72 }
73 unless ($dest =~ /\/$/){$dest.= "/";}
74 unless (-d $dest){
75 mkdir $dest or die $!;
76 }
77 $lf = file($dest,$logname);
78  
79 $track_hub_return_value = make_track_hub($genome_identifier,$dest,$base_URL,$big_bed_urls,$big_wig_urls,$lf);
80  
81 __END__
82  
83  
84 =head1 NAME
85  
86 track_hub_constructor.pl - Build UCSC genome browser Track Hubs from
87 genomic sequence and annotation
88  
89 =head1 SYNOPSIS
90  
91 track_hub_constructor.pl [--gi I<ID>] [--infolder I<PATH>] [--out
92 I<PATH>] [--baseurl -I<URL>] [--bigwigs -I<URL,URL#URL>] [options]
93  
94 =head1 DESCRIPTION
95  
96 The UCSC genome browser offers the possibility to visualize additional
97 tracks for organisms that are included in the standard UCSC browser
98 bundle via so called 'Track Hubs'. This script constructs Track Hubs
99 from annotation data.
100  
101 =head1 OPTIONS
102  
103 =over
104  
105 =item B<--gi -g>
106  
107 Genome id as used in UCSC assembly hub. Must be correct, otherwise the
108 annotation cannot be mapped on the genome.
109  
110 =item B<--infolder -i>
111  
112 Directory which contains all track files in BED/bigBed format. The
113 resulting Track Hub will contain these files in their respective
114 bigFile version.
115  
116 =item B<--out -o>
117  
118 Destination folder for the output Track Hub.
119  
120 =item B<--baseurl -u>
121  
122 BaseURL used within the Track Hub. This URL will be included verbatim
123 in the resulting Track Hub. It is crucial that this URl is valid, else
124 the resulting Track Hub will be broken.
125  
126 =item B<--bigbeds -b>
127  
128 URLs pointing to big bed files to be included in the trackhub. Multiple URLs are
129 separated by the character #.
130  
131 =item B<--bigwigs -w>
132  
133 URLs pointing to big wig files to be included in the trackhub. Multiple URLs are
134 separated by the star character #. It is possible to create a multiwig container by
135 providing 2 URLs instead of one separated by comma character ,. E.g.
136 http://foo.com/bar.bw,http://foo.com/bar2.bw#http://foo.com/bar3.bw yields a multi
137 big wig container displaying bar as positive reads in green and bar2 as negative
138 3 red colored reads in the same track and additionally bar3 in an own track
139 colored blue.
140  
141 =item B<--help -h>
142  
143 Print short help.
144  
145 =item B<--man>
146  
147 Prints the manual page and exits.
148  
149 =back
150  
151 =head1 SEE ALSO
152  
153 The L<UCSC Genome
154 Wiki|http://genomewiki.ucsc.edu/index.php/Track_Hubs> has extensive
155 documentation for Assembly and Track Hubs.
156  
157 =head1 AUTHORS
158  
159 =over
160  
161 =item Florian Eggenhofer E<lt>florian.eggenhofer@univie.ac.atE<gt>
162  
163 =item Michael T. Wolfinger E<lt>michael@wolfinger.euE<gt>
164  
165 =back