Skip to content

Commit

Permalink
Add column order to lims.
Browse files Browse the repository at this point in the history
  • Loading branch information
morriscb committed Oct 28, 2023
1 parent eabc4ee commit bdce47b
Showing 1 changed file with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@
build_in_list_selector_query,
build_where_clause,
)
from allensdk.core.dataframe_utils import enforce_df_int_typing
from allensdk.core.dataframe_utils import (
enforce_df_column_order,
enforce_df_int_typing
)
from allensdk.brain_observatory.ophys.project_constants import (
VBO_METADATA_COLUMN_ORDER,
VBO_INTEGER_COLUMNS
Expand Down Expand Up @@ -390,6 +393,7 @@ def _get_ophys_experiment_table(self) -> pd.DataFrame:
targeted_imaging_depth.columns = ["targeted_imaging_depth"]
df = query_df.merge(targeted_imaging_depth, on="ophys_container_id")
df = enforce_df_int_typing(df, VBO_INTEGER_COLUMNS)
df = enforce_df_column_order(df, VBO_METADATA_COLUMN_ORDER)
return df

def _get_ophys_cells_table(self):
Expand Down Expand Up @@ -508,6 +512,7 @@ def get_ophys_session_table(self) -> pd.DataFrame:
# Fill NaN values of imaging_plane_group_count with zero to match
# the behavior of the BehaviorOphysExperiment object.
table = enforce_df_int_typing(table, VBO_INTEGER_COLUMNS)
table = enforce_df_column_order(table, VBO_METADATA_COLUMN_ORDER)
return table

def get_behavior_session(
Expand Down Expand Up @@ -540,6 +545,8 @@ def get_ophys_experiment_table(self) -> pd.DataFrame:
# Set type to pandas.Int64 to enforce integer typing and not revert to
# float.
df = enforce_df_int_typing(df, VBO_INTEGER_COLUMNS)
df = enforce_df_column_order(df, VBO_METADATA_COLUMN_ORDER)

return df.set_index("ophys_experiment_id")

def get_behavior_session_table(self) -> pd.DataFrame:
Expand All @@ -561,6 +568,10 @@ def get_behavior_session_table(self) -> pd.DataFrame:
# Query returns float typing of age_in_days. Convert to int to match
# typing of the Age data_object.
summary_tbl = enforce_df_int_typing(summary_tbl, VBO_INTEGER_COLUMNS)
summary_tbl = enforce_df_column_order(
summary_tbl,
VBO_METADATA_COLUMN_ORDER
)

return summary_tbl.set_index("behavior_session_id")

Expand Down

0 comments on commit bdce47b

Please sign in to comment.