Skip to content

Commit

Permalink
Merge pull request #96 from daichengxin/master
Browse files Browse the repository at this point in the history
Fix bug
  • Loading branch information
ypriverol authored Jul 28, 2021
2 parents 1e28afa + 0d29c51 commit 9902bd0
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 17 deletions.
49 changes: 33 additions & 16 deletions sdrf_pipelines/openms/openms.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand All @@ -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)
Expand Down Expand Up @@ -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"]
Expand All @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 9902bd0

Please sign in to comment.