comparison idr_download_by_ids.py @ 5:e08b1dc0480c draft

"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/idr_download commit 5b2ba6c849aa344470fe1bb25f063dc3f8f790ae"
author iuc
date Mon, 08 Jun 2020 08:36:41 -0400
parents 11036f6197d6
children 5c743356df83
comparison
equal deleted inserted replaced
4:11036f6197d6 5:e08b1dc0480c
1 import argparse 1 import argparse
2 import os 2 import os
3 import sys 3 import sys
4 import tarfile 4 import tarfile
5 import time
6 from tempfile import TemporaryFile
5 7
6 from libtiff import TIFF 8 from libtiff import TIFF
7 from PIL import Image 9 from PIL import Image
8 from tempfile import TemporaryFile
9 from omero.gateway import BlitzGateway # noqa 10 from omero.gateway import BlitzGateway # noqa
10 from omero.constants.namespaces import NSBULKANNOTATIONS # noqa 11 from omero.constants.namespaces import NSBULKANNOTATIONS # noqa
11 12
12 13
13 def warn(message, image_identifier, warn_skip=False): 14 def warn(message, image_identifier, warn_skip=False):
279 with TemporaryFile() as buf: 280 with TemporaryFile() as buf:
280 tar_img.save(buf, format='TIFF') 281 tar_img.save(buf, format='TIFF')
281 tarinfo = tarfile.TarInfo(name=fname) 282 tarinfo = tarfile.TarInfo(name=fname)
282 buf.seek(0, 2) 283 buf.seek(0, 2)
283 tarinfo.size = buf.tell() 284 tarinfo.size = buf.tell()
285 tarinfo.mtime = time.time()
284 buf.seek(0) 286 buf.seek(0)
285 archive.addfile(tarinfo=tarinfo, fileobj=buf) 287 archive.addfile(tarinfo=tarinfo, fileobj=buf)
286 else: # save image as individual file 288 else: # save image as individual file
287 try: 289 try:
288 tiff = TIFF.open(fname, mode='w') 290 tiff = TIFF.open(fname, mode='w')