Mercurial > repos > gga > apollo_iframe
annotate export.py @ 16:29159d9ce6f0 draft
"planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit 1f9a5502a7423c78d862e81537b7646c9f4da5d9"
author | gga |
---|---|
date | Fri, 10 Dec 2021 09:53:35 +0000 |
parents | 4a51a32cfecd |
children |
rev | line source |
---|---|
0
99b348a1d355
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff
changeset
|
1 #!/usr/bin/env python |
99b348a1d355
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff
changeset
|
2 from __future__ import print_function |
99b348a1d355
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff
changeset
|
3 |
99b348a1d355
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff
changeset
|
4 import argparse |
99b348a1d355
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff
changeset
|
5 import json |
10
c6172b538caf
"planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit 08015be1ee8a784e0619f961aaa724857debfd6f"
gga
parents:
5
diff
changeset
|
6 import time |
0
99b348a1d355
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff
changeset
|
7 |
10
c6172b538caf
"planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit 08015be1ee8a784e0619f961aaa724857debfd6f"
gga
parents:
5
diff
changeset
|
8 from apollo import accessible_organisms |
c6172b538caf
"planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit 08015be1ee8a784e0619f961aaa724857debfd6f"
gga
parents:
5
diff
changeset
|
9 from apollo.util import CnOrGuess, GuessCn |
0
99b348a1d355
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff
changeset
|
10 |
10
c6172b538caf
"planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit 08015be1ee8a784e0619f961aaa724857debfd6f"
gga
parents:
5
diff
changeset
|
11 from arrow.apollo import get_apollo_instance |
0
99b348a1d355
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff
changeset
|
12 |
10
c6172b538caf
"planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit 08015be1ee8a784e0619f961aaa724857debfd6f"
gga
parents:
5
diff
changeset
|
13 from webapollo import UserObj, handle_credentials |
0
99b348a1d355
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff
changeset
|
14 |
99b348a1d355
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff
changeset
|
15 if __name__ == '__main__': |
10
c6172b538caf
"planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit 08015be1ee8a784e0619f961aaa724857debfd6f"
gga
parents:
5
diff
changeset
|
16 parser = argparse.ArgumentParser(description='Script to export data from Apollo via web services') |
0
99b348a1d355
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff
changeset
|
17 CnOrGuess(parser) |
99b348a1d355
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff
changeset
|
18 parser.add_argument('--gff', type=argparse.FileType('w')) |
16
29159d9ce6f0
"planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit 1f9a5502a7423c78d862e81537b7646c9f4da5d9"
gga
parents:
13
diff
changeset
|
19 parser.add_argument('--gff_with_fasta', action='store_true') |
10
c6172b538caf
"planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit 08015be1ee8a784e0619f961aaa724857debfd6f"
gga
parents:
5
diff
changeset
|
20 parser.add_argument('--fasta_pep', type=argparse.FileType('w')) |
c6172b538caf
"planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit 08015be1ee8a784e0619f961aaa724857debfd6f"
gga
parents:
5
diff
changeset
|
21 parser.add_argument('--fasta_cds', type=argparse.FileType('w')) |
c6172b538caf
"planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit 08015be1ee8a784e0619f961aaa724857debfd6f"
gga
parents:
5
diff
changeset
|
22 parser.add_argument('--fasta_cdna', type=argparse.FileType('w')) |
c6172b538caf
"planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit 08015be1ee8a784e0619f961aaa724857debfd6f"
gga
parents:
5
diff
changeset
|
23 parser.add_argument('--vcf', type=argparse.FileType('w')) |
0
99b348a1d355
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff
changeset
|
24 parser.add_argument('--json', type=argparse.FileType('w')) |
16
29159d9ce6f0
"planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit 1f9a5502a7423c78d862e81537b7646c9f4da5d9"
gga
parents:
13
diff
changeset
|
25 parser.add_argument('--die', action='store_true') |
5
207c1c281360
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit 85194fa009ead2c34720faab61a4143fc29d17c2
gga
parents:
4
diff
changeset
|
26 parser.add_argument('email', help='User Email') |
0
99b348a1d355
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff
changeset
|
27 args = parser.parse_args() |
99b348a1d355
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff
changeset
|
28 |
10
c6172b538caf
"planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit 08015be1ee8a784e0619f961aaa724857debfd6f"
gga
parents:
5
diff
changeset
|
29 wa = get_apollo_instance() |
0
99b348a1d355
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff
changeset
|
30 |
5
207c1c281360
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit 85194fa009ead2c34720faab61a4143fc29d17c2
gga
parents:
4
diff
changeset
|
31 # User must have an apollo account, if not, create it |
10
c6172b538caf
"planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit 08015be1ee8a784e0619f961aaa724857debfd6f"
gga
parents:
5
diff
changeset
|
32 gx_user = UserObj(**wa.users._assert_or_create_user(args.email)) |
c6172b538caf
"planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit 08015be1ee8a784e0619f961aaa724857debfd6f"
gga
parents:
5
diff
changeset
|
33 handle_credentials(gx_user) |
c6172b538caf
"planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit 08015be1ee8a784e0619f961aaa724857debfd6f"
gga
parents:
5
diff
changeset
|
34 |
c6172b538caf
"planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit 08015be1ee8a784e0619f961aaa724857debfd6f"
gga
parents:
5
diff
changeset
|
35 org_cns, seqs = GuessCn(args, wa) |
c6172b538caf
"planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit 08015be1ee8a784e0619f961aaa724857debfd6f"
gga
parents:
5
diff
changeset
|
36 if not isinstance(org_cns, list): |
c6172b538caf
"planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit 08015be1ee8a784e0619f961aaa724857debfd6f"
gga
parents:
5
diff
changeset
|
37 org_cns = [org_cns] |
c6172b538caf
"planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit 08015be1ee8a784e0619f961aaa724857debfd6f"
gga
parents:
5
diff
changeset
|
38 |
c6172b538caf
"planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit 08015be1ee8a784e0619f961aaa724857debfd6f"
gga
parents:
5
diff
changeset
|
39 all_orgs = wa.organisms.get_organisms() |
c6172b538caf
"planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit 08015be1ee8a784e0619f961aaa724857debfd6f"
gga
parents:
5
diff
changeset
|
40 if 'error' in all_orgs: |
c6172b538caf
"planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit 08015be1ee8a784e0619f961aaa724857debfd6f"
gga
parents:
5
diff
changeset
|
41 all_orgs = [] |
c6172b538caf
"planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit 08015be1ee8a784e0619f961aaa724857debfd6f"
gga
parents:
5
diff
changeset
|
42 all_orgs = [org['commonName'] for org in all_orgs] |
5
207c1c281360
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit 85194fa009ead2c34720faab61a4143fc29d17c2
gga
parents:
4
diff
changeset
|
43 |
16
29159d9ce6f0
"planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit 1f9a5502a7423c78d862e81537b7646c9f4da5d9"
gga
parents:
13
diff
changeset
|
44 def error(message): |
29159d9ce6f0
"planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit 1f9a5502a7423c78d862e81537b7646c9f4da5d9"
gga
parents:
13
diff
changeset
|
45 if args.die: |
29159d9ce6f0
"planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit 1f9a5502a7423c78d862e81537b7646c9f4da5d9"
gga
parents:
13
diff
changeset
|
46 raise Exception(message) |
29159d9ce6f0
"planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit 1f9a5502a7423c78d862e81537b7646c9f4da5d9"
gga
parents:
13
diff
changeset
|
47 else: |
29159d9ce6f0
"planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit 1f9a5502a7423c78d862e81537b7646c9f4da5d9"
gga
parents:
13
diff
changeset
|
48 print(message) |
29159d9ce6f0
"planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit 1f9a5502a7423c78d862e81537b7646c9f4da5d9"
gga
parents:
13
diff
changeset
|
49 |
0
99b348a1d355
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff
changeset
|
50 org_data = [] |
10
c6172b538caf
"planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit 08015be1ee8a784e0619f961aaa724857debfd6f"
gga
parents:
5
diff
changeset
|
51 for org_cn in org_cns: |
c6172b538caf
"planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit 08015be1ee8a784e0619f961aaa724857debfd6f"
gga
parents:
5
diff
changeset
|
52 if org_cn not in all_orgs: |
c6172b538caf
"planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit 08015be1ee8a784e0619f961aaa724857debfd6f"
gga
parents:
5
diff
changeset
|
53 raise Exception("Could not find organism %s" % org_cn) |
c6172b538caf
"planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit 08015be1ee8a784e0619f961aaa724857debfd6f"
gga
parents:
5
diff
changeset
|
54 |
c6172b538caf
"planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit 08015be1ee8a784e0619f961aaa724857debfd6f"
gga
parents:
5
diff
changeset
|
55 orgs = accessible_organisms(gx_user, [org_cn], 'READ') |
c6172b538caf
"planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit 08015be1ee8a784e0619f961aaa724857debfd6f"
gga
parents:
5
diff
changeset
|
56 if not orgs: |
c6172b538caf
"planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit 08015be1ee8a784e0619f961aaa724857debfd6f"
gga
parents:
5
diff
changeset
|
57 raise Exception("You do not have read permission on organism %s" % org_cn) |
c6172b538caf
"planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit 08015be1ee8a784e0619f961aaa724857debfd6f"
gga
parents:
5
diff
changeset
|
58 |
c6172b538caf
"planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit 08015be1ee8a784e0619f961aaa724857debfd6f"
gga
parents:
5
diff
changeset
|
59 org = wa.organisms.show_organism(org_cn) |
c6172b538caf
"planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit 08015be1ee8a784e0619f961aaa724857debfd6f"
gga
parents:
5
diff
changeset
|
60 |
16
29159d9ce6f0
"planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit 1f9a5502a7423c78d862e81537b7646c9f4da5d9"
gga
parents:
13
diff
changeset
|
61 # Fetch all the refseqs |
29159d9ce6f0
"planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit 1f9a5502a7423c78d862e81537b7646c9f4da5d9"
gga
parents:
13
diff
changeset
|
62 realSeqs = wa.organisms.get_sequences(org['id']) |
10
c6172b538caf
"planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit 08015be1ee8a784e0619f961aaa724857debfd6f"
gga
parents:
5
diff
changeset
|
63 |
16
29159d9ce6f0
"planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit 1f9a5502a7423c78d862e81537b7646c9f4da5d9"
gga
parents:
13
diff
changeset
|
64 # We'll loop over them individually for decreased memory pressure |
29159d9ce6f0
"planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit 1f9a5502a7423c78d862e81537b7646c9f4da5d9"
gga
parents:
13
diff
changeset
|
65 for sequence in realSeqs['sequences']: |
29159d9ce6f0
"planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit 1f9a5502a7423c78d862e81537b7646c9f4da5d9"
gga
parents:
13
diff
changeset
|
66 print("Downloading", sequence) |
10
c6172b538caf
"planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit 08015be1ee8a784e0619f961aaa724857debfd6f"
gga
parents:
5
diff
changeset
|
67 |
16
29159d9ce6f0
"planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit 1f9a5502a7423c78d862e81537b7646c9f4da5d9"
gga
parents:
13
diff
changeset
|
68 try: |
29159d9ce6f0
"planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit 1f9a5502a7423c78d862e81537b7646c9f4da5d9"
gga
parents:
13
diff
changeset
|
69 uuid_gff = wa.io.write_downloadable(org['commonName'], 'GFF3', export_gff3_fasta=args.gff_with_fasta, sequences=[sequence['name']]) |
29159d9ce6f0
"planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit 1f9a5502a7423c78d862e81537b7646c9f4da5d9"
gga
parents:
13
diff
changeset
|
70 if 'error' in uuid_gff or 'uuid' not in uuid_gff: |
29159d9ce6f0
"planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit 1f9a5502a7423c78d862e81537b7646c9f4da5d9"
gga
parents:
13
diff
changeset
|
71 error("Apollo failed to prepare the GFF3 file for download: %s" % uuid_gff) |
29159d9ce6f0
"planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit 1f9a5502a7423c78d862e81537b7646c9f4da5d9"
gga
parents:
13
diff
changeset
|
72 args.gff.write(wa.io.download(uuid_gff['uuid'], output_format="text")) |
29159d9ce6f0
"planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit 1f9a5502a7423c78d862e81537b7646c9f4da5d9"
gga
parents:
13
diff
changeset
|
73 time.sleep(1) |
29159d9ce6f0
"planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit 1f9a5502a7423c78d862e81537b7646c9f4da5d9"
gga
parents:
13
diff
changeset
|
74 except Exception as e: |
29159d9ce6f0
"planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit 1f9a5502a7423c78d862e81537b7646c9f4da5d9"
gga
parents:
13
diff
changeset
|
75 error(e) |
10
c6172b538caf
"planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit 08015be1ee8a784e0619f961aaa724857debfd6f"
gga
parents:
5
diff
changeset
|
76 |
16
29159d9ce6f0
"planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit 1f9a5502a7423c78d862e81537b7646c9f4da5d9"
gga
parents:
13
diff
changeset
|
77 try: |
29159d9ce6f0
"planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit 1f9a5502a7423c78d862e81537b7646c9f4da5d9"
gga
parents:
13
diff
changeset
|
78 uuid_vcf = wa.io.write_downloadable(org['commonName'], 'VCF', sequences=[sequence['name']]) |
29159d9ce6f0
"planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit 1f9a5502a7423c78d862e81537b7646c9f4da5d9"
gga
parents:
13
diff
changeset
|
79 if 'error' in uuid_vcf or 'uuid' not in uuid_vcf: |
29159d9ce6f0
"planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit 1f9a5502a7423c78d862e81537b7646c9f4da5d9"
gga
parents:
13
diff
changeset
|
80 error("Apollo failed to prepare the VCF file for download: %s" % uuid_vcf) |
29159d9ce6f0
"planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit 1f9a5502a7423c78d862e81537b7646c9f4da5d9"
gga
parents:
13
diff
changeset
|
81 args.vcf.write(wa.io.download(uuid_vcf['uuid'], output_format="text")) |
29159d9ce6f0
"planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit 1f9a5502a7423c78d862e81537b7646c9f4da5d9"
gga
parents:
13
diff
changeset
|
82 time.sleep(1) |
29159d9ce6f0
"planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit 1f9a5502a7423c78d862e81537b7646c9f4da5d9"
gga
parents:
13
diff
changeset
|
83 except Exception as e: |
29159d9ce6f0
"planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit 1f9a5502a7423c78d862e81537b7646c9f4da5d9"
gga
parents:
13
diff
changeset
|
84 error(e) |
10
c6172b538caf
"planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit 08015be1ee8a784e0619f961aaa724857debfd6f"
gga
parents:
5
diff
changeset
|
85 |
16
29159d9ce6f0
"planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit 1f9a5502a7423c78d862e81537b7646c9f4da5d9"
gga
parents:
13
diff
changeset
|
86 try: |
29159d9ce6f0
"planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit 1f9a5502a7423c78d862e81537b7646c9f4da5d9"
gga
parents:
13
diff
changeset
|
87 uuid_fa = wa.io.write_downloadable(org['commonName'], 'FASTA', sequences=[sequence['name']], seq_type='cdna') |
29159d9ce6f0
"planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit 1f9a5502a7423c78d862e81537b7646c9f4da5d9"
gga
parents:
13
diff
changeset
|
88 if 'error' in uuid_fa or 'uuid' not in uuid_fa: |
29159d9ce6f0
"planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit 1f9a5502a7423c78d862e81537b7646c9f4da5d9"
gga
parents:
13
diff
changeset
|
89 error("Apollo failed to prepare the cdna FASTA file for download: %s" % uuid_fa) |
29159d9ce6f0
"planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit 1f9a5502a7423c78d862e81537b7646c9f4da5d9"
gga
parents:
13
diff
changeset
|
90 args.fasta_cdna.write(wa.io.download(uuid_fa['uuid'], output_format="text")) |
29159d9ce6f0
"planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit 1f9a5502a7423c78d862e81537b7646c9f4da5d9"
gga
parents:
13
diff
changeset
|
91 time.sleep(1) |
29159d9ce6f0
"planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit 1f9a5502a7423c78d862e81537b7646c9f4da5d9"
gga
parents:
13
diff
changeset
|
92 except Exception as e: |
29159d9ce6f0
"planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit 1f9a5502a7423c78d862e81537b7646c9f4da5d9"
gga
parents:
13
diff
changeset
|
93 error(e) |
10
c6172b538caf
"planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit 08015be1ee8a784e0619f961aaa724857debfd6f"
gga
parents:
5
diff
changeset
|
94 |
16
29159d9ce6f0
"planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit 1f9a5502a7423c78d862e81537b7646c9f4da5d9"
gga
parents:
13
diff
changeset
|
95 try: |
29159d9ce6f0
"planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit 1f9a5502a7423c78d862e81537b7646c9f4da5d9"
gga
parents:
13
diff
changeset
|
96 uuid_fa = wa.io.write_downloadable(org['commonName'], 'FASTA', sequences=[sequence['name']], seq_type='cds') |
29159d9ce6f0
"planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit 1f9a5502a7423c78d862e81537b7646c9f4da5d9"
gga
parents:
13
diff
changeset
|
97 if 'error' in uuid_fa or 'uuid' not in uuid_fa: |
29159d9ce6f0
"planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit 1f9a5502a7423c78d862e81537b7646c9f4da5d9"
gga
parents:
13
diff
changeset
|
98 error("Apollo failed to prepare the cds FASTA file for download: %s" % uuid_fa) |
29159d9ce6f0
"planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit 1f9a5502a7423c78d862e81537b7646c9f4da5d9"
gga
parents:
13
diff
changeset
|
99 args.fasta_cds.write(wa.io.download(uuid_fa['uuid'], output_format="text")) |
29159d9ce6f0
"planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit 1f9a5502a7423c78d862e81537b7646c9f4da5d9"
gga
parents:
13
diff
changeset
|
100 time.sleep(1) |
29159d9ce6f0
"planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit 1f9a5502a7423c78d862e81537b7646c9f4da5d9"
gga
parents:
13
diff
changeset
|
101 except Exception as e: |
29159d9ce6f0
"planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit 1f9a5502a7423c78d862e81537b7646c9f4da5d9"
gga
parents:
13
diff
changeset
|
102 error(e) |
10
c6172b538caf
"planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit 08015be1ee8a784e0619f961aaa724857debfd6f"
gga
parents:
5
diff
changeset
|
103 |
16
29159d9ce6f0
"planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit 1f9a5502a7423c78d862e81537b7646c9f4da5d9"
gga
parents:
13
diff
changeset
|
104 try: |
29159d9ce6f0
"planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit 1f9a5502a7423c78d862e81537b7646c9f4da5d9"
gga
parents:
13
diff
changeset
|
105 uuid_fa = wa.io.write_downloadable(org['commonName'], 'FASTA', sequences=[sequence['name']], seq_type='peptide') |
29159d9ce6f0
"planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit 1f9a5502a7423c78d862e81537b7646c9f4da5d9"
gga
parents:
13
diff
changeset
|
106 if 'error' in uuid_fa or 'uuid' not in uuid_fa: |
29159d9ce6f0
"planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit 1f9a5502a7423c78d862e81537b7646c9f4da5d9"
gga
parents:
13
diff
changeset
|
107 error("Apollo failed to prepare the file for download: %s" % uuid_fa) |
29159d9ce6f0
"planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit 1f9a5502a7423c78d862e81537b7646c9f4da5d9"
gga
parents:
13
diff
changeset
|
108 args.fasta_pep.write(wa.io.download(uuid_fa['uuid'], output_format="text")) |
29159d9ce6f0
"planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit 1f9a5502a7423c78d862e81537b7646c9f4da5d9"
gga
parents:
13
diff
changeset
|
109 time.sleep(1) |
29159d9ce6f0
"planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit 1f9a5502a7423c78d862e81537b7646c9f4da5d9"
gga
parents:
13
diff
changeset
|
110 except Exception as e: |
29159d9ce6f0
"planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit 1f9a5502a7423c78d862e81537b7646c9f4da5d9"
gga
parents:
13
diff
changeset
|
111 error(e) |
10
c6172b538caf
"planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit 08015be1ee8a784e0619f961aaa724857debfd6f"
gga
parents:
5
diff
changeset
|
112 |
16
29159d9ce6f0
"planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit 1f9a5502a7423c78d862e81537b7646c9f4da5d9"
gga
parents:
13
diff
changeset
|
113 org_data.append(org) |
10
c6172b538caf
"planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit 08015be1ee8a784e0619f961aaa724857debfd6f"
gga
parents:
5
diff
changeset
|
114 |
0
99b348a1d355
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff
changeset
|
115 args.json.write(json.dumps(org_data, indent=2)) |