annotate hubArchiveCreator.py @ 0:f493979f1408 draft default tip

planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
author yating-l
date Wed, 21 Dec 2016 12:13:04 -0500
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
1 #!/usr/bin/python
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
2 # -*- coding: utf8 -*-
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
3
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
4 """
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
5 This Galaxy tool permits to prepare your files to be ready for
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
6 Assembly Hub visualization.
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
7 Program test arguments:
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
8 hubArchiveCreator.py -g test-data/augustusDbia3.gff3 -f test-data/dbia3.fa -d . -u ./tools -o output.html
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
9 """
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
10
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
11 import argparse
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
12 import collections
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
13 import json
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
14 import logging
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
15 import os
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
16 import sys
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
17
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
18 # Internal dependencies
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
19 from Bam import Bam
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
20 from BedSimpleRepeats import BedSimpleRepeats
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
21 from BedSpliceJunctions import BedSpliceJunctions
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
22 from Bed import Bed
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
23 from BigWig import BigWig
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
24 from util.Fasta import Fasta
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
25 from util.Filters import TraceBackFormatter
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
26 from Gff3 import Gff3
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
27 from Gtf import Gtf
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
28 from Psl import Psl
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
29 from TrackHub import TrackHub
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
30
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
31 # TODO: Verify each subprocessed dependency is accessible [gff3ToGenePred, genePredToBed, twoBitInfo, faToTwoBit, bedToBigBed, sort
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
32
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
33
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
34 def main(argv):
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
35 # Command Line parsing init
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
36 parser = argparse.ArgumentParser(description='Create a foo.txt inside the given folder.')
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
37
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
38 # Reference genome mandatory
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
39 parser.add_argument('-f', '--fasta', help='Fasta file of the reference genome')
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
40
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
41 # GFF3 Management
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
42 parser.add_argument('--gff3', action='append', help='GFF3 format')
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
43
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
44 # GTF Management
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
45 parser.add_argument('--gtf', action='append', help='GTF format')
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
46
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
47 # Bed4+12 (TrfBig)
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
48 parser.add_argument('--bedSimpleRepeats', action='append', help='Bed4+12 format, using simpleRepeats.as')
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
49
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
50 # Bed12+1 (regtools)
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
51 parser.add_argument('--bedSpliceJunctions', action='append', help='Bed12+1 format, using spliceJunctions.as')
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
52
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
53 # Generic Bed (Blastx transformed to bed)
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
54 parser.add_argument('--bed', action='append', help='Bed generic format')
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
55
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
56 # BigWig Management
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
57 parser.add_argument('--bigwig', action='append', help='BigWig format')
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
58
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
59 # Bam Management
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
60 parser.add_argument('--bam', action='append', help='Bam format')
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
61
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
62 # Psl Management
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
63 parser.add_argument('--psl', action='append', help='Psl format')
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
64
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
65 # TODO: Check if the running directory can have issues if we run the tool outside
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
66 parser.add_argument('-d', '--directory',
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
67 help='Running tool directory, where to find the templates. Default is running directory')
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
68 parser.add_argument('-u', '--ucsc_tools_path',
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
69 help='Directory where to find the executables needed to run this tool')
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
70 parser.add_argument('-e', '--extra_files_path',
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
71 help='Name, in galaxy, of the output folder. Where you would want to build the Track Hub Archive')
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
72 parser.add_argument('-o', '--output', help='Name of the HTML summarizing the content of the Track Hub Archive')
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
73
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
74 parser.add_argument('-j', '--data_json', help='Json containing the metadata of the inputs')
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
75
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
76 parser.add_argument('--user_email', help='Email of the user who launched the Hub Archive Creation')
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
77
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
78 parser.add_argument('--genome_name', help='UCSC Genome Browser assembly ID')
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
79
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
80 parser.add_argument('--debug_mode', action='store_true', help='Allow more details about the errors')
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
81
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
82 # Begin init variables
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
83
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
84 toolDirectory = '.'
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
85 extra_files_path = '.'
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
86
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
87 # Get the args passed in parameter
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
88 args = parser.parse_args()
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
89
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
90 extra_files_path = args.extra_files_path
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
91 toolDirectory = args.directory
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
92
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
93 #### Logging management ####
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
94 # If we are in Debug mode, also print in stdout the debug dump
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
95
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
96 configure_logger(extra_files_path=extra_files_path, debug=args.debug_mode)
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
97
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
98 #### END Logging management ####
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
99
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
100 array_inputs_reference_genome = json.loads(args.fasta)
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
101
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
102 # TODO: Replace these with the object Fasta
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
103 input_fasta_file = array_inputs_reference_genome["false_path"]
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
104 input_fasta_file_name = sanitize_name_input(array_inputs_reference_genome["name"])
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
105 genome_name = sanitize_name_input(args.genome_name)
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
106
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
107 reference_genome = Fasta(input_fasta_file,
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
108 input_fasta_file_name, genome_name)
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
109
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
110 user_email = args.user_email
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
111
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
112
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
113 # TODO: Use a class to have a better management of the structure of these inputs
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
114 # These inputs are populated in the Galaxy Wrapper xml and are in this format:
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
115 # ARRAY[DICT{FILE_PATH: DICT{NAME: NAME_VALUE, EXTRA_DATA: EXTRA_DATA_VALUE}}]
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
116 # EXTRA_DATA could be anything, for example the index of a BAM => {"index", FILE_PATH}
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
117 array_inputs_bam = args.bam
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
118 array_inputs_bed_generic = args.bed
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
119 array_inputs_bed_simple_repeats = args.bedSimpleRepeats
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
120 array_inputs_bed_splice_junctions = args.bedSpliceJunctions
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
121 array_inputs_bigwig = args.bigwig
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
122 array_inputs_gff3 = args.gff3
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
123 array_inputs_gtf = args.gtf
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
124 array_inputs_psl = args.psl
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
125
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
126 outputFile = args.output
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
127
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
128 json_inputs_data = args.data_json
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
129
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
130 # TODO: Instead use a class to properly store the objects, with object_hook
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
131 inputs_data = json.loads(json_inputs_data)
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
132 # We remove the spaces in ["name"] of inputs_data
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
133 sanitize_name_inputs(inputs_data)
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
134
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
135 # TODO: Check here all the binaries / tools we need. Exception if missing
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
136
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
137 # Create the Track Hub folder
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
138 trackHub = TrackHub(reference_genome, user_email, outputFile, extra_files_path, toolDirectory)
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
139
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
140 all_datatype_dictionary = {}
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
141
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
142 for (inputs, datatype_class) in [
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
143 (array_inputs_bam, Bam),
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
144 (array_inputs_bed_generic, Bed),
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
145 (array_inputs_bigwig, BigWig),
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
146 (array_inputs_bed_simple_repeats, BedSimpleRepeats),
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
147 (array_inputs_bed_splice_junctions, BedSpliceJunctions),
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
148 (array_inputs_gff3, Gff3),
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
149 (array_inputs_gtf, Gtf),
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
150 (array_inputs_psl, Psl)]:
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
151 if inputs:
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
152 all_datatype_dictionary.update(create_ordered_datatype_objects(datatype_class, inputs, inputs_data))
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
153
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
154 # Create Ordered Dictionary to add the tracks in the tool form order
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
155 all_datatype_ordered_dictionary = collections.OrderedDict(all_datatype_dictionary)
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
156
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
157 logging.debug("----- End of all_datatype_dictionary processing -----")
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
158 logging.debug("all_datatype_ordered_dictionary keys are: {0}".format(all_datatype_ordered_dictionary.values()))
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
159
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
160 logging.debug("----- Beginning of Track adding processing -----")
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
161 for index, datatypeObject in all_datatype_ordered_dictionary.iteritems():
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
162 trackHub.addTrack(datatypeObject.track.trackDb)
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
163 logging.debug("----- End of Track adding processing -----")
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
164
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
165 # We process all the modifications to create the zip file
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
166 #trackHub.createZip()
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
167
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
168 # We terminate le process and so create a HTML file summarizing all the files
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
169 trackHub.terminate()
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
170
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
171 logging.debug('#### End of HubArchiveCreator Debug Mode: Bye! ####')
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
172
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
173 sys.exit(0)
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
174
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
175
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
176 def sanitize_name_input(string_to_sanitize):
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
177 """
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
178 Sanitize the string passed in parameter by replacing '/' and ' ' by '_'
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
179
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
180 :param string_to_sanitize:
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
181 :return :
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
182
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
183 :Example:
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
184
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
185 >>> sanitize_name_input('this/is an//example')
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
186 this_is_an__example
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
187 """
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
188 return string_to_sanitize \
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
189 .replace("/", "_") \
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
190 .replace(" ", "_")
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
191
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
192
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
193 def sanitize_name_inputs(inputs_data):
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
194 """
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
195 Sanitize value of the keys "name" of the dictionary passed in parameter.
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
196
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
197 Because sometimes output from Galaxy, or even just file name, from user inputs, have spaces.
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
198 Also, it can contain '/' character and could break the use of os.path function.
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
199
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
200 :param inputs_data: dict[string, dict[string, string]]
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
201 """
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
202 for key in inputs_data:
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
203 inputs_data[key]["name"] = sanitize_name_input(inputs_data[key]["name"])
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
204
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
205
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
206 def create_ordered_datatype_objects(ExtensionClass, array_inputs, inputs_data):
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
207 """
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
208 Function which executes the creation all the necessary files / folders for a special Datatype, for TrackHub
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
209 and update the dictionary of datatype
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
210
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
211 :param ExtensionClass:
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
212 :param array_inputs:
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
213 :param inputs_data:
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
214 :type ExtensionClass: Datatype
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
215 :type array_inputs: list[string]
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
216 :type inputs_data: dict
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
217 :rtype: dict
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
218 """
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
219
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
220 datatype_dictionary = {}
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
221
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
222 # TODO: Optimize this double loop
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
223 for input_false_path in array_inputs:
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
224 for key, data_value in inputs_data.items():
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
225 if key == input_false_path:
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
226 logging.debug("input_false_path: " + input_false_path)
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
227 logging.debug("data_value: " + str(data_value))
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
228 extensionObject = ExtensionClass(input_false_path, data_value)
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
229 datatype_dictionary.update({data_value["order_index"]: extensionObject})
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
230 return datatype_dictionary
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
231
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
232 def configure_logger(extra_files_path=None, debug=False):
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
233 if not extra_files_path:
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
234 raise Exception("Extra files path is not set. Stopping the application")
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
235
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
236
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
237 # All case log: log everything in a .log file
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
238 logger_file_name = ''.join([__name__, '.log'])
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
239 logging_file_path = os.path.join(extra_files_path, logger_file_name)
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
240
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
241 logging.basicConfig(filename=logging_file_path, level=logging.DEBUG)
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
242
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
243 log_stdout = logging.StreamHandler(sys.stdout)
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
244 if not debug:
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
245 configure_logger_user(log_stdout)
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
246 else:
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
247 configure_logger_dev(log_stdout)
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
248
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
249 # stderr configuration
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
250 configure_logger_stderr()
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
251
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
252 logging.debug('#### Welcome in HubArchiveCreator Debug Mode ####\n')
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
253
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
254 def configure_logger_user(log_stdout=None):
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
255 """
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
256 User Logger is defined as following:
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
257 - User needs to have WARN, ERROR and CRITICAL but well formatted / without traceback
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
258 in STDOUT
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
259 - Still access to full, brute and traceback for errors
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
260 in STDERR
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
261 - And further access to debug if needed
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
262 in .log
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
263
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
264 """
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
265
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
266 if not log_stdout:
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
267 raise Exception("No log_stdout given. Stopping the application")
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
268
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
269 # stdout for INFO / WARN / ERROR / CRITICAL
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
270 log_stdout.setLevel(logging.INFO)
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
271
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
272 formatter = TraceBackFormatter('%(message)s')
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
273
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
274 log_stdout.setFormatter(formatter)
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
275
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
276 logging.getLogger().addHandler(log_stdout)
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
277
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
278 def configure_logger_dev(log_stdout=None):
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
279 """
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
280 Dev Logger is defined as following:
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
281 - Dev needs to have WARN, ERROR and CRITICAL but well formatted / without traceback, in stdout
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
282 - Still access to full, brute and traceback in stderr for errors
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
283 - And further access to debug if needed
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
284
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
285 """
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
286 if not log_stdout:
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
287 raise Exception("No log_stdout given. Stopping the application")
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
288 log_format = '%(message)s'
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
289
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
290 # stdout and stderr and both identical for INFO / WARN / ERROR / CRITICAL
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
291 log_stdout.setLevel(logging.DEBUG)
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
292
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
293 formatter = logging.Formatter(log_format)
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
294
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
295 log_stdout.setFormatter(formatter)
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
296
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
297 logging.getLogger().addHandler(log_stdout)
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
298
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
299 def configure_logger_stderr():
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
300 """
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
301 Configure what should be logged in stderr
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
302 """
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
303 log_error = logging.StreamHandler(sys.stderr)
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
304 log_error.setLevel(logging.ERROR)
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
305 log_error_format = '%(message)s'
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
306
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
307 formatter_error = logging.Formatter(log_error_format)
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
308
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
309 log_error.setFormatter(formatter_error)
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
310
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
311 logging.getLogger().addHandler(log_error)
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
312
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
313 if __name__ == "__main__":
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
314 logging.getLogger(__name__)
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
315 main(sys.argv)