Skip to content

Commit

Permalink
previous fix for get_result_sets
Browse files Browse the repository at this point in the history
  • Loading branch information
oganm committed Aug 8, 2024
1 parent 79bad68 commit 2e22c2e
Showing 1 changed file with 28 additions and 12 deletions.
40 changes: 28 additions & 12 deletions gemmapy/_processors.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,15 +157,15 @@ def add_missing(x):

relevant_ids = [x for x in ids if not any(sub.list_in_list(x, baseline_ids))]

def get_factor_vals(x):
vals = sub.access_field(x,'values')
def get_factor_vals(y):
vals = sub.access_field(y,'values')
out = sub.process_FactorValueValueObject_list(vals)
out.factor_ID = x.id
out.factor_category = x.category
out.factor_category_URI = x.category_uri
out.factor_ID = y.id
out.factor_category = y.category
out.factor_category_URI = y.category_uri
return out

all_factors = pd.concat([get_factor_vals(x) for x in exp_factors])
all_factors = pd.concat([get_factor_vals(y) for y in exp_factors])



Expand Down Expand Up @@ -239,8 +239,19 @@ def process_DifferentialExpressionAnalysisResultSetValueObject(d:list,api):
size = len(contrast_id)

experimental_factors = [sub.process_FactorValueValueObject(x) for x in non_control_factors]


factor_ID = x.experimental_factors[0].id
factor_category = x.experimental_factors[0].category
factor_category_URI = x.experimental_factors[0].category_uri

def add_missing(x):
x.factor_ID = factor_ID
x.factor_category = factor_category
x.factor_category_URI = factor_category_URI
return x

experimental_factors = [add_missing(x) for x in experimental_factors]

baseline_factors = sub.process_FactorValueBasicValueObject(x.baseline_group)

else:
Expand All @@ -265,11 +276,16 @@ def process_DifferentialExpressionAnalysisResultSetValueObject(d:list,api):

relevant_ids = [x for x in ids if not any(sub.list_in_list(x, baseline_ids))]

fac_vals = [sub.access_field(y,'values') for y in x.experimental_factors]
all_factors = pd.concat(
[sub.process_FactorValueValueObject_list(y) for y in fac_vals],
ignore_index = True
)
def get_factor_vals(y):
vals = sub.access_field(y,'values')
out = sub.process_FactorValueValueObject_list(vals)
out.factor_ID = y.id
out.factor_category = y.category
out.factor_category_URI = y.category_uri
return out

all_factors = pd.concat([get_factor_vals(y) for y in x.experimental_factors])


baseline_factors = all_factors.loc[all_factors.ID.isin(baseline_ids)]
experimental_factors = [
Expand Down

0 comments on commit 2e22c2e

Please sign in to comment.