Skip to content

Commit

Permalink
Add parent folder before unpacking HIVSeqinR working files, as part of
Browse files Browse the repository at this point in the history
  • Loading branch information
donkirkby committed May 5, 2021
1 parent f849241 commit 7891db2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
Binary file added docs/favicon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 6 additions & 2 deletions micall/monitor/kive_watcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@
'outcome_summary_csv', # proviral outputs
'conseqs_primers_csv',
'contigs_primers_csv',
'table_precursor_csv']
'table_precursor_csv',
'hivseqinr_results_tar']

# noinspection PyArgumentList
FolderEventType = Enum('FolderEventType', 'ADD_SAMPLE FINISH_FOLDER')
Expand Down Expand Up @@ -706,14 +707,17 @@ def extract_archive(folder_watcher: FolderWatcher,
sample_name = trim_name(sample_name)
source_path = scratch_path / sample_name / (archive_name + '.tar')
try:
sample_target_path = output_path / sample_name
sample_target_path.mkdir(exist_ok=True)
with tarfile.open(source_path) as f:
for source_info in f:
filename = os.path.basename(source_info.name)
target_path = output_path / sample_name / filename
target_path = sample_target_path / filename
assert not target_path.exists(), target_path
with f.extractfile(source_info) as source, \
open(target_path, 'wb') as target:
shutil.copyfileobj(source, target)
remove_empty_directory(sample_target_path)
except FileNotFoundError:
pass
remove_empty_directory(output_path)
Expand Down

0 comments on commit 7891db2

Please sign in to comment.