1) Install package
    unzip phasiRNAnalyzer.zip
    cd phasiRNAnalyzer
2) Data pre-processing
    
Format conversion: ./phasiRNAnalyzer format -i ./data/example.txt -it g -n 1000000 -ot fn -o 1_example_norm.fa
    
Filter reads: ./phasiRNAnalyzer filter -i 1_example_norm.fa -min 16 -max 26 -count 1.0 -o 2_example_norm_filter.fa
3) Build index for cDNA or genome library
    
For cDNA library: ./phasiRNAnalyzer bowtie-build ./data/oryza_sativa_cdna.fa ./index/oryza_sativa_cdna_index
    
For genome library: ./phasiRNAnalyzer bowtie-build ./data/oryza_sativa_genome_chr12.fa ./index/oryza_sativa_genome_chr12_index
4) Mapping of small RNA
    
For cDNA library: ./phasiRNAnalyzer bowtie -t -v 0 -p 8 -m 10 -f -a ./index/oryza_sativa_cdna_index 2_example_norm_filter.fa 3_example_norm_filter.map
    
For genome library: ./phasiRNAnalyzer bowtie -t -v 0 -p 8 -m 10 -f -a ./index/oryza_sativa_genome_chr12_index 2_example_norm_filter.fa 3_example_norm_filter.map
5) Phased siRNA and PHAS gene prediction
    
For cDNA library: ./phasiRNAnalyzer phase -i 3_example_norm_filter.map -o 4_example_results_tmp.21.xls -all 4_example_results_total.21.xls -l 21 -p 0.001 -m 4 -s 0 -n 0 -c -a ./data/oryza_sativa_cdna_annotation.txt -fin ./data/oryza_sativa_cdna.fa -fout 4_example_PHAS_gene.fa
    
For genome library: ./phasiRNAnalyzer phase -i 3_example_norm_filter.map -o 4_example_results_tmp.21.xls -all 4_example_results_total.21.xls -l 21 -p 0.001 -m 4 -s 0 -n 0 -j ./data/oryza_sativa_genome_chr12_annotation.gff3 -fin ./data/oryza_sativa_genome_chr12.fa -fout 4_example_PHAS_gene.fa
6) Get targets of phase-initiator from putative PHAS gene:
    # If the file (5_example_prediction.txt) already exists, please delete or change the name of it.
    
Offline: ./phasiRNAnalyzer prediction -q ./data/oryza_sativa_miRNA.fa -b 4_example_PHAS_gene.fa -o 5_example_prediction.txt -t -T 4 -f 6
    
Online: Please upload all possible phase-initiator (usually miRNA) and
PHAS gene to
psRNAtarget, and get putative targets of phase-initiator. The downloadable predictions are required for the next step.
7) Phase-initiator prediction
    ./phasiRNAnalyzer initiator -i 4_example_results_tmp.21.xls -j 5_example_prediction.txt -pd 105 -pl 21 -ps 1 -o 6_example_initiator.txt
8) Visualization of results
    
Single run: ./phasiRNAnalyzer tool -r 2 -l 21 -q 10 -c data/oryza_sativa_cdna.fa -i 4_example_results_tmp.21.xls -j 4_example_results_total.21.xls -m 6_example_initiator.txt
    
Batch run:
    for i in `awk '{print $NF}' 4_example_results_tmp.21.xls | sort | uniq`
    do
        ./phasiRNAnalyzer tool -r $i -l 21 -q 10 -c ./data/oryza_sativa_cdna.fa -i 4_example_results_tmp.21.xls -j 4_example_results_total.21.xls -m 6_example_initiator.txt
    done