| 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__ |