annotate export.py @ 16:12ebb583b8a3 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:52:37 +0000
parents bb562d95b6cd
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
5aa3bc8d0253 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
5aa3bc8d0253 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
5aa3bc8d0253 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
3
5aa3bc8d0253 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
5aa3bc8d0253 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
5d1cf95ade8a "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
5aa3bc8d0253 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
7
10
5d1cf95ade8a "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
5d1cf95ade8a "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
5aa3bc8d0253 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
10
10
5d1cf95ade8a "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
5aa3bc8d0253 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
12
10
5d1cf95ade8a "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
5aa3bc8d0253 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
14
5aa3bc8d0253 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
5d1cf95ade8a "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
5aa3bc8d0253 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)
5aa3bc8d0253 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
12ebb583b8a3 "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
5d1cf95ade8a "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'))
5d1cf95ade8a "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'))
5d1cf95ade8a "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'))
5d1cf95ade8a "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
5aa3bc8d0253 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
12ebb583b8a3 "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
cc098732daf6 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
5aa3bc8d0253 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()
5aa3bc8d0253 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
28
10
5d1cf95ade8a "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
5aa3bc8d0253 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
30
5
cc098732daf6 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
5d1cf95ade8a "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))
5d1cf95ade8a "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)
5d1cf95ade8a "planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit 08015be1ee8a784e0619f961aaa724857debfd6f"
gga
parents: 5
diff changeset
34
5d1cf95ade8a "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)
5d1cf95ade8a "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):
5d1cf95ade8a "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]
5d1cf95ade8a "planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit 08015be1ee8a784e0619f961aaa724857debfd6f"
gga
parents: 5
diff changeset
38
5d1cf95ade8a "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()
5d1cf95ade8a "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:
5d1cf95ade8a "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 = []
5d1cf95ade8a "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
cc098732daf6 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
12ebb583b8a3 "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):
12ebb583b8a3 "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:
12ebb583b8a3 "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)
12ebb583b8a3 "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:
12ebb583b8a3 "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)
12ebb583b8a3 "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
5aa3bc8d0253 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
5d1cf95ade8a "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:
5d1cf95ade8a "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:
5d1cf95ade8a "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)
5d1cf95ade8a "planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit 08015be1ee8a784e0619f961aaa724857debfd6f"
gga
parents: 5
diff changeset
54
5d1cf95ade8a "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')
5d1cf95ade8a "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:
5d1cf95ade8a "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)
5d1cf95ade8a "planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit 08015be1ee8a784e0619f961aaa724857debfd6f"
gga
parents: 5
diff changeset
58
5d1cf95ade8a "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)
5d1cf95ade8a "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
12ebb583b8a3 "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
12ebb583b8a3 "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
5d1cf95ade8a "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
12ebb583b8a3 "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
12ebb583b8a3 "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']:
12ebb583b8a3 "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
5d1cf95ade8a "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
12ebb583b8a3 "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:
12ebb583b8a3 "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']])
12ebb583b8a3 "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:
12ebb583b8a3 "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)
12ebb583b8a3 "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"))
12ebb583b8a3 "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)
12ebb583b8a3 "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:
12ebb583b8a3 "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
5d1cf95ade8a "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
12ebb583b8a3 "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:
12ebb583b8a3 "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']])
12ebb583b8a3 "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:
12ebb583b8a3 "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)
12ebb583b8a3 "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"))
12ebb583b8a3 "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)
12ebb583b8a3 "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:
12ebb583b8a3 "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
5d1cf95ade8a "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
12ebb583b8a3 "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:
12ebb583b8a3 "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')
12ebb583b8a3 "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:
12ebb583b8a3 "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)
12ebb583b8a3 "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"))
12ebb583b8a3 "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)
12ebb583b8a3 "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:
12ebb583b8a3 "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
5d1cf95ade8a "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
12ebb583b8a3 "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:
12ebb583b8a3 "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')
12ebb583b8a3 "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:
12ebb583b8a3 "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)
12ebb583b8a3 "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"))
12ebb583b8a3 "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)
12ebb583b8a3 "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:
12ebb583b8a3 "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
5d1cf95ade8a "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
12ebb583b8a3 "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:
12ebb583b8a3 "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')
12ebb583b8a3 "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:
12ebb583b8a3 "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)
12ebb583b8a3 "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"))
12ebb583b8a3 "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)
12ebb583b8a3 "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:
12ebb583b8a3 "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
5d1cf95ade8a "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
12ebb583b8a3 "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
5d1cf95ade8a "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
5aa3bc8d0253 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))