Mercurial > repos > eric-rasche > gsaf_downloader
comparison gsaf_download.py @ 4:a90d7b00d727 draft default tip
Removed testing code
author | eric-rasche |
---|---|
date | Fri, 05 Dec 2014 14:38:00 -0500 |
parents | ba70ea57cef9 |
children |
comparison
equal
deleted
inserted
replaced
3:ba70ea57cef9 | 4:a90d7b00d727 |
---|---|
38 # "reads":["Sample10_S8_L001_R1_001.fastq.gz","Sample10_S8_L001_R2_001.fastq.gz"], | 38 # "reads":["Sample10_S8_L001_R1_001.fastq.gz","Sample10_S8_L001_R2_001.fastq.gz"], |
39 # "SA":"***"} | 39 # "SA":"***"} |
40 data = json.loads(gsafjson) | 40 data = json.loads(gsafjson) |
41 log.info("Fetching %s" % data['filename']) | 41 log.info("Fetching %s" % data['filename']) |
42 file_path = os.path.join('output', data['filename']) | 42 file_path = os.path.join('output', data['filename']) |
43 #urllib.urlretrieve(data['url'], file_path) | 43 urllib.urlretrieve(data['url'], file_path) |
44 log.info("Hashing file") | 44 log.info("Hashing file") |
45 #file_md5 = hashlib.md5(open(file_path).read()).hexdigest() | 45 file_md5 = hashlib.md5(open(file_path).read()).hexdigest() |
46 #log.debug("Hashed to %s" % file_md5) | 46 log.debug("Hashed to %s" % file_md5) |
47 | 47 |
48 stderr = '' | 48 stderr = '' |
49 #if file_md5 != data['md5']: | 49 if file_md5 != data['md5']: |
50 #stderr = 'md5sum mismatch: %s != %s' % (file_md5, data['md5']) | 50 stderr = 'md5sum mismatch: %s != %s' % (file_md5, data['md5']) |
51 | 51 |
52 # Galaxy.json | 52 # Galaxy.json |
53 # {"name": "lambda.fa", "stdout": "uploaded fasta file", "line_count": 811, "ext": "fasta", "dataset_id": 16220, "type": "dataset"} | 53 # {"name": "lambda.fa", "stdout": "uploaded fasta file", "line_count": 811, "ext": "fasta", "dataset_id": 16220, "type": "dataset"} |
54 line_count = subprocess.check_output(['wc', '-l', file_path]).strip() | 54 line_count = subprocess.check_output(['wc', '-l', file_path]).strip() |
55 line_count = line_count[0:line_count.index(' ')] | 55 line_count = line_count[0:line_count.index(' ')] |
63 'ext': data['file_type'].strip('.gz'), | 63 'ext': data['file_type'].strip('.gz'), |
64 'dataset_id': DATASET_ID, | 64 'dataset_id': DATASET_ID, |
65 'type': 'dataset' | 65 'type': 'dataset' |
66 } | 66 } |
67 | 67 |
68 #try: | 68 try: |
69 #subprocess.check_call(['gunzip', file_path]) | 69 subprocess.check_call(['gunzip', file_path]) |
70 #except: | 70 except: |
71 #log.error("Couldn't extract %s" % data['filename']) | 71 log.error("Couldn't extract %s" % data['filename']) |
72 | 72 |
73 gx_json.write(json.dumps(galaxy_json) + "\n") | 73 gx_json.write(json.dumps(galaxy_json) + "\n") |
74 | 74 |