Skip to content

Commit

Permalink
Add Sample attributes to other_metadata when uploading to pephub
Browse files Browse the repository at this point in the history
  • Loading branch information
donaldcampbelljr committed Jan 31, 2024
1 parent 867916a commit b35cb9d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
4 changes: 4 additions & 0 deletions bedboss/bedboss.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ def run_all(
open_signal_matrix: str = None,
ensdb: str = None,
treatment: str = None,
pep_sample_dict: dict = None,
description: str = None,
cell_type: str = None,
other_metadata: dict = None,
Expand Down Expand Up @@ -117,6 +118,7 @@ def run_all(
:param str description: a description of the bed file
:param str open_signal_matrix: a full path to the openSignalMatrix required for the tissue [optional]
:param str treatment: a treatment of the bed file
:param dict pep_sample_dict: a dict containing all attributes from the sample
:param str cell_type: a cell type of the bed file
:param dict other_metadata: a dictionary of other metadata to pass
:param str ensdb: a full path to the ensdb gtf file required for genomes not in GDdata [optional]
Expand Down Expand Up @@ -193,6 +195,7 @@ def run_all(
bigbed=output_bigbed,
description=description,
treatment=treatment,
pep_sample_dict=pep_sample_dict,
cell_type=cell_type,
other_metadata=other_metadata,
just_db_commit=just_db_commit,
Expand Down Expand Up @@ -280,6 +283,7 @@ def insert_pep(
description=pep_sample.get("description"),
cell_type=pep_sample.get("cell_type"),
treatment=pep_sample.get("treatment"),
pep_sample_dict=pep_sample.to_dict(),
outfolder=output_folder,
bedbase_config=bbc,
rfg_config=rfg_config,
Expand Down
7 changes: 7 additions & 0 deletions bedboss/bedstat/bedstat.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ def bedstat(
open_signal_matrix: str = None,
bigbed: str = None,
treatment: str = None,
pep_sample_dict: dict = None,
description: str = None,
cell_type: str = None,
other_metadata: dict = None,
Expand Down Expand Up @@ -153,6 +154,7 @@ def bedstat(
not in GDdata
:param str description: a description of the bed file
:param str treatment: a treatment of the bed file
:param dict pep_sample_dict: a dict containing all attributes from the sample
:param str cell_type: a cell type of the bed file
:param dict other_metadata: a dictionary of other metadata to pass
:param bool just_db_commit: whether just to commit the JSON to the database
Expand Down Expand Up @@ -261,6 +263,11 @@ def bedstat(
}
)

# For now, add all the *other* attributes to other_metadata
for key, value in pep_sample_dict.items():
if key not in list(other_metadata.keys()):
other_metadata.update({key: value})

# unlist the data, since the output of regionstat.R is a dict of lists of
# length 1 and force keys to lower to correspond with the
# postgres column identifiers
Expand Down

0 comments on commit b35cb9d

Please sign in to comment.