Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Errors when adding containers to Spatial Structures in Mobi, references ignored #46

Closed
TakugoAmy opened this issue Jul 12, 2017 · 11 comments

Comments

@TakugoAmy
Copy link

Hi everyone,

I was wondering if anyone could shed light to an issue I'm having in Mobi.

I was attempting to create a tumor compartment in Spatial Structures based off of the mechanistic tumor provided in the examples. However I wished to modify it to be modeled like an organ and connect it to the Arterial and Venous blood along with adding BloodCell, Interstitial,Endosome, and Plasma sub-compartments.

However I get 8 errors when attempting to add the Spatial Structure containing my tumor compartment to the simulation which elude me.

errors

6 of the errors pertaining to Passive transport which seem to state that references cannot be found.
problem

However following the path in question reveals that they very much so exist...
problem2

I don't even really know where to begin to solve these since the object referenced appears to exist in the path, and presumably is working fine in the other organs. Is this a bug?

The other two involve FcRn binding, where my reaction does not seem to be able to find Kd and kass values in the tumor compartment.

problem3

I can manually add the items in question to the path and remedy this issue. However these do not seem to be visibly defined in the other organs, so then how are they being defined in the organs?

Does anyone have any ideas? Especially for the 6 errors.

I've added the project if anyone's interested in taking a look:
Tumor model.zip

Thanks in advance!

@TakugoAmy TakugoAmy changed the title Errors when adding containers to Spacial Structures in Mobi, references ignored Errors when adding containers to Spatial Structures in Mobi, references ignored Jul 12, 2017
@msevestre
Copy link
Member

Hey @TakugoAmy,

This is a very interesting question and it will take probably a few iterations until I manage to describe clearly what's going on. Also thanks for attaching a project to the issue, this will be very helpful.

Why is MoBi showing parameters in the tree that do not exist?

We could qualify this as a display bug indeed. (I have created Open-Systems-Pharmacology/MoBi#147). The Possible Referenced Objects tree is trying to construct the resulting structure that will be created in the simulation to help you design the formula object. However in that case, some parameter are shown that do not make sense.

Where are the global molecule parameters coming from?

For each non stationary and Xenobiotic molecules, (e.g. all administered drugs or molecule created using the PK-Sim Molecule template), all parameters defined in the Spatial Structure -> MoleculeProperties container are created globally in the simulation.

image

If we look at one of this parameter more closely, for example Blood/Plasma concentration ratio
image
we can see that this parameter relies on our typical compound parameter such as fu or LogP (Lipophilicity) which does not make sense for your LigandEndo

In short, for the LigandEndo molecule, the global parameters from the Spatial Structure -> MoleculeProperties won't be created. This is by design

Why are these parameters used then ?!?

Let's look at for example the first of the 6 errors with the passive transport PassiveDiffusionPl2RBC.
You can simply double click on the error and the PassiveDiffusionPl2RBC editor will open where you can see how this passive transport will be created.

image

The definition of the process stipulates that the process should be created from ALL Plasma compartment (Source) to ALL Blood Cells compartments (Target)

Now the very interesting feature is the list of molecules for which the process will be created. Here you have defined that the process will be created for ALL Molecules except FcRn and 'Herceptin-FcRn_Complex`

Now I am not sure what make sense in your case, but you have different choices here:

  • The LigandEndo can be added to the excluded list
  • You exclude the Mechanistic_Tumor from the passive transport process and define your own process.

Why does it work with other organs?

Well LigandEndo is in fact excluded from some passive transports out of the box (when exported from PK-Sim).
Check PassiveDiffusionPl2Int out :)

This is just the beginning.... try to make sense of this information and let's continue our discussion after that....and do not hesitate to fire up more questions. I think this will be very helpful for everyone out there.

@TakugoAmy
Copy link
Author

TakugoAmy commented Jul 13, 2017

Thanks @msevestre for the quick response! I'm down to only three errors now.

This makes a lot of sense regarding the LigandEndo & LigandEndo_Complex molecules.

Similarly, I can see how this could be a remedy for the similar issue with the “FcRn kinetics” molecules with the “PassiveDiffusion” transporters. (Out of curiosity what are these molecules anyway? Are they just dummy molecules to be used in the reactions Building block?)

I am still slightly confused about how this issue does not appear in other neighborhoods though. For example, what lets “PassiveDiffusionPl2RBC” correctly ignore “LignadEndo” in other neighborhoods but require explicit exclusion in my tumor organ neighborhoods?
Looking in the tree of a compiled simulation I see that “LigandEndo” and other infringing molecules do not exist in the majority of the neighborhoods. I assume this is the mechanism which answers my question. Is it possible to exclude molecules like this for a user created neighborhoods?

Also how do some of these tags work? For example, for something tagged “Neighborhood: Plasma / BloodCells”, does this imply that the source is “Plasma” and the target is “BloodCells”? Or is “Neighborhood: Plasma / BloodCells” as one big tag?


One of the errors states that the drug I am modeling cannot find "Partition coefficient Interstitial/Water"
error passivediffusionint2cell

Which is fine, I can add the parameter to "MolecularProperties" and have it work, but why doesn't this parameter show up in the Spatial structure of other organs?

For example, In my last simulation before attempting to add the tumor, the tree showed this in the simulation:
perviously simulated

However the Spatial Structure does not include it:
no interstitial-water



The other two errors I am facing regarding the FcRn binding reaction.
fcrn error
error fcrn tissue

I assume that these errors exist because "FcRn binding endogenous Igg" is a reaction which is supposed to occur in the "Endogenous IgG" container, and "FcRn binding tissue Herceptin" isn't supposed to occur in the "BloodCells" and "Intracellular" containers. This would imply that there must be a way to exclude reactions from compartments (As in my tumor container isn't on the exclude list), but I can't seem to find the mechanism which does this.

I know it’s a barrage of questions, but once again thanks so much!

P.S. It appears the Rollback option in History will not rollback changes made to the exclude list in the passive transports building block.

There shouldn't be many differences between the project file from before, but I added the exclusions to Ligand and FcRn kinetics to passive transports.
Tumor model.zip

@PavelBal
Copy link
Member

Hi @TakugoAmy
I can try to explain some of the issues you are facing, though @msevestre has a deeper understanding of the whole system.

When it comes to adding new molecules or containers, it is important to keep the "Molecule Start Values" (MSV) building block (BB) up to date. This BB defines, among others, which molecules are present in which containers. This is a powerful concept to have control of processes, as a process (be it a passive or an active transport, or a reaction) is only created in containers where all molecules involved in this process are present.

As a first step after adding new molecules/containers, you shoud update the MSV-BB by selecting the "Extend"-button:

s1

This forces new entries to be created. When extending the MSV-BB, all molecules are set as present in new containers (also all new molecules are set as present in all containers). However, this is no the desired behavior. What I do is going through all molecules (which can get very painful in large models...) and compare their "Is Present"-flag in the new compartment with the flag in compartments created by PK-Sim.

Let's take a look on the molecules "LigandEndo" and "LigandEndo_Complex", which were causing some errors. Filter the table to only show these molecules. You can also combine this filter with "IsPresent"-Flag, as I did in the screenshot above. I selected to only show entries of "LigandEndo" and "LigandEndo_Complex" in compartments where they are present. Entries highlighted in green are the newly created ones - and these are the entries for your Tumor-organ.

As you can see, "LigandEndo" and "LigandEndo_Complex" are not present in any default organ, but are present in the tumor. To be consistent with the model, you should exclude these molecules from the tumor. You can do it by multiselcting the green entries and selecting the "Mark selected as not present" - button:

s2

Now, "LigandEndo" and "LigandEndo_Complex" are only present in the "EndogenousIgG"-compartment. You can remove these molecules from the "Exclude"-list of the passive transport processes "PassiveDiffusionPl2RBC" and "PassiveDiffusionInt2Cell" now.

You should repeat the above mentioned steps and also exclude the moleclues FcRn, FcRn kinetics endosome/interstitial/plasma from the tumor compratments. The Herceptin-FcRn_Complex should be present in Plasma, Interstitial, and Endosome compratments - you have to exclude it from the BloodCells and Intracellular compartments of the tumor.

You could also be interested in updating the "Parameter Star Values"-BB and checking the new entries for the organ "Mechanistic_Tumor". Just filter the "Path Element 1"-column for the name of the organ. I guess, all parameres can be left as they are, but you can check the values of the "Relative expression"-parameters, if you want some proteins to be excpressed in tumor.

At last, to make your model work, you have to manually add the parameter "Partition coefficient (interstitial/water)" to the neighborhood "Mechanistic_Tumor_int_Mechanistic_Tumor_cell". As you already mentioned, this parameter is somehow not present in the Spatial-Structure-BB but is present in the simulation. The reason for this is not clear (for me). The value of the parameter should be defined by a formula and not as a constant. You can check how the formula for this parameter looks like in other organs in the simulation:

s3

Be aware that the path to the parameter "K_int_pls" is not generic but is "hard coded" for the specific organ". The correct path for the tumore would be "Neighborhoods|Mechanistic_Tumor_pls_Mechanistic_Tumor_int|MOLECULE|Partition coefficient (interstitial/plasma)".

I alse see that some of other parameters in the "Molecule Properties" of the tumor neighborhoods are set to constant values, such as "P_cell_int_factor". If you take a look at the same parameters in other organs, for example muscle, you will see that they are defined by formulas. You must change the parameters to the according formulas in order for the model to work properly. This goes for the parameter "Partition coefficient (interstitial/plasma)" in the neighborhood "Mechanistic_Tumor_pls_Mechanistic_Tumor_int".

Also, some parameters in the "Mechanistic_Tumor" container are missing, like "Specific blood flow rate". How did you create the tumor organ? The best way is to save an existing organ as PKML and load it the into the stucture. This will ensure that all relevant parameters are present - you just have to adjust them accordingly to your need.

I copied the parameters "Specific blood flow rate" and "Density (tissue)" from muscle. There is one last parameter missing - "Organ volume mouse", which is used for scaling the "Fluid recirculation flow rate" - a paramere used in the two-pores transport model. I really have no idea what value to choose here - it seems that the tumor-example was created with an older version of the software, where "Fluid recirculation flow rate" was a constant value and not calculated. I propose the following - select the value of "Organ volume mouse" to the same proportion of the tumor volume as it is for muscle:

Organ volume mouse (muscle) / Volume (muscle) = 0.0002865368
=> Organ volume mouse (Tumor) = Volume (tumor) * 0.0002865368

I defined it by a formula so the proportion will hold if you change the volume of the tumor.

I just hope that creation of new organs will be more easy in future version of OSPS. For now, I suggest you repeat all the steps described to understand what is done. I attached the project where simulation can be created. However, running the simulation results in ODE-solver error (it does work for e.g. 500 hours of simulation time). The first thing I would check is the consistency of the flows (blood flow, lymph flow etc) for the new compartment.

I hope my answer is not too confusing. Adding new organs is one of the most advanced procedure in MoBi ;) I encourage you to go through the steps I described and ask new questions if you run into a problem.

@PavelBal
Copy link
Member

Sorry, here is the model:
Tumor model _working.zip

@Yuri05
Copy link
Member

Yuri05 commented Jul 14, 2017

@msevestre
Copy link
Member

@PavelBal Great insight. Thanks a lot

@TakugoAmy

P.S. It appears the Rollback option in History will not rollback changes made to the exclude list in the passive transports building block.

Could you create an issue for that on the MoBi issue page?

Also how do some of these tags work? For example, for something tagged “Neighborhood: Plasma / BloodCells”, does this imply that the source is “Plasma” and the target is “BloodCells”? Or is “Neighborhood: Plasma / BloodCells” as one big tag?

Where do you see those tags?

@ALL: Looking at this thread, there is a LOT of useful information that we could maybe try to split into smaller forum entries so that user could understand a bit more of what's happening under the hood?

For example

  • What is a neighborhood and why is this useful
  • How are passive transport created
  • What are the FcRn kinetics molecules ?
  • etc.

@PavelBal
Copy link
Member

Where do you see those tags?

Neighborhoods have these tags. I could not find a single process in the models where these tags are used.

@msevestre
Copy link
Member

@PavelBal
Indeed. They look very suspicious to me. Only reason would be to create some SumFormula resolving all parameters in specific neighborhood at once? e.g all SA between Interstitial and Cells?

@TakugoAmy
Copy link
Author

@PavelBal
Thanks so much, I just rebuilt the tumor organ again with the insight provided and was able to get it to work!

I had been tying to understand the function of "Molecular Start Values" and "Parameter Start Values" and this makes things very clear.

I wanted to build the Organ from scratch such that I would be able to learn as much as possible of how everything was working behind the scenes, it's easy to add a .pkml file, but that wouldn't have taught me as much as it has now.

Thanks again everybody

@TakugoAmy
Copy link
Author

@PavelBal

Out of curiosity, how were you able to make "Specific blood flow rate" come out with a distribution? I don't see an option to make it that way so the best I could do was set it as a constant.

You were able to make it:
specific blood flow rate

As opposed to:
specific blood flow rate 2

@msevestre
Copy link
Member

@TakugoAmy

Out of curiosity, how were you able to make "Specific blood flow rate" come out with a distribution? I don't see an option to make it that way so the best I could do was set it as a constant.

Could you please create another question in the forum to ask this question as it is not related to the problem here. We are trying to have only one question per thread. This will help other people having the same issue in the future.
Thanks a lot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants