comparison export.py @ 5:f7e9c792047b draft

planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit 85194fa009ead2c34720faab61a4143fc29d17c2
author gga
date Fri, 31 Aug 2018 09:34:42 -0400
parents 40b26f8269a3
children df0e4eb2dfa5
comparison
equal deleted inserted replaced
4:40b26f8269a3 5:f7e9c792047b
7 7
8 from BCBio import GFF 8 from BCBio import GFF
9 9
10 from Bio import SeqIO 10 from Bio import SeqIO
11 11
12 from webapollo import CnOrGuess, GuessCn, WAAuth, WebApolloInstance 12 from webapollo import CnOrGuess, GuessCn, PermissionCheck, WAAuth, WebApolloInstance
13 13
14 try: 14 try:
15 import StringIO as io 15 import StringIO as io
16 except ImportError: 16 except ImportError:
17 import io 17 import io
69 WAAuth(parser) 69 WAAuth(parser)
70 CnOrGuess(parser) 70 CnOrGuess(parser)
71 parser.add_argument('--gff', type=argparse.FileType('w')) 71 parser.add_argument('--gff', type=argparse.FileType('w'))
72 parser.add_argument('--fasta', type=argparse.FileType('w')) 72 parser.add_argument('--fasta', type=argparse.FileType('w'))
73 parser.add_argument('--json', type=argparse.FileType('w')) 73 parser.add_argument('--json', type=argparse.FileType('w'))
74 74 parser.add_argument('email', help='User Email')
75 args = parser.parse_args() 75 args = parser.parse_args()
76 76
77 wa = WebApolloInstance(args.apollo, args.username, args.password) 77 wa = WebApolloInstance(args.apollo, args.username, args.password)
78 78
79 org_cn_list, seqs = GuessCn(args, wa) 79 org_cn_list, seqs = GuessCn(args, wa)
80 80
81 # User must have an apollo account, if not, create it
82 gx_user = wa.users.assertOrCreateUser(args.email)
83
81 org_data = [] 84 org_data = []
82 for org_cn in org_cn_list: 85 for org_cn in org_cn_list:
86 # User must have read permission on organism
87 if not PermissionCheck(gx_user, org_cn, "READ"):
88 continue
83 indiv_org_data = export(org_cn, seqs) 89 indiv_org_data = export(org_cn, seqs)
84 org_data.append(indiv_org_data) 90 org_data.append(indiv_org_data)
85 args.json.write(json.dumps(org_data, indent=2)) 91 args.json.write(json.dumps(org_data, indent=2))