The Cytoscape 3.* app Inbreeding, given a mating network, calculates the inbreeding and relationship/relatedness coefficients between the individuals composing the input network. In order to automate this process, a network with the parental relationships of the individuals (mating network) must be provided. At the end, Inbreeding exports the result (inbreeding and relationship coefficients among all the individuals) into a csv file format for posterior easy viewing.
# Data Input
As stated above, this app uses information on parental relationships of individuals to calculate their inbreeding and relatedness coefficients. Therefore, prior to the execution of this application, the user, in any way he/she wants, must have loaded a network (mating network) containing all this information. The needed network is a directed graph where the nodes identify each distinct individual by a unique name and the edges between them determine their parental relationships. In this sense, edges leaving a node indicate that this node is parent of the node to which the edge points. As expected, a child node can only have 2 or less parent nodes (two edges pointing him/her) representing the mother and/or father relationship. As an example of this, we can see the first image of the screenshots section.
For the installation of the app, you need to first configure your own Cytoscape 3.x environment downloading it from here. Once done, you can install the Inbreeding app by navigating to the upper menu of the environment and clicking on Apps > AppManager. After that, you just need to search the app by typing the name “Inbreeding” in the search bar. Eventually, it will show the app and you can finally install it by clicking on “Install”.
# How to use inbreeding
After installing the Inbreeding app and loading the network containing the parental relationships among individuals, the next step (prior to the execution of the app) is to select the loaded network by clicking on it. Once selected (the network must be shaded), you can execute the application by selecting the option “Proceed” in Apps > Inbreeding of the upper menu. Eventually, the control panel illustrated on the second image of the screenshots section will appear. In it, we have to specify the parameters needed to automate the process. These user-specified parameters are explained below:
**Method**: There are 3 different algorithms that can be used when obtaining the inbreeding and relationship coefficients among individuals. This option allows the user to indicate which method wants to use:
- *Iterative Level-0:* This algorithm is based on finding nodes with no parent nodes (level 0) to later identify one by one their child nodes (following the links leaving the parent nodes). To calculate the inbreeding and relatedness coefficients among all the individuals, the information of parents at level 0 is propagated to lower level nodes (children, grandchildren, and so on). To propagate this information, the algorithm saves the parental relationship of nodes at level 0 in their children to be used in later steps and deletes all the nodes at level 0 in the network. In this way, the algorithm can continue identifying new parent nodes at level 0 and calculating the inbreeding and relationship coefficients by the use of the previous stored information about parents, grandparents and so on. Therefore, this process will be repeated iteratively until all the nodes in the network are deleted/visited.
- *Depth First Search:* The Depth First Search algorithm is a well-known algorithm for traversing all the nodes in a graph (network). It is based on the idea of expanding every node composing the graph through its siblings until a certain node is reached (leaf node or destination node). At this point, it returns (backtracking) and repeats the same process with the rest of the sibling nodes of the already processed nodes, thus finding new alternative paths to the previous one. In this way, information about all the paths separating the nodes of the graph (network) from each other can be collected to later be used when calculating the inbreeding and relationship coefficients.
- *Breadth First Search:* Just as Depth First Search, Breadth First Search is another famous approach for tracing all the nodes in a graph (network). However, this algorithm does not make use of backtracking for this purpose. On the contrary, it iteratively traverses all the nodes of the graph by exploring all their sibling nodes. After that, it again explores the respective sibling nodes in the next level and so on until all graph nodes are visited. When it finishes, all the ancestor information needed to calculate the inbreeding and relationship coefficients of individuals is collected regardless of the path taken.
**Select output file:** Absolute path to the result file (csv format) that will contain the information of the inbreeding and relationship coefficients among all the individuals in the mating network.
After executing the Inbreeding app we will obtain a csv file containing the inbreeding and relatedness coefficients of all the individuals provided in the mating network. As detailed at the third image of the screenshots sections, this output file will contain a matrix where the first row and column indicate the name identifying each individual. Apart from those cells, the rest of cells of the matrix represent either the inbreeding (values on the matrix diagonal) or relationship/relatedness (values not on the matrix diagonal) coefficients among the individuals indicated by row and column. In other words, the value at position 1x1 represents the inbreeding coefficient of the individual represented by row 1 or column 1, at position 3x3 the inbreeding coefficient of the individual represented by row 3 or column 3, while the value at position 1x2 represents the relationship coefficient between individuals at row 1 and column 2, at position 2x3 between individuals at row 2 and column 3, and so on. As can be seen, all the values for the relatedness coefficient are in the [0,1] range where a 0.5 value indicates a 50% of relationship between involved individuals. On the other side, the values for the inbreeding coefficient are in the [1, 2] range where a 1.25 value indicates a 25% of inbreeding of the involved individual. All this information is separated by the comma delimiter (csv format) to ease its visualization with other tools such as Excel, LibreOffice Calc, etc.