Identifying large sets of unrelated individuals and unrelated markers.
Kuruvilla Joseph Abraham and Clara Diaz.
Source Code for Biology and Medicine 2014 9:6
https://doi.org/10.1186/1751-0473-9-6
Usage:
fastindep [options]
-t threshold,real number between 0 and 1 for defining unrelated elements.
default: 0
Elements separated below this threshold are deemed to be unrelated.
-n a positive integer which defines the number of times the algorithm is run.
default: 1
If the number is 1, the program runs just once and outputs the result of
a deterministic greedy heuristic. If this number is more than one, 20 for
example, the program runs the stochastic heuristic 19 times and the greedy
heuristic once.
-s a positive integer which is the seed number for the random number generator.
default: 2879290329
If the seed number is missing, a random number is generated by the program.
-i input file name. Optionally full path + file name.
default: dat.txt
-o output file name. Optionally full path + file name.
default: out.txt
Example:
fastindep -t 0.85 -n 5 -s 1260646394 -i dat.txt -o out.txt
This is a guide for using FastIndep a C++ program for finding maximal independent sets on an undirected graph defined by thresholding a matrix containing correlation values. The programs described here are for use in any 64 bit Linux or MaCOS operating system with a suitable C++ compiler.
FastIndep may be freely used,copied, modified, redistributed etc. in accordance with the GNU General Public License. In particular, there are no restrictions on non-commercial use.
Before running FastIndep you will need to prepare the data file.
The format of the data file is shown in the file dat.txt. If there are 10 elements, the datafile must contain 11 lines. The first line has 10 entries, which are the names of the elements. All other lines have 11 entries. The first entry in all lines after the first line is the name of an element, the others are the correlation values. The order of the names in the first line must match the order of the names in the first entry of subsequent lines of the data file. The diagonal elements are set to be 10000, this value is arbitrary and the diagonal values are ignored in the execution of the program. The numerical entries in the data file must constitute a symmetric matrix of non negative values, or else the program may crash, or give erroneous results. The entries in the data file can be separated by any whitespace.
The data file should not contain any metacharacterswhich may arise when creating and saving the files in Windows.
The C++ programs for running FastIndep are: main.cpp DataMethods.cpp headers.h MersenneTwister.h The file MersenneTwister.h contains the random number generator which is used by FastIndep.
To run the programs copy the C++ files to a new directory. To create the executable, open a terminal window in the directory containing the C++ files and type:
g++ -v -O -Wall main.cpp DataMethods.cpp -o fastindep
(In the line above the second flag is minus O, not number zero). This will create an executable fastindep in the directory.
If the input file is dat.txt and the output file is out.txt then the command for running the code is like
example:
./fastindep -t 0.85 -n 5 -s 1260646394 -i dat.txt -o out.txt
The input and output files should be in the same directory or linked to the same directory as the executable. If the number of runs is very large, the intermediate output written to the screen can be very voluminous and can slow down the execution of the program. In this circumstance it is better to use the command
example:
./fastindep -t 0.85 -n 5 -s 1260646394 -i dat.txt -o out.txt > /dev/null
This will not affect the results in any way.
The output file will be written to the working directory. The output will overwrite any existing file with the same name. The output file contains the independent sets found by running the algorithm. If the algorithm is run 100 times, then the the program will run the greedy heuristic once followed by 99 runs of the stochastic heuristic. The program checks the maximal independent sets found by the randomized heuristic and prints out only those maximal independent sets found by the randomized heuristic which are unique; this step is necessary as different runs of the randomized heuristic may find the same maximal independent set. The result from the greedy heuristic is always printed out, even if it has also been discovered in one of the runs with the randomized heuristic.
The format for the output is defined as follows. Each independent set is written to one separate line, with a blank line separating the independent sets. The first independent set printed is the result from the greedy heuristic, whether or not it is the largest independent set found. The other independent sets are printed on subsequent lines with the largest sets found by the randomized heuristic appearing first. If there is just one run of the algorithm, only the result of the greedy heuristic appears.
Included in the output is the distribution of sizes of the maximal independent sets found by FastIndep along with how many times a set of a given size is found. This is useful for checking the multiplicity of the largest set or other sets.
There is a separate file check_symm.cpp which can be used to check the datafile. Running this program checks that the datfile is symmetric and also that all the lines have the right length. check_symm can be run independently of FastIndep. If there is a problem flagged by check_symm it is best to repair the problem and run check_symm again to ensure that there are no further problems with the data set.
To run the check_symm copy the C++ file check_symmp.cpp to a new directory. To create the executable, open a terminal window in the directory containing check_symm.cpp and type:
g++ -O -Wall check_symm.cpp -o check_symm
(In the line above the second flag is minus O, not number zero). This will create an executable check_symm in the directory. Then type:
./check_symm dat.txt
All warning messages will appear on the screen including the lines where there are problems with the data file.
@Article{Abraham2014,
author="Abraham, Kuruvilla Joseph
and Diaz, Clara",
title="Identifying large sets of unrelated individuals and unrelated markers",
journal="Source Code for Biology and Medicine",
year="2014",
month="Mar",
day="17",
volume="9",
number="1",
pages="6",
abstract="Genetic Analyses in large sample populations are important for a better understanding of the variation between populations, for designing conservation programs, for detecting rare mutations which may be risk factors for a variety of diseases, among other reasons. However these analyses frequently assume that the participating individuals or animals are mutually unrelated which may not be the case in large samples, leading to erroneous conclusions. In order to retain as much data as possible while minimizing the risk of false positives it is useful to identify a large subset of relatively unrelated individuals in the population. This can be done using a heuristic for finding a large set of independent of nodes in an undirected graph. We describe a fast randomized heuristic for this purpose. The same methodology can also be used for identifying a suitable set of markers for analyzing population stratification, and other instances where a rapid heuristic for maximal independent sets in large graphs is needed.",
issn="1751-0473",
doi="10.1186/1751-0473-9-6",
url="https://doi.org/10.1186/1751-0473-9-6"
}