From 7f3f0388ab06a5e7b7c7f2b8bab58e616dea06d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Koray=20K=C4=B1rl=C4=B1?= Date: Fri, 31 May 2019 18:51:40 -0400 Subject: [PATCH] convert links to first alias, add symlink for rows with only paired_end --- wranglertools/import_data.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/wranglertools/import_data.py b/wranglertools/import_data.py index 338c8034..6d871330 100755 --- a/wranglertools/import_data.py +++ b/wranglertools/import_data.py @@ -978,9 +978,16 @@ def check_file_pairing(fastq_row): main = False else: files[an_alias] = {'symlink': aliases[0]} - + # If there are rows without the pair link (expecting link in the other file, FF mirrors the links after post) if not saw_pair and paired_end: - files[aliases[0]] = {'end': paired_end} + main = True + for an_alias in aliases: + # if this is the first alias, put all info in the dict + if main: + files[an_alias] = {'end': paired_end} + main = False + else: + files[an_alias] = {'symlink': aliases[0]} for f, info in sorted(files.items()): # sorted purely for testing # skip the aliases that are secondary if info.get('symlink'): @@ -994,6 +1001,7 @@ def check_file_pairing(fastq_row): # if the linked one is an symlink, go the the main one if files[fp].get('symlink'): fp = files[fp]['symlink'] + files[f]['pair'] = fp # Paired file might not have the mirroring pair info, FF creates that automatically if not files[fp].get('pair'): files[fp]['pair'] = f