reflexive 1.2.4__py3-none-any.whl → 1.2.5__py3-none-any.whl

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/res.py CHANGED
@@ -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.res_interactions.apply(self._create_adj_matrix)
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 _create_adj_matrix(self,interactions:dict[tuple,int])->list[list[int]]:
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 = interactions.get(key,0)
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
+ #
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: reflexive
3
- Version: 1.2.4
3
+ Version: 1.2.5
4
4
  Summary: Supports AWS Reflexive Expressions Systems (RES) Analysis
5
5
  Project-URL: Repository, https://github.com/nlytx/reflexive.git
6
6
  Author-email: Andrew Gibson <andrew@nlytx.io>
@@ -1,11 +1,12 @@
1
1
  reflexive/__init__.py,sha256=x5l8GV_9yC8yJyjTLqiM_WkfuPMLuNgQxF6PIz5MfFU,422
2
2
  reflexive/analyse.py,sha256=CU6mQ8PxQrkOvuSe4mmnuI18jGMkuxql3zLZ1vEeMEY,17466
3
3
  reflexive/cfg.py,sha256=tDPiC9NwpEVoT05_831sMsMfHhJt8pVrSOsgbtzTNDM,4267
4
- reflexive/res.py,sha256=eXqdd9g24AoPcXLdddM9iE85Fx8iucZN6ODHnRsuRa4,6937
4
+ reflexive/res.py,sha256=ekpjo-dA4QT3swE-HDsWrgHp2oYy8SD2qVAeUL4v1OM,7393
5
+ reflexive/res_functions.py,sha256=YF45yUF8NYMSC19DFpE0lmV4xyNxv3QqbbzZmdwmFzg,1231
5
6
  reflexive/session.py,sha256=8STWo8sqmWn-1PHcloFbgmLEvd7lsiFTU4t7ESRTsvw,10046
6
7
  reflexive/util.py,sha256=uU7-lqUmiCiCaR85AdNFKXrdrBspjb1Rmd-yThA3fRU,3699
7
8
  reflexive/visualise.py,sha256=pVnsPJOnHiLAIvDDm9P0u6-sGQINC4GVOY9b0GrzTK4,11725
8
- reflexive-1.2.4.dist-info/METADATA,sha256=mibCUwBnfR03eOBn4vbNMbyAY2wDhfVU6RPeg0D5qc4,574
9
- reflexive-1.2.4.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
10
- reflexive-1.2.4.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
11
- reflexive-1.2.4.dist-info/RECORD,,
9
+ reflexive-1.2.5.dist-info/METADATA,sha256=NLXNj7RjrhdIBaIezMJFtTXfayBQ7QAMiCCk6Y1LEYc,574
10
+ reflexive-1.2.5.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
11
+ reflexive-1.2.5.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
12
+ reflexive-1.2.5.dist-info/RECORD,,