On 28/03/2018 3:42 AM, shawn...@gmail.com wrote:
Hi everyone, I am currently working on django and get confused about how to design the model.
Right now, I have a table named 'Reactionmeta' which structure like below:

     1             2              3                     4                    5                     6             121                  122 reaction   name   metabolite1  stoichiometry1  metabolite2 stoichiometry2 .......... metabolite60  stoichiometry60 (stoichiometry1 corresponds to metabolite1 and so on so forth)

I think this is a spreadsheet approach to a relationship problem

I'm not totally sure about the reactivity and stoichiometry but I have used a relational approach to a (probably) different problem.

Mine is a mixture hazard classification system which includes reaction products from some ingredients. I think maybe your metabolites are like my ingredients. I don't care about the stoichiometry of my reaction products and rely on the scientist-user to worry about that. My system only cares about the end-points.

So for me a mixture is a bunch of ingredients. An ingredient is a substance with properties and the mixture is a substance with a many-to-many relationship with itself. The stoichiometry calculations (if I was doing them) would be in the 'through' record which links a substance (ingredient) to the mixture substance.

In this way I only have as many records as there are ingredients plus one for the mixture. No empty records and an unlimited number of ingredients.

If you are interested you can examine the working system. Let me know off-list and I can give you a login.

Cheers

Mike


(P.S: I have to claim that each stoichiometry correspond to one metabolites in the reaction, like a + b -> 2c + d(the number is the stoichiometry) However, one metabolite may has different stoichiometry, because they may involved in different reactions. For example:   a + 2b + c -> d + e + f;     2a + b -> h + j (metabolite a has different stoichiometry in two reactions)


some of the reactions, contains 2 metabolites, thus this reaction have value in 6 columns and no value from column 7-122. And some of the reactions contains more than 40 metabolites, so they have values in majority of columns.

My question is, I created the class and registered in the admin.py, and when I clicked on one reaction in adminsite and all the columns are displayed even though some of fields are blank, like below:

<https://lh3.googleusercontent.com/-KPDYkVUUGGU/WrpzXgJ8OPI/AAAAAAAAAFk/nmcZ_c0yYQQ9lMacxP81sl7-VlWd1PzpwCLcBGAs/s1600/1522168647376.jpg>

In that case, how can only display those fields with values and hide the fields without values? Or is there is any other way to modify the database structure or class structure to display the metabolites and stoichiometry only this reaction involves?


Thank you!!!!


--
You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com <mailto:django-users+unsubscr...@googlegroups.com>. To post to this group, send email to django-users@googlegroups.com <mailto:django-users@googlegroups.com>.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/22738963-e373-467e-8291-fdb0086be40e%40googlegroups.com <https://groups.google.com/d/msgid/django-users/22738963-e373-467e-8291-fdb0086be40e%40googlegroups.com?utm_medium=email&utm_source=footer>.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/c05c9e4b-6550-a9b2-f334-e1d1bc5fb23f%40dewhirst.com.au.
For more options, visit https://groups.google.com/d/optout.

Reply via email to