From 4a923ef2d33d9d2c4e74fa8f7b107705ab5ad51a Mon Sep 17 00:00:00 2001 From: chengxin Dai <37200167+daichengxin@users.noreply.github.com> Date: Wed, 28 Jul 2021 17:06:24 +0800 Subject: [PATCH 1/2] Fix bug --- sdrf_pipelines/openms/openms.py | 49 ++++++++++++++++++++++----------- 1 file changed, 33 insertions(+), 16 deletions(-) diff --git a/sdrf_pipelines/openms/openms.py b/sdrf_pipelines/openms/openms.py index ae599d7..9bad809 100644 --- a/sdrf_pipelines/openms/openms.py +++ b/sdrf_pipelines/openms/openms.py @@ -387,6 +387,7 @@ def writeTwoTableExperimentalDesign(self, output_filename, sdrf, file2technical_ sample_id_map = {} sample_id = 1 pre_frac_group = 1 + raw_frac = {} for _0, row in sdrf.iterrows(): raw = row["comment[data file]"] source_name = row["source name"] @@ -399,16 +400,24 @@ def writeTwoTableExperimentalDesign(self, output_filename, sdrf, file2technical_ offset = offset + int(source_name2n_reps[source_name_list[i]]) fraction_group = offset + int(replicate) - if raw in Fraction_group.keys(): - if fraction_group < Fraction_group[raw]: + + if fraction_group not in raw_frac: + raw_frac[fraction_group] = [raw] + + if raw in Fraction_group.keys(): + if fraction_group < Fraction_group[raw]: + Fraction_group[raw] = fraction_group + else: Fraction_group[raw] = fraction_group - else: - Fraction_group[raw] = fraction_group - # make fraction group consecutive - if Fraction_group[raw] > pre_frac_group + 1: - Fraction_group[raw] = pre_frac_group + 1 - pre_frac_group = Fraction_group[raw] + # make fraction group consecutive + if Fraction_group[raw] > pre_frac_group + 1: + Fraction_group[raw] = pre_frac_group + 1 + pre_frac_group = Fraction_group[raw] + + else: + raw_frac[fraction_group].append(raw) + Fraction_group[raw] = Fraction_group[raw_frac[fraction_group][0]] if re.search(sample_identifier_re, source_name) is not None: sample = re.search(sample_identifier_re, source_name).group(1) @@ -553,6 +562,7 @@ def writeOneTableExperimentalDesign(self, output_filename, legacy, sdrf, file2te sample_id_map = {} sample_id = 1 pre_frac_group = 1 + raw_frac = {} for _0, row in sdrf.iterrows(): raw = row["comment[data file]"] source_name = row["source name"] @@ -566,16 +576,23 @@ def writeOneTableExperimentalDesign(self, output_filename, legacy, sdrf, file2te fraction_group = offset + int(replicate) - if raw in Fraction_group.keys(): - if fraction_group < Fraction_group[raw]: + if fraction_group not in raw_frac: + raw_frac[fraction_group] = [raw] + + if raw in Fraction_group.keys(): + if fraction_group < Fraction_group[raw]: + Fraction_group[raw] = fraction_group + else: Fraction_group[raw] = fraction_group - else: - Fraction_group[raw] = fraction_group - # make fraction group consecutive - if Fraction_group[raw] > pre_frac_group + 1: - Fraction_group[raw] = pre_frac_group + 1 - pre_frac_group = Fraction_group[raw] + # make fraction group consecutive + if Fraction_group[raw] > pre_frac_group + 1: + Fraction_group[raw] = pre_frac_group + 1 + pre_frac_group = Fraction_group[raw] + + else: + raw_frac[fraction_group].append(raw) + Fraction_group[raw] = Fraction_group[raw_frac[fraction_group][0]] if re.search(sample_identifier_re, source_name) is not None: sample = re.search(sample_identifier_re, source_name).group(1) From 0d29c51b252459a02bb73f2f7f569dadd9293484 Mon Sep 17 00:00:00 2001 From: chengxin Dai <37200167+daichengxin@users.noreply.github.com> Date: Wed, 28 Jul 2021 17:55:12 +0800 Subject: [PATCH 2/2] Update setup.py --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 2a8a56a..9b88a6d 100644 --- a/setup.py +++ b/setup.py @@ -6,7 +6,7 @@ setup( name="sdrf-pipelines", - version="0.0.17", + version="0.0.18", author="BigBio Team", author_email="ypriverol@gmail.com", description="Translate, convert SDRF to configuration pipelines",