root/galaxy-central/tools/human_genome_variation/linkToGProfile.pl

リビジョン 2, 1.8 KB (コミッタ: hatakeyama, 14 年 前)

import galaxy-central

  • 属性 svn:executable の設定値 *
行番号 
1#!/usr/bin/env perl
2
3use strict;
4use warnings;
5
6###################################################
7# linkToGProfile.pl
8# Generates a link to gprofile for a list of gene IDs.
9# g:Profiler a web-based toolset for functional profiling of gene lists from large-scale experiments (2007) NAR 35 W193-W200
10###################################################
11 
12if (!@ARGV or scalar @ARGV != 4) {
13   print "usage: linkToGProfile.pl infile.tab 1basedCol idType outfile\n";
14   exit 1;
15}
16
17my $in = shift @ARGV;
18my $col = shift @ARGV;
19my $type = shift @ARGV;
20my $out = shift @ARGV;
21
22if ($col < 1) {
23   print "ERROR the column number should be 1 based counting\n";
24   exit 1;
25}
26my @gene;
27open(FH, $in) or die "Couldn't open $in, $!\n";
28while (<FH>) {
29   chomp;
30   my @f = split(/\t/);
31   if (scalar @f < $col) {
32      print "ERROR there is no column $col in $in\n";
33      exit 1;
34   }
35   if ($f[$col-1]) { push(@gene, $f[$col-1]); }
36}
37close FH or die "Couldn't close $in, $!\n";
38 
39my $link = 'http://biit.cs.ut.ee/gprofiler/index.cgi?organism=hsapiens&query=GENELIST&r_chr=1&r_start=start&r_end=end&analytical=1&domain_size_type=annotated&term=&significant=1&sort_by_structure=1&user_thr=1.00&output=png&prefix=TYPE';
40$link =~ s/TYPE/$type/;
41my $g = join("+", @gene);
42$link =~ s/GENELIST/$g/;
43#print output
44if (length $link > 2048) {
45   print "ERROR too many genes to fit in URL, please select a smaller set\n";
46   exit;
47}
48open(FH, ">", $out) or die "Couldn't open $out, $!\n";
49print FH "<html><head><title>g:Profiler link</title></head><body>\n",
50      '<A TARGET=_BLANK HREF="', $link, '">click here to send list of identifiers to g:Profiler</A>', "\n",
51      '</body></html>', "\n";
52close FH or die "Couldn't close $out, $!\n";
53
54#also do link that prints text that could be pulled back into Galaxy?
55exit;
Note: リポジトリブラウザについてのヘルプは TracBrowser を参照してください。