Mercurial > repos > dvanzessen > bcbio_nextgen_emc
comparison script.py @ 8:2e5223259a56 draft default tip
Uploaded
| author | dvanzessen |
|---|---|
| date | Tue, 21 Apr 2020 11:38:36 +0000 |
| parents | 2ed60a09d6b6 |
| children |
comparison
equal
deleted
inserted
replaced
| 7:7d5b46d41ff0 | 8:2e5223259a56 |
|---|---|
| 37 bed_file_path = bed_new_file_path | 37 bed_file_path = bed_new_file_path |
| 38 | 38 |
| 39 input_files = [] | 39 input_files = [] |
| 40 phenotype_counter = Counter() | 40 phenotype_counter = Counter() |
| 41 for input_file in input_files_raw: | 41 for input_file in input_files_raw: |
| 42 if input_file.find(":"): | 42 if input_file.count(":") == 1: # single end |
| 43 forward_file, phenotype = input_file.split(":") | |
| 44 phenotype_counter.update(phenotype) | |
| 45 phenotype_count = phenotype_counter[phenotype] | |
| 46 | |
| 47 forward_new_name = "{phenotype}_{phenotype_count}.fastq.gz".format(phenotype=phenotype, phenotype_count=phenotype_count) | |
| 48 forward_new_file_path = os.path.join( | |
| 49 workdir, | |
| 50 forward_new_name | |
| 51 ) | |
| 52 os.symlink(forward_file, forward_new_file_path) | |
| 53 | |
| 54 input_files.append( | |
| 55 { | |
| 56 "forward": forward_new_file_path, | |
| 57 "description": "{phenotype}_{phenotype_index}".format(phenotype=phenotype, phenotype_index=phenotype_count), | |
| 58 "phenotype": phenotype | |
| 59 } | |
| 60 ) | |
| 61 | |
| 62 elif input_file.count(":") == 2: # paired end | |
| 43 forward_file, reverse_file, phenotype = input_file.split(":") | 63 forward_file, reverse_file, phenotype = input_file.split(":") |
| 44 phenotype_counter.update(phenotype) | 64 phenotype_counter.update(phenotype) |
| 45 phenotype_count = phenotype_counter[phenotype] | 65 phenotype_count = phenotype_counter[phenotype] |
| 46 | 66 |
| 47 forward_new_name = "{phenotype}_{phenotype_count}_R1.fastq.gz".format(phenotype=phenotype, phenotype_count=phenotype_count) | 67 forward_new_name = "{phenotype}_{phenotype_count}_R1.fastq.gz".format(phenotype=phenotype, phenotype_count=phenotype_count) |
