Skip to content

Commit cc52d33

Browse files
Change 'induced' to 'inferred'
1 parent 60cd68e commit cc52d33

4 files changed

Lines changed: 19 additions & 14 deletions

File tree

README.md

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Below, we summarize the ``pySubnetSB`` API.
2222
Here we illustrate ``pySubnetSB`` for two small networks using default values in the API call.
2323
The reference and target models are:
2424

25-
rerence_model = """
25+
reference_model = """
2626
R1: S2 -> S3; k2*S2
2727
R2: S1 -> S2; k1*S1
2828
@@ -44,6 +44,11 @@ The reference and target models are:
4444
k3 = 0.2
4545
"""
4646

47+
To use ``pySubnetSB``, execute
48+
49+
!pip install pySubnetSB
50+
from pySubnetSB.api import ModelSpecification findReferenceInTarget, findReferencesInTargets, makeSerializationFile
51+
4752
The API call is
4853

4954
result = findReferenceInTarget(reference_model, target_model)
@@ -80,18 +85,18 @@ The target model is BioModels 695.
8085
reference_model,
8186
ModelSpecification(URL, specification_type="sbmlurl"),
8287
max_num_mapping_pair=1e14,
83-
num_process=mp.cpu_count(),
84-
identity=cn.ID_WEAK)
88+
num_process=2,
89+
identity="weak")
8590

86-
As before, the first two arguments of the API call are the reference and target models. Since the target is a URL, ``ModelSpecification`` is used to convert the URL to a model string. ``max_num_mapping_pair`` is used to manage computational demands by limiting the number mapping pairs that are considered. ``num_process`` specifies the number of processes (cores) that are used by ``pySubnetSB``. By default, all cores are used. Last, ``identity`` specifies the kind of subnet to discover.
91+
As before, the first two arguments of the API call are the reference and target models. Since the target is a URL, ``ModelSpecification`` is used to convert the URL to a model string. ``max_num_mapping_pair`` is used to manage computational demands by limiting the number mapping pairs that are considered. ``num_process`` specifies the number of processes (cores) that are used by ``pySubnetSB``. By default, all cores are used. Last, ``identity`` specifies the kind of subnet to discover - "weak" or "strong" (default).
8792

8893
The ``identity`` argument requires more explanation. A subnet of the target is weakly identical (``cn.ID_WEAK``) to the reference if they have the same stoichiometry matrix. A target subnet is strongly identical (default) if it is just a renaming of the species and reactions in the reference network.
8994

9095
Running the foregoing code takes about 10 minutes on a two core machine. You will see a status bar as the command executes that indicates the number of mapping pairs processed.
9196

9297
mapping pairs: 100%|███████████████████████████████████████████████████████████████████████████████████| 483649090/483649090 [00:29<00:00, 16350750.64it/s]
9398

94-
As before ``result.mapping_pairs`` is a list of mapping pairs. You can display the inferred network form mapping pair 1 using ``result.makeInducedNetwork(1)``. There is some stochasticity to the order of the results. When we ran this study, inferred network 1 was:
99+
As before ``result.mapping_pairs`` is a list of mapping pairs. You can display the inferred network form mapping pair 1 using ``result.makeInferredNetwork(1)``. There is some stochasticity to the order of the results. When we ran this study, inferred network 1 was:
95100

96101
R_31: xFinal_2 -> xFinal_1
97102
R_10: -> xFinal_8

src/pySubnetSB/network.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,13 @@ def mapping_pairs(self)->List[AssignmentPair]:
4848
return self.assignment_pairs
4949

5050
@property
51-
def induced_network(self)->'Network':
52-
"""Induced network from the first assignment pair."""
53-
return self.makeInducedNetwork()
51+
def inferred_network(self)->'Network':
52+
"""Inferred network from the first assignment pair."""
53+
return self.makeInferredNetwork()
5454

55-
def makeInducedNetwork(self, assignment_pair_idx:int=0)->'Network':
55+
def makeInferredNetwork(self, assignment_pair_idx:int=0)->'Network':
5656
"""
57-
Creates an induced network from the assignment pair.
57+
Creates an inferred network from the assignment pair.
5858
5959
Args:
6060
assignment_pair_idx (int): index of the assignment pair
@@ -68,7 +68,7 @@ def makeInducedNetwork(self, assignment_pair_idx:int=0)->'Network':
6868
msg = f'Assignment pair index {assignment_pair_idx} is out of range.'
6969
msg += f' Max is {len(self.assignment_pairs)}'
7070
raise ValueError(msg)
71-
return self.network.makeInducedNetwork(self.assignment_pairs[assignment_pair_idx])
71+
return self.network.makeInferredNetwork(self.assignment_pairs[assignment_pair_idx]) # type: ignore
7272

7373
def __bool__(self)->bool:
7474
return len(self.assignment_pairs) > 0

src/pySubnetSB/network_base.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -924,9 +924,9 @@ def makeRandomReferenceAndTarget(cls,
924924
)
925925

926926

927-
def makeInducedNetwork(self, assignment_pair:AssignmentPair)->'NetworkBase':
927+
def makeInferredNetwork(self, assignment_pair:AssignmentPair)->'NetworkBase':
928928
"""
929-
Makes an induced network based on an assignment pair.
929+
Makes an inferred network based on an assignment pair.
930930
931931
Args:
932932
assignment_pair (AssignmentPair): Assignment pair.

src/pySubnetSB_tests/test_network_base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@ def testMakeInducedNetwork(self):
332332
species_assignment = np.array(range(self.network.num_species))
333333
reaction_assignment = np.array(range(self.network.num_reaction))
334334
assignment_pair = AssignmentPair(species_assignment, reaction_assignment)
335-
induced_network = self.network.makeInducedNetwork(assignment_pair)
335+
induced_network = self.network.makeInferredNetwork(assignment_pair)
336336
self.assertTrue(self.network.isEquivalent(induced_network))
337337

338338
def testMakeMatricesForIdentity(self):

0 commit comments

Comments
 (0)