Pedigree Inheritance Pattern Analysis

I coded my first program!

Muhammad Arif
4 min readDec 31, 2021

TLDR; I coded a program in Python to allow geneticists and scientists to determine the inheritance pattern from a pedigree: Pedigree Inheritance Pattern Analysis (PIPA).

Yes, you hear that right! I coded my first-ever Python program these past few days.

What inspired this project?

While studying for my Genetics exam, I noticed that I was always getting stuck on the pedigree section and losing marks. Pedigrees are a vital part of any geneticist’s toolbox. I also noticed the pedigrees could be solved through adding or removing attributes: male to female ratios, generational skips, parent to child inheritance, etc. Memorizing all the inheritance patterns was a struggle, and I wanted to make the process easier.

What was my thought process for writing the code?

I knew I had to create code that IF this then THAT and IF NOT this then NOT that. This was my general structure. I knew I had to do this for all of the inheritance patterns (about 6 or 7).

1.0 PIPA Python code in Pycharm
1.1: PIPA Python code in Pycharm

What were my steps?

First, I asked, “how could I make determining the inheritance patterns in pedigrees easy?”

I identified that all inheritance patterns had some unique qualities and some shared. These attributes may form a structure for my program to work with.

My strategy was simple, form a program that asks you, “is it the case that X” and if X is the case, then reply with a conclusion. If X was not the case, then move on to the next question. This next question, like previously, will ask, “Is it the case that Y is true?” If it is not the case that Y is true, then move on to the next question. Another aspect I had to consider was that some conclusions formed would share attributes. I had to code the program in a way, that in the end, the conclusion is comprised of the unique attributes of each inheritance pattern rather than shared attributes.

Then, I processed all the information by creating a flow chart. These were the steps my code would run through to conclude. My first inheritance pattern relied solely on one condition/attribute. If the user answers YES for it, then the conclusion is returned easily. This is opposed to my fifth inheritance pattern, which shared many attributes with the other conclusions. This conclusion could only be arrived at through specific inputs, in one particular order, negating all attributes not shared, taking into account the unique observations, and then outputting the appropriate response. Furthermore, I allow the user to test multiple pedigrees. I added a feature to keep repeating the program at the end of each test.

2.0 Pedigree chart of a large Malay family with juvenile-onset open-angle glaucoma and distribution of Asn480Lys of MYOC

After I had finished coding the program, I tested it multiple times. This allowed me to weed out any bugs that may cause issues. At this stage, I also coded in statements if there were invalid inputs or the observations were not making sense. These statements prompt the user to reevaluate the pedigree for more accurate observations! The tool can only work as well as the data provided. I used it for my assignments and tests, which allowed me to score some of the highest marks I have received. My program was a success!

What challenges did I face writing PIPA?

I wrote down the structure on the whiteboard. I went through two attempts to make sure they flowed adequately and the attributes were not redundant.

The primary challenge I faced was making sure the flow of information was correct. I determined this by seeing if one question would lead to the next, and if it does, does it go somewhere meaningful? The first two inheritance patterns I coded only relied on one unique observation, while the rest shared attributes. Structuring the code in a way that goes from the two most easily identifiable characteristics to going through the most shared attributes and then narrowing it down to the unique qualities of the inheritance pattern was time-consuming. However, I knew that for a good program (and to avoid redoing it), I must spend at least a couple of hours on this process. I did this step twice, each time structuring the data flow further.

My second notable challenge was learning python. As I had never coded in python or any language asides from some SQL, I had a lot to learn. I used an online video to overcome this challenge and have enough knowledge to begin coding.

What would you improve about your program (PIPA)?

My next steps would be to make the code an executable file that I may share. This allows me to make the program a real-world tool to help people who need it. I would also like to develop front-end visuals for the program, similar to an app on your computer (photoshop, chrome, word, etc.). This will make my program more user-friendly. I wish everyone had Pycharm, but unfortunately, that is not the case (haha).

Thank you for reading this far.

Let’s connect! Follow to stay updated.

--

--

Muhammad Arif

Health Analytics | I've been on a journey into healthcare analytics| DNA, Dollars, and Data points