Skip to content

Commit a8e786b

Browse files
committed
Finished schema for hormone2cell table s2b
1 parent 33ae4c7 commit a8e786b

1 file changed

Lines changed: 78 additions & 23 deletions

File tree

pypath/inputs_v2/hormone2cell.py

Lines changed: 78 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
from pypath.internals.tabular_builder import (
2121
AssociationBuilder,
2222
AssociationsBuilder,
23+
AnnotationsBuilder,
2324
CV,
2425
EntityBuilder,
2526
FieldConfig,
@@ -28,6 +29,8 @@
2829
from pypath.internals.cv_terms import (
2930
EntityTypeCv,
3031
IdentifierNamespaceCv,
32+
InteractionMetadataCv,
33+
ParticipantMetadataCv,
3134
LicenseCV,
3235
OntologyCv,
3336
UpdateCategoryCV,
@@ -38,15 +41,18 @@
3841

3942
URL = 'https://rescued.omnipathdb.org/hormone2cell_s1_to_s6.xlsx'
4043

41-
files_skiprows = {
42-
'Table S2B': 3,
43-
'Table S2C': 2,
44-
'Table S2D': 2,
45-
'Table S2E': 3,
46-
'Table S2F': 2,
47-
'Table S3A': 2,
48-
'Table S3B': 3,
49-
'Table S3C': 2,
44+
files_skiprows_filter = {
45+
'Table S2B': {
46+
'skiprows': 3,
47+
'filter': {'hormone_ID_unique': 'group_name', 'include': 'NA'}
48+
},
49+
'Table S2C': {'skiprows': 2, 'filter': {}},
50+
'Table S2D': {'skiprows': 2, 'filter': {}},
51+
'Table S2E': {'skiprows': 3, 'filter': {}},
52+
'Table S2F': {'skiprows': 2, 'filter': {}},
53+
'Table S3A': {'skiprows': 2, 'filter': {}},
54+
'Table S3B': {'skiprows': 3, 'filter': {}},
55+
'Table S3C': {'skiprows': 2, 'filter': {}},
5056
}
5157

5258
config = ResourceConfig(
@@ -73,22 +79,53 @@
7379
default_mode='r',
7480
)
7581

76-
def parser(opener, sheet, skiprows):
82+
def parser(opener, sheet, skiprows=0, filter={}):
7783

7884
df = pd.read_excel(opener.path, sheet_name=sheet, skiprows=skiprows)
7985

86+
# Skipping rows according to filter if any
87+
if filter and isinstance(filter, dict):
88+
89+
for k, v in filter.items():
90+
91+
df.query(f'{k} != "{v}"', inplace=True)
92+
8093
yield from df.to_dict(orient='records')
8194

8295
# =================================== SCHEMA ===================================
8396

8497
f = FieldConfig(
85-
extract={},
98+
extract={
99+
'pmid': r'/(\d+)/?$'
100+
},
86101
map={},
87102
transform={},
88103
)
89104

90105
schema_2B = EntityBuilder(
91-
#entity_type=EntityTypeCv.
106+
entity_type=EntityTypeCv.HORMONE,
107+
identifiers=IdentifiersBuilder(
108+
CV(term=IdentifierNamespaceCv.H2C_ID, value=f('hormone_short')),
109+
CV(term=IdentifierNamespaceCv.NAME, value=f('hormone_display')),
110+
CV(
111+
term=IdentifierNamespaceCv.ABBREVIATED_NAME,
112+
value=f('hormone_figures')
113+
),
114+
CV(
115+
term=IdentifierNamespaceCv.SYNONYM,
116+
value=f('hormone_other', delimiter=', ')
117+
),
118+
),
119+
annotations=AnnotationsBuilder(
120+
CV(
121+
term=ParticipantMetadataCv.PARTICIPANT_XREF,
122+
value=f('ref_hormone', delimiter='\n', extract='pmid')
123+
),
124+
CV(
125+
term=InteractionMetadataCv.INTERACTION_XREF,
126+
value=f('ref_receptor', delimiter='\n', extract='pmid')
127+
)
128+
),
92129
)
93130

94131
# ================================= RESOURCE ===================================
@@ -103,16 +140,6 @@ def parser(opener, sheet, skiprows):
103140
#)
104141

105142
# ================================= REFERENCE ==================================
106-
# S1B
107-
#
108-
# Tissue System Classical endocrine cell type Neuroendocrine cell type Lineage Tissue level broad-grained cell type (celltype_level1) Tissue level fine-grained cell type (celltype_level2) Tissue level Cell Type Broad 1 Tissue level Cell Type Broad 2 Tissue level Cell Type Broad 3 Celltype_count
109-
# Fallopian Tube Reproductive not not epithelial epithelial_cell_nonciliated epithelial_cell_nonciliated_1 epithelial epithelial_cell_nonciliated epithelial_cell_nonciliated 7477
110-
# Fallopian Tube Reproductive not not immune t_cell t_cell_cd4 T_cell T_cell CD4_T_cell 5782
111-
# Fallopian Tube Reproductive not not mesenchymal smooth_muscle_cell smooth_muscle_cell smooth_muscle_cell smooth_muscle_cell smooth_muscle_cell 6438
112-
# Fallopian Tube Reproductive not not epithelial epithelial_cell_ciliated epithelial_cell_ciliated epithelial epithelial_cell_ciliated epithelial_cell_ciliated 4574
113-
# Fallopian Tube Reproductive not not mesenchymal myofibroblast myofibroblast_3 myofibroblast myofibroblast myofibroblast 4863
114-
# Fallopian Tube Reproductive not not epithelial epithelial_cell_nonciliated epithelial_cell_nonciliated_2 epithelial epithelial_cell_nonciliated epithelial_cell_nonciliated 7786
115-
116143
# S2B
117144
# X Y
118145
# hormone_ID hormone_ID_unique hormone_short hormone_figures hormone_display hormone_other Tier include exclude classical regulatory gut_pancreatic hormones neuropeptides prostaglandins reprodutive cardiovascular other ref_hormone ref_receptor
@@ -124,7 +151,7 @@ def parser(opener, sheet, skiprows):
124151

125152

126153
# S2C
127-
# Z X*
154+
# Z X* (not corresponding to above?)
128155
# gene category ID status_in_h2c
129156
# POMC hormone hormone_1 h2c_included
130157
# INHBA hormone hormone_2 h2c_included
@@ -177,5 +204,33 @@ def parser(opener, sheet, skiprows):
177204
# CYP17A1 Steroid 17-alpha-hydroxylase/17,20 lyase P05093 1 enzyme_synthesis synthesis Androstenedione_from_17alpha-hydroxyprogesterone Rhea:14753 CYB5A
178205
# CYP17A1 Steroid 17-alpha-hydroxylase/17,20 lyase enzyme 1 enzyme_synthesis synthesis 17alpha-hydroxyprogesterone_from_progesterone Rhea:46308
179206

207+
# S3A
208+
# Y
209+
# Hormone_short Tier Tissue Tissue level fine-grained cell type (celltype_level2) Source Assay Strength Cell count from scRNA-seq Cell count from snRNA-seq
210+
# cart N Stomach enteroendocrine_cell cell_only 1.6101311 162 0
211+
# cart N Pituitary gonadotroph cell_only 0.636176012788019 1055 936
212+
# cart N Cerebral Cortex neuron_excitatory_L2negative3_CUX2_[...] cell_only 0.213208141785439 14662 146995
213+
# glp2 2 Pancreas gamma_cell cell_only 5.23447505055456 118 797
214+
# glp2 2 Large Intestine enteroendocrine_cell cell_only 4.133497 396 0
215+
216+
# S3B
217+
# Y
218+
# Hormone_short Tier Tissue Tissue level broad-grained cell type (celltype_level1) Strength_max Celltype_Expressing_Count Celltype_Count
219+
# activin_a 2 Adipose dendritic_cell 0.287404055017379 1 3
220+
# activin_a 2 Adipose macrophage 0.416829472890448 1 4
221+
# activin_a 2 Adipose mast_cell 0.558139440494919 1 1
222+
# activin_a 2 Adipose monocyte 0.900293639976023 2 3
223+
# activin_a 2 Adipose vascular_smooth_muscle_cell 0.265987057185408 1 1
224+
# activin_b 2 Adipose adipocyte 0.126652316578524 3 8
225+
# activin_b 2 Adipose endothelial_cell 1.06644160266406 2 2
226+
227+
# S3C
228+
# Y
229+
# Hormone_short Tier Tissue Anatomical-region–resolved tissue level fine-grained cell type (celltype_level2) Strength Source Assay
230+
# somatostatin 2 CerebralCortex neuron_inhibitory_SST_NPY_____FRO 1.24817403520624 cell_only
231+
# somatostatin 2 CerebralCortex neuron_inhibitory_SST_ADAMTSL1_____PCx 1.11211415255699 cell_only
232+
# somatostatin 2 CerebralCortex neuron_inhibitory_SST_HTR2C_____PCx 1.06945688030573 cell_only
233+
# somatostatin 2 CerebralCortex neuron_inhibitory_SST_HS3ST5_____PCx 1.0405526595268 cell_only
234+
# somatostatin 2 CerebralCortex neuron_inhibitory_SST_ADAMTSL1_____TCx 1.02391851305284 cell_only
180235

181236
# interactions + cell type

0 commit comments

Comments
 (0)