Download Latest Version SimData.zip (57.1 MB) Google Add to Preferred Sources
Home
Name Modified Size InfoDownloads / Week
Python_Implementation 2016-11-04
MATLAB_Implementation 2016-11-03
Fosmid.pdf 2017-04-24 91.5 kB
README.txt 2016-11-04 4.7 kB
SimData.zip 2016-11-03 57.1 MB
Totals: 5 Items   57.2 MB 0
AltHap

AltHap is a haplotyping assembly method for diploid, polyploid, and polyallelic polyploid organisms. The method formulates the haplotype assembly problem as a tensor factorization proplem and exploits the special structures of the factors.

AltHap is implemented in Python and MATLAB. 
Note: The current implementations assume that the input file contains a connected component. The preprocessing step to handle disconnected componenets will be added in near future.


------------------------------------------------------------------------------------------------
MATLAB implementation

1. Usage in terminal:

matlab -nojvm -r "AltHap(ploidy,'input_file.txt','output_file.txt');exit"

The first two inputs are mandatory. If output_file is not given, the results will be saved in 'AltHap-output.txt'.
Please refer to the source code for a detailed explanation of other options which are mainly related to the stopping criteria.
Please refer to the end of this file for a detailed explanation of input and output files format.



2. Run a simple example:

In this example, 'sim0.txt' is the input fragment file, ploidy = 3, and the results are saved in 'AltHap-output.txt'. 
There are 3 ways to run this example:

- In terminal write: matlab -nojvm -r "AltHap(3,'sim0.txt');exit"

- In terminal write: matlab -nojvm -nodesktop < ./simple_example.m

- Run the 'AltHapSimple.sh' file in terminal. This file would then run the 'simple_example.m' file.



3. Reproduce the simulation results on simulated data:

First unzip the 'SimData.zip' file in the directory that 'AltHap.m', 'SimDataAltHap.m', and 'AltHapSimulation.sh' are located. 
There are 2 ways to reproduce the results:

- In terminal write: matlab -nojvm -nodesktop < ./SimDataAltHap.m

- Run the 'AltHapSimulation.sh' file in terminal. This file would then run the 'SimDataAltHap.m' file.

The output for each input file will then be saved in the same directory.


--------------------------------------------------------------------------------------------------Python implementation

1. Prerequest

In python version of AltHap, we use python 2.7.12, numpy 1.10.4, scipy 0.17.0 and Anaconda 4.0.0 (which may not be necessary).

2. Usage

usage: python AltHap.py [OPTIONS]

The parameters to AltHap are given in -<parameter> <value> or
--<parameter>=<value> pairs if there are arguments or -<parameter> or
--<parameter> for boolean switches.

Example usage:

python AltHap.py -i sim0.txt -p 3

3. Required arguments

To get AltHap run, 2 parameters are required: input file name and ploidy, the easiest command line is as shown above in Usage part.

-i, --input <input file name>: 
Specify the path of input file the algorithm takes in

-p, --ploidy <ploidy number>:
Specify the number of haplotype sequences (e.g., 2 for humans) to recover.

4. Optional arguments

-o, --output <output file name>:
Specify the path of output file

-h, --help:
Print out the usage of this code and exit

-s, --sumproj:
Turn off the entry normalization for V during iteration (Only for ployploid ployallelic case)

-m, --maxiter <max iterations>:
Specify maximum number of iteration

-t, --threshold <threshold>:
Specify the threshold for iteration


--------------------------------------------------------------------------------------------------
Input file format

The input file format is as follows

Number of reads
Number of columns
Number of contiguos segments  Read identifier 	Position of first SNP segment		Continuous bases in read 	 Position of next SNP segment	Continuous bases in read ..... Quality scores (in fastq format)

- Example for Biallelic:

5568 
22801
2 chr22_SPA9_8733 2 0 5 0 ==
1 chr22_SPH2_1940 3 100 C==

- Example for Polyallelic:

4500
1000
2	chr3_1	1	13103	37	1132	IIIIIIIII
2	chr3_2	1	1310321	46	110302	IIIIIIIIIIIII
2	chr3_3	1	3220001	44	3001	IIIIIIIIIII
2	chr3_4	1	322000	40	30023	IIIIIIIIIII


-------------------------------------------------------------------------------------------------
Output file format 

The output file contains MEC score, CPU Time, and Recovered Haplotypes. Subsequently, the phased haplotype is printed in the following format:
first haplotype		second haplotype 	third haplotype 	...

- Example for Biallelic:

MEC: 353
CPU Time: 38.363051
Recovered Haplotype:
0 1 1  
1 0 1  
0 0 1  
1 1 1  
0 1 1  
1 0 0  
1 0 1  
1 1 1  

- Example for Polyallelic:

MEC: 51
CPU Time: 28.912201
Recovered Haplotype:
1 1 1  
1 0 0  
3 3 1  
2 2 0  
1 3 1  
3 0 0  
0 0 2  
3 2 0  

For higher ploidy, there are K phased haplotypes instead of 3.


--------------------------------------------------------------------------------------------------




Source: README.txt, updated 2016-11-04