Friday, 15 February 2019

How to display and distinguish paired rows in fetched data from mysql?

Previous post:https://www.reddit.com/r/node/comments/appuv4/best_way_to_pair_2_rows_together_in_mysql/This is a follow-up to my previous post.​I am working with a bioinformatics database and there is a table named plate which consists of cell plates, where each cell plate has a unique name and has multiple records.​To make things more clear and the logic behind this: a cell plate is run twice atleast (which completes one dataset entry. In other words, every 2 cell plate records/rows in the plate table make up one dataset ).​A cell plate can be run anywhere between 2 to 16 times max (so between 1 - 8 different datasets for a cell plate depending on how many times it was run).​Lets say I have a cell plate named "SP0127" and it was run 16 times, so there are 8 different datasets for the cell plate "SP0127".​As of now I have set up my app in 2 tables.Table 1 is called platelist where all unique cell plates are stored. Eg. "SP0127", "SP0128", "SP0129" etc.Below is how my platelist table looks likePlatelist table view​​Table 2 is called plate where all cell plates are stored along with all the multiple instances/records of a cell plate. Eg. 16 records of "SP0127" followed by 16 records of "SP0128" and so on.​This is how table 2 looks like:https://i.redd.it/lpy8efiljsg21.png​I have added a foreign key where I have related all individual records of a cell plate in plate table with records in platelist table.​So lets say I click on SP0127 from platelist table it will give me list of all 16 records/instances of SP0127 from plate table. The result from the query looks like this below:​​​https://i.redd.it/md31cue5jsg21.png​​Now my main issue is that after getting the 16 records of SP0127, I want to be able to display and distinguish them into 8 pairs (or datasets). 2 cell plates belong to same pair if they have same values in Cell_line, TimePoint and Magnification.​So for example, #1 and #6 belong to one pair(dataset), #9 and # 10 belong together, and #7 and #8 belong together and so on.How should I "pair" these together in the back-end, so that the 16 results I get on the front end are displayed in pairs ?PS: Ideally I would like to build the front-end in a way where I can change the conditions like Cell_lines, Timepoint and Magnification with buttons/forms and be able to see the different pairs(datasets) based on what conditions were specified.Any suggestions/advice is greatly appreciated. Thank you!!​​​​​

Submitted February 15, 2019 at 08:36PM by yungspartan0082

No comments:

Post a Comment