# HG changeset patch # User dvanzessen # Date 1587469116 0 # Node ID 2e5223259a5649c0266a585bbb65daae5770ba01 # Parent 7d5b46d41ff00ec70e61e23b1109165df6d30016 Uploaded diff -r 7d5b46d41ff0 -r 2e5223259a56 script.py --- a/script.py Tue Apr 21 11:38:25 2020 +0000 +++ b/script.py Tue Apr 21 11:38:36 2020 +0000 @@ -39,7 +39,27 @@ input_files = [] phenotype_counter = Counter() for input_file in input_files_raw: - if input_file.find(":"): + if input_file.count(":") == 1: # single end + forward_file, phenotype = input_file.split(":") + phenotype_counter.update(phenotype) + phenotype_count = phenotype_counter[phenotype] + + forward_new_name = "{phenotype}_{phenotype_count}.fastq.gz".format(phenotype=phenotype, phenotype_count=phenotype_count) + forward_new_file_path = os.path.join( + workdir, + forward_new_name + ) + os.symlink(forward_file, forward_new_file_path) + + input_files.append( + { + "forward": forward_new_file_path, + "description": "{phenotype}_{phenotype_index}".format(phenotype=phenotype, phenotype_index=phenotype_count), + "phenotype": phenotype + } + ) + + elif input_file.count(":") == 2: # paired end forward_file, reverse_file, phenotype = input_file.split(":") phenotype_counter.update(phenotype) phenotype_count = phenotype_counter[phenotype] @@ -77,4 +97,4 @@ if __name__ == "__main__": - main() \ No newline at end of file + main()