Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
IMP
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
External wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
IMP-dev
IMP
Commits
d39b1cbf
Commit
d39b1cbf
authored
10 years ago
by
Yohan Jarosz
Browse files
Options
Downloads
Patches
Plain Diff
add possibility to uncompress bz2 files - fix #25
parent
5fbdd577
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Snakefile
+1
-0
1 addition, 0 deletions
Snakefile
rules/Preprocessing/master.rules
+12
-4
12 additions, 4 deletions
rules/Preprocessing/master.rules
with
13 additions
and
4 deletions
Snakefile
+
1
−
0
View file @
d39b1cbf
...
...
@@ -2,6 +2,7 @@ import os
import shutil
import gzip
import json
import bz2
from copy import deepcopy
...
...
This diff is collapsed.
Click to expand it.
rules/Preprocessing/master.rules
+
12
−
4
View file @
d39b1cbf
...
...
@@ -8,6 +8,9 @@ include:
"MT.rules"
CHUNK_SIZE = 100 * 1024
def preprocessing_output_files():
"""
Dynamically generate output files names based on parameters
...
...
@@ -74,10 +77,15 @@ def prepare_input_files(input, rtype):
print(inp, '=>', outfilename)
# ungunzip
if os.path.splitext(fname)[-1] in ['.gz', '.gzip']:
with open(outfilename, 'wb') as whandle:
with gzip.open(inp, 'rb') as rhandle:
whandle.write(rhandle.read())
# copy
with open(outfilename, 'wb') as whandle, gzip.open(inp, 'rb') as rhandle:
whandle.write(rhandle.read())
# unbzip2
elif os.path.splitext(fname)[-1] in ['.bz2', '.bzip2']:
dec = bz2.BZ2Decompressor()
with open(outfilename, 'wb') as whandle, open(inp, 'rb') as rhandle:
for data in iter(lambda: rhandle.read(CHUNK_SIZE), b''):
whandle.write(dec.decompress(data))
# copy
else:
shutil.copy(inp, outfilename)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment