Mercurial > repos > earlhaminst > smart_domains
annotate smart-domain.pl @ 1:8c24cc7431aa draft default tip
"planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 411fa9c106996050b2d2e8027e14d2068f6b14c3"
author | earlhaminst |
---|---|
date | Tue, 22 Dec 2020 04:29:12 +0000 |
parents | a3b26189fee3 |
children |
rev | line source |
---|---|
0
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
1 #!/usr/bin/env perl |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
2 use strict; |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
3 use HTTP::Request::Common; |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
4 use LWP::UserAgent; |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
5 use Pod::Usage; |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
6 use Getopt::Long; |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
7 use Bio::SeqIO; |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
8 use JSON; |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
9 |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
10 my $json = JSON->new->allow_nonref; |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
11 #run this script with --help to see the options |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
12 |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
13 =pod |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
14 |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
15 =head1 NAME |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
16 |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
17 SMART_batch - submit sequences from a FASTA file to SMART |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
18 |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
19 =head1 SYNOPSIS |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
20 |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
21 B<SMART_batch.pl> I<options> |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
22 |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
23 =head1 DESCRIPTION |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
24 |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
25 Use B<SMART_batch.pl> to submit multiple protein sequences from a FASTA file into the SMART analysis queue. Results are saved into plain text files. |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
26 |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
27 =head1 GENERAL OPTIONS |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
28 |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
29 |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
30 =over 4 |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
31 |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
32 =item B<--help> |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
33 |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
34 display this message |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
35 |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
36 =item B<--inputFile> |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
37 |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
38 FASTA file with sequences to submit |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
39 |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
40 =item B<--outputDirectory> |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
41 |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
42 Directory which will be used to store the results. Will be created if it doesn't exist. Defaults to 'SMART_results'. |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
43 |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
44 =item B<--outputFormat> |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
45 |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
46 Choose prefered output format from txt, json or tabular. |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
47 Default is txt. |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
48 |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
49 =back |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
50 |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
51 =head1 ANALYSIS OPTIONS |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
52 |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
53 =over 4 |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
54 |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
55 =item B<--includePfam> |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
56 |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
57 Include Pfam domains in the search. (http://pfam.sanger.ac.uk/) |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
58 |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
59 =item B<--includeSignalP> |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
60 |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
61 Include signal peptide predictions. (http://www.cbs.dtu.dk/services/SignalP/) |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
62 |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
63 =item B<--includeRepeats> |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
64 |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
65 Include internal repeat predictions. (http://www.well.ox.ac.uk/rmott/ARIADNE/) |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
66 |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
67 =item B<--includeDISEMBL> |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
68 |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
69 Include predictions of internal protein disorder. (http://dis.embl.de/) |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
70 |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
71 =item B<--includeSchnipsel> |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
72 |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
73 Include predictions of outlier homologues and homologues of known structures. (http://smart.embl.de/help/smart_glossary.shtml#outlier) |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
74 |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
75 =back |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
76 |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
77 |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
78 =head1 SEE ALSO |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
79 |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
80 SMART Home page : http://smart.embl.de |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
81 SMART FAQ : http://smart.embl.de/help/FAQ.shtml |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
82 |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
83 =head1 AUTHORS |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
84 |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
85 Written by Ivica Letunic <ivica@letunic.com> |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
86 |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
87 Modified by Anil Thanki <Anil.Thanki@earlham.ac.uk> to parse output in JSON and tabular format to adapt in Galaxy |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
88 |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
89 =cut |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
90 |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
91 my $submit_url = "http://smart.embl.de/smart/show_motifs.pl"; |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
92 my $job_status_url = "http://smart.embl.de/smart/job_status.pl"; |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
93 my $output_format = "txt"; |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
94 my ($show_help, $input_file, $output_directory, $do_pfam, $do_signalp, $do_rep, $do_disembl, $do_schnipsel); |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
95 my $op_r = GetOptions ( |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
96 "help" => \$show_help, |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
97 "inputFile=s" => \$input_file, |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
98 "outputDirectory=s" => \$output_directory, |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
99 "includePfam" => \$do_pfam, |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
100 "includeSignalP" => \$do_signalp, |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
101 "includeRepeats" => \$do_rep, |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
102 "includeDISEMBL" => \$do_disembl, |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
103 "includeSchnipsel" => \$do_schnipsel, |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
104 "outputFormat=s" => \$output_format, |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
105 ); |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
106 |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
107 unless ($input_file) { $show_help = 1; } |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
108 |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
109 pod2usage(VERBOSE => 2) if ( $show_help ); |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
110 |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
111 my $ua = LWP::UserAgent->new(); |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
112 my $result = ""; |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
113 $ua->agent("SMARTbatch1.0"); |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
114 |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
115 |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
116 print "\nSMART batch analysis\n======================\n"; |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
117 |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
118 unless (defined $output_directory) { $output_directory = 'SMART_results'; } |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
119 unless (-d $output_directory) { mkdir $output_directory; } |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
120 unless (-e $input_file) { print STDERR "Input file does not exist."; exit;} |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
121 |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
122 my $io = new Bio::SeqIO(-format=> 'fasta', -file=> $input_file); |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
123 |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
124 #process sequences one by one. ALWAYS wait for the results before submitting the next sequence. |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
125 |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
126 while (my $seq = $io->next_seq) { |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
127 my $seq_id = $seq->display_id; |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
128 my $output_file; |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
129 if ($output_format eq "txt") |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
130 { |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
131 $output_file = $output_directory . "/" . $seq_id . "_SMART_results.txt"; |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
132 } elsif ($output_format eq "tabular") |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
133 { |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
134 $output_file = $output_directory . "/" . $seq_id . "_SMART_results.tabular"; |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
135 } elsif ($output_format eq "json"){ |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
136 $output_file = $output_directory . "/" . $seq_id . "_SMART_results.json"; |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
137 } |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
138 if (-e $output_file) { |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
139 my @s = stat($output_file); |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
140 if ($s[7] == 0) { |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
141 print "Removing empty results file $output_file.\n"; |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
142 unlink $output_file; |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
143 } else { |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
144 print "Skipping sequence $seq_id because the results file already exists.\n"; |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
145 next; |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
146 } |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
147 } |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
148 print "Submitting sequence $seq_id...\n"; |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
149 #prepare the basic POST data |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
150 my %post_content; |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
151 $post_content{'SEQUENCE'} = $seq->seq; |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
152 $post_content{'TEXTONLY'} = 1; |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
153 if ($do_pfam) { $post_content{'DO_PFAM'} = 'DO_PFAM'; } |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
154 if ($do_signalp) { $post_content{'INCLUDE_SIGNALP'} = 'INCLUDE_SIGNALP'; } |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
155 if ($do_rep) { $post_content{'DO_PROSPERO'} = 'DO_PROSPERO'; } |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
156 if ($do_disembl) { $post_content{'DO_DISEMBL'} = 'DO_DISEMBL'; } |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
157 if ($do_schnipsel) { $post_content{'INCLUDE_BLAST'} = 'INCLUDE_BLAST'; } |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
158 my $req = POST $submit_url, Content_Type => 'form-data', Content => [ %post_content ]; |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
159 my $response = $ua->request($req); |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
160 if ($response->is_success()) { |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
161 my @res = split(/\n/, $response->content); |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
162 #check if we got the results directly (precomputed results) |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
163 shift @res if ($res[1] =~ /^--\ SMART\ RESULT/); |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
164 if ($res[0] =~ /^--\ SMART\ RESULT/) { |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
165 response_parser($output_file, $response, $output_format); |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
166 } else { |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
167 #we're in the queue, or there was an error |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
168 my $job_id; |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
169 for (my $i = 0; $i <= $#res; $i++) { |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
170 if ($res[$i] =~ /job_status\.pl\?jobid=(\d+.+?)'/) { |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
171 $job_id = $1; |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
172 last; |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
173 } |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
174 } |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
175 unless (length $job_id) { |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
176 #there is no job ID, so an error occured |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
177 my $error_file = "$output_directory/$seq_id\_SMART_error.html"; |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
178 open (ERR, ">$error_file") or die "Cannot write to $error_file"; |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
179 print ERR $response->content; |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
180 close ERR; |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
181 print "SMART returned an error page, which was saved into '$error_file'.\nPlease check the file for details. Aborting further submissions.\n"; |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
182 exit; |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
183 } else { |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
184 #we have a jobID, check every 10 seconds until we get the results |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
185 print "Job entered the queue with ID $job_id. Waiting for results.\n"; |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
186 my $job_status_req = GET "$job_status_url?jobid=$job_id"; |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
187 sleep 5; |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
188 while (1) { |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
189 my $job_status_response = $ua->request($job_status_req); |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
190 if ($job_status_response->is_success) { |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
191 #check if we got the results |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
192 my @job_status_res = split(/\n/, $job_status_response->content); |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
193 shift @job_status_res if ($job_status_res[1] =~ /^--\ SMART\ RESULT/); |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
194 if ($job_status_res[0] =~ /^--\ SMART\ RESULT/) { |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
195 response_parser($output_file, $job_status_response, $output_format); |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
196 last; |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
197 } else { |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
198 #still in queue |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
199 sleep 10; |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
200 } |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
201 } else { |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
202 print "SMART returned a web server error. Full message follows:\n\n"; |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
203 print $response->as_string; |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
204 die; |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
205 } |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
206 } |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
207 } |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
208 } |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
209 |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
210 } else { |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
211 print "SMART returned a web server error. Full message follows:\n\n"; |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
212 print $response->as_string; |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
213 die; |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
214 } |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
215 #be nice to other users |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
216 sleep 5; |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
217 } |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
218 |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
219 sub toJSON{ |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
220 my ($text) = @_; |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
221 |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
222 my @result = split("\n", $text); |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
223 my $line; |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
224 my %hash; |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
225 my @hashes; |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
226 my $json; |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
227 |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
228 foreach $line (@result) |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
229 { |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
230 if(index($line, "=") > 0){ |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
231 my $key = (split(/=/, $line))[0]; |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
232 my $value = (split(/=/, $line))[1]; |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
233 $hash{$key} = $value; |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
234 } elsif(length($line) == 0){ |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
235 if (exists $hash{"DOMAIN"}) |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
236 { |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
237 $json = encode_json \%hash; |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
238 push @hashes, $json; |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
239 } |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
240 %hash = (); |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
241 } |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
242 } |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
243 |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
244 return @hashes; |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
245 } |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
246 |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
247 sub response_parser{ |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
248 my $output_file = $_[0]; |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
249 my $job_status_response = $_[1]; |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
250 my $output_format = $_[2]; |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
251 |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
252 |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
253 open (OUT, ">$output_file") or die "Cannot write to $output_file"; |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
254 $result = $job_status_response->content; |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
255 if ($output_format eq "txt") |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
256 { |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
257 print OUT $result; |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
258 } elsif ($output_format eq "tabular") |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
259 { |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
260 my @result = toJSON($result); |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
261 |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
262 my $first_row = decode_json $result[0]; |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
263 my @keys; |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
264 my $counter; |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
265 |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
266 foreach my $key(sort keys %$first_row) { |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
267 print OUT "$key"; |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
268 print OUT "\t" if ++$counter < scalar keys %$first_row; |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
269 push @keys, $key; |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
270 } |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
271 print OUT "\n"; |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
272 |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
273 my $counter; |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
274 |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
275 foreach my $line (@result) |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
276 { |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
277 my $first_row = decode_json $line; |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
278 my $counter; |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
279 foreach my $key (@keys) |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
280 { |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
281 print OUT $first_row->{$key}; |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
282 print OUT "\t" if ++$counter < scalar(@keys); |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
283 } |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
284 print OUT "\n"; |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
285 } |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
286 |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
287 } elsif ($output_format eq "json"){ |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
288 my @result = toJSON($result); |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
289 |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
290 print OUT "["; |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
291 my $counter; |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
292 foreach my $line (@result) |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
293 { |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
294 print OUT $line; |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
295 print OUT "," if ++$counter < scalar(@result); |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
296 } |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
297 print OUT "]"; |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
298 |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
299 } |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
300 close OUT; |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
301 print "Results saved to '$output_file'\n"; |
a3b26189fee3
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/smart_domains commit 266d7c45a443e893f15eab4b1485ca7c1c406a14
earlhaminst
parents:
diff
changeset
|
302 } |