Skip to content

Commit

Permalink
Added variable for number of dilutions
Browse files Browse the repository at this point in the history
  • Loading branch information
wflynny committed May 29, 2020
1 parent d7fa04c commit da1eddb
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions post_processing/hcs_data_processing.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,10 +153,12 @@ def parse_description(excel_file: pd.ExcelFile) -> typing.Tuple[dict, pd.DataFra

dispensing = raw_description.iloc[19:22]
dispensing = dispensing.rename(columns=dispensing.iloc[0]).drop(dispensing.index[0])
dilution_constant = raw_description.iloc[22, 0]
notes = raw_description.iloc[23, 0]
dilution_points = raw_description.iloc[22, 0]
dilution_constant = raw_description.iloc[23, 0]
notes = raw_description.iloc[24, 0]

description["Serial dilution constant"] = dilution_constant
description["Serial dilutions"] = dilution_points
description["Notes"] = notes

return description, dispensing
Expand All @@ -179,17 +181,18 @@ def parse_daughter_plate_specs(
return variables


def construct_dilution_plate(dispensing, dilution_constant=10 ** (1 / 2)):
def construct_dilution_plate(dispensing, n_dilutions, dilution_constant=10 ** (1 / 2)):
dilutions = dispensing.iloc[1, :].values[:, None] * (
(1 / dilution_constant) ** np.arange(12)
(1 / dilution_constant) ** np.arange(n_dilutions)
)
dilution_plate = pd.DataFrame(
dilutions, index=list("ABCDEFGH"), columns=pd.RangeIndex(1, 13)
0, index=list("ABCDEFGH"), columns=pd.RangeIndex(1, 13)
)
dilutions_plate.iloc[:, :n_dilutions] = dilutions
dilution_plate = dilution_plate.stack().to_frame()
dilution_plate.index = dilution_plate.index.map("{0[0]}{0[1]}".format)
dilution_plate.columns = ["drug_concentration"]
dilution_plate["drug"] = np.repeat(dispensing.iloc[0, :].values, 12)
dilution_plate["drug"] = np.repeat(dispensing.iloc[0, :].values, n_dilutions)
return dilution_plate


Expand Down Expand Up @@ -299,7 +302,7 @@ def main(args: argparse.Namespace) -> None:
daughter_plate_info = parse_daughter_plate_specs(input_excel)

dilution_plate = construct_dilution_plate(
dispensing, description["Serial dilution constant"]
dispensing, description["Serial dilutions"], description["Serial dilution constant"]
)

dataframe = construct_dataframe(
Expand Down
Binary file modified templates/HCS-input-form.xltx
Binary file not shown.

0 comments on commit da1eddb

Please sign in to comment.