Mercurial > repos > yating-l > jbrowsearchivecreator
comparison util/subtools.py @ 32:7b955a58d8f2 draft
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 18da3c5b92673ba5030c24c981c6ca7ebe0bf097-dirty
| author | yating-l |
|---|---|
| date | Fri, 20 Oct 2017 11:22:21 -0400 |
| parents | 127037c49bc8 |
| children | 68466f5064ce |
comparison
equal
deleted
inserted
replaced
| 31:127037c49bc8 | 32:7b955a58d8f2 |
|---|---|
| 328 if tab: | 328 if tab: |
| 329 array_call.append('-tab') | 329 array_call.append('-tab') |
| 330 p = _handleExceptionAndCheckCall(array_call) | 330 p = _handleExceptionAndCheckCall(array_call) |
| 331 return p | 331 return p |
| 332 | 332 |
| 333 def arrow_add_organism(organism_name, organism_dir, public=False): | |
| 334 array_call = ['arrow', 'organisms', 'add_organism', organism_name, organism_dir] | |
| 335 if public: | |
| 336 array_call.append('--public') | |
| 337 p = subprocess.check_output(array_call) | |
| 338 return p | |
| 339 | |
| 340 def arrow_create_user(user_email, firstname, lastname, password, admin=False): | |
| 341 """ Create a new user of Apollo, the default user_role is "user" """ | |
| 342 array_call = ['arrow', 'users', 'create_user', user_email, firstname, lastname, password] | |
| 343 if admin: | |
| 344 array_call += ['--role', 'admin'] | |
| 345 logging.debug("%s", array_call) | |
| 346 print array_call | |
| 347 p = subprocess.check_output(array_call) | |
| 348 print ("p = %s", p) | |
| 349 return p | |
| 350 | |
| 351 def arrow_update_organism_permissions(user_id, organism, **user_permissions): | |
| 352 array_call = ['arrow', 'users', 'update_organism_permissions', str(user_id), str(organism)] | |
| 353 admin = user_permissions.get("admin", False) | |
| 354 write = user_permissions.get("write", False) | |
| 355 read = user_permissions.get("read", False) | |
| 356 export = user_permissions.get("export", False) | |
| 357 if admin: | |
| 358 array_call.append('--administrate') | |
| 359 if write: | |
| 360 array_call.append('--write') | |
| 361 if read: | |
| 362 array_call.append('--read') | |
| 363 if export: | |
| 364 array_call.append('--export') | |
| 365 p = subprocess.check_output(array_call) | |
| 366 return p | |
| 367 | |
| 368 def arrow_get_users(user_email): | |
| 369 array_call = ['arrow', 'users', 'get_users'] | |
| 370 logging.debug("%s", array_call) | |
| 371 print array_call | |
| 372 p = subprocess.check_output(array_call) | |
| 373 all_users = json.loads(p) | |
| 374 for d in all_users: | |
| 375 if d['username'] == user_email: | |
| 376 return d['userId'] | |
| 377 logging.error("Cannot find user %s", user_email) | |
| 378 |
