reflexive 1.2.4__tar.gz → 1.2.5__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {reflexive-1.2.4 → reflexive-1.2.5}/PKG-INFO +1 -1
- {reflexive-1.2.4 → reflexive-1.2.5}/pyproject.toml +1 -1
- {reflexive-1.2.4 → reflexive-1.2.5}/src/reflexive/res.py +16 -3
- reflexive-1.2.5/src/reflexive/res_functions.py +62 -0
- reflexive-1.2.4/pixi.lock +0 -2000
- {reflexive-1.2.4 → reflexive-1.2.5}/.gitignore +0 -0
- {reflexive-1.2.4 → reflexive-1.2.5}/LICENSE +0 -0
- {reflexive-1.2.4 → reflexive-1.2.5}/README.md +0 -0
- {reflexive-1.2.4 → reflexive-1.2.5}/old reflexive dist/reflexive-1.0.13-py3-none-any.whl +0 -0
- {reflexive-1.2.4 → reflexive-1.2.5}/old reflexive dist/reflexive-1.0.13.tar.gz +0 -0
- {reflexive-1.2.4 → reflexive-1.2.5}/old reflexive dist/reflexive-1.0.14-py3-none-any.whl +0 -0
- {reflexive-1.2.4 → reflexive-1.2.5}/old reflexive dist/reflexive-1.0.14.tar.gz +0 -0
- {reflexive-1.2.4 → reflexive-1.2.5}/old reflexive dist/reflexive-1.0.15-py3-none-any.whl +0 -0
- {reflexive-1.2.4 → reflexive-1.2.5}/old reflexive dist/reflexive-1.0.15.tar.gz +0 -0
- {reflexive-1.2.4 → reflexive-1.2.5}/old reflexive dist/reflexive-1.0.16-py3-none-any.whl +0 -0
- {reflexive-1.2.4 → reflexive-1.2.5}/old reflexive dist/reflexive-1.0.16.tar.gz +0 -0
- {reflexive-1.2.4 → reflexive-1.2.5}/old reflexive dist/reflexive-1.0.17-py3-none-any.whl +0 -0
- {reflexive-1.2.4 → reflexive-1.2.5}/old reflexive dist/reflexive-1.0.17.tar.gz +0 -0
- {reflexive-1.2.4 → reflexive-1.2.5}/old reflexive dist/reflexive-1.0.18-py3-none-any.whl +0 -0
- {reflexive-1.2.4 → reflexive-1.2.5}/old reflexive dist/reflexive-1.0.18.tar.gz +0 -0
- {reflexive-1.2.4 → reflexive-1.2.5}/old reflexive dist/reflexive-1.0.19-py3-none-any.whl +0 -0
- {reflexive-1.2.4 → reflexive-1.2.5}/old reflexive dist/reflexive-1.0.19.tar.gz +0 -0
- {reflexive-1.2.4 → reflexive-1.2.5}/old reflexive dist/reflexive-1.0.20-py3-none-any.whl +0 -0
- {reflexive-1.2.4 → reflexive-1.2.5}/old reflexive dist/reflexive-1.0.20.tar.gz +0 -0
- {reflexive-1.2.4 → reflexive-1.2.5}/old reflexive dist/reflexive-1.1.0-py3-none-any.whl +0 -0
- {reflexive-1.2.4 → reflexive-1.2.5}/old reflexive dist/reflexive-1.1.0.tar.gz +0 -0
- {reflexive-1.2.4 → reflexive-1.2.5}/old reflexive dist/reflexive-1.1.1-py3-none-any.whl +0 -0
- {reflexive-1.2.4 → reflexive-1.2.5}/old reflexive dist/reflexive-1.1.1.tar.gz +0 -0
- {reflexive-1.2.4 → reflexive-1.2.5}/src/reflexive/__init__.py +0 -0
- {reflexive-1.2.4 → reflexive-1.2.5}/src/reflexive/analyse.py +0 -0
- {reflexive-1.2.4 → reflexive-1.2.5}/src/reflexive/cfg.py +0 -0
- {reflexive-1.2.4 → reflexive-1.2.5}/src/reflexive/session.py +0 -0
- {reflexive-1.2.4 → reflexive-1.2.5}/src/reflexive/util.py +0 -0
- {reflexive-1.2.4 → reflexive-1.2.5}/src/reflexive/visualise.py +0 -0
- {reflexive-1.2.4 → reflexive-1.2.5}/tests/__init__.py +0 -0
- {reflexive-1.2.4 → reflexive-1.2.5}/tests/test_reflexive.py +0 -0
|
@@ -140,9 +140,14 @@ class Res_display:
|
|
|
140
140
|
temp_df['res_interactions'] = temp_df.res_sequence.apply(self._count_res_interactions)
|
|
141
141
|
return temp_df
|
|
142
142
|
|
|
143
|
+
def _add_res_weights(self,df):
|
|
144
|
+
temp_df = df.copy()
|
|
145
|
+
temp_df['res_weights'] = temp_df.res_interactions.apply(self._calc_res_weights)
|
|
146
|
+
return temp_df
|
|
147
|
+
|
|
143
148
|
def _add_res_adj_matrix(self,df):
|
|
144
149
|
temp_df = df.copy()
|
|
145
|
-
temp_df['res_adj_matrix'] = temp_df.
|
|
150
|
+
temp_df['res_adj_matrix'] = temp_df.res_weights.apply(self._create_adj_matrix)
|
|
146
151
|
return temp_df
|
|
147
152
|
|
|
148
153
|
def _get_res_sequence(self,reflexive_expressions):
|
|
@@ -180,7 +185,15 @@ class Res_display:
|
|
|
180
185
|
re_ints[rei] += 1
|
|
181
186
|
return re_ints
|
|
182
187
|
|
|
183
|
-
def
|
|
188
|
+
def _calc_res_weights(self,interactions:dict[tuple,int])->dict[tuple,float]:
|
|
189
|
+
max = max(interactions.values())
|
|
190
|
+
weights = dict()
|
|
191
|
+
for edge,count in interactions.items():
|
|
192
|
+
weights[edge] = round(count/(15*max),3)
|
|
193
|
+
return weights
|
|
194
|
+
|
|
195
|
+
|
|
196
|
+
def _create_adj_matrix(self,weights:dict[tuple,float])->list[list[float]]:
|
|
184
197
|
re_types = ["RR","NR","AR","AF","EP"]
|
|
185
198
|
matrix = []
|
|
186
199
|
for r in re_types:
|
|
@@ -188,7 +201,7 @@ class Res_display:
|
|
|
188
201
|
for c in re_types:
|
|
189
202
|
key = tuple(sorted((r,c)))
|
|
190
203
|
#print(key)
|
|
191
|
-
weight =
|
|
204
|
+
weight = weights.get(key,0)
|
|
192
205
|
row.append(weight)
|
|
193
206
|
matrix.append(row)
|
|
194
207
|
return matrix
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# import text into dataframe
|
|
2
|
+
# accepts either an iterable of strings, or an iterable over text files
|
|
3
|
+
# returns a pandas series iterable of type string
|
|
4
|
+
|
|
5
|
+
# clean text and calculate length
|
|
6
|
+
# accepts an iterable of strings in form of pandas series of type string
|
|
7
|
+
# returns a pandas series iterable of type int
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
# chunk text and keep original index ref
|
|
11
|
+
# accepts an iterable of dataframe rows
|
|
12
|
+
# returns an iterable of dataframe rows with added column 'text_chunks' - list of strings
|
|
13
|
+
|
|
14
|
+
# upload docs to s3 and save local copy - side effects
|
|
15
|
+
# accepts an iterable of iterable of chunks (with ids)
|
|
16
|
+
# returns an an iterable of s3 responses? URLs to S3 file?
|
|
17
|
+
|
|
18
|
+
# initiate custom entity job on comprehend
|
|
19
|
+
# no parameters
|
|
20
|
+
# returns job id for checking status, and downloading
|
|
21
|
+
|
|
22
|
+
# check status
|
|
23
|
+
# accepts job id
|
|
24
|
+
# returns status
|
|
25
|
+
|
|
26
|
+
# download results
|
|
27
|
+
# accepts job id
|
|
28
|
+
# returns iterable of results
|
|
29
|
+
|
|
30
|
+
# unpack results and load into dataframe
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
# extract reflexive expressions into dataframe
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
# get reflexive sequences
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
# get interactions
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
# create count adj matrix
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
# create weighted adj matrix
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
# save dataframe to file
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
# visualise expressions in text
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
# visualise reflexive sequence
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
# visualise res graph
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
#
|
|
61
|
+
# Network analysis functions
|
|
62
|
+
#
|