; simplification

default
{
    ; number of iterations in basic simplification cycle
    cycle_iter_count 10

    ; enable advanced simplification algo
    post_simplif_enabled true
    
    ; enable advanced ec removal algo
    topology_simplif_enabled false
    
    ; tip clipper:
    tc
    {
        ; rctc: tip_cov < rctc * not_tip_cov
        ; tc_lb: max_tip_length = max((min(k, read_length / 2) * tc_lb), read_length);
        ; todo think about params one more time
        condition               "{ tc_lb 3.5, cb 1000000, rctc 2.0 } { tc_lb 10., cb auto }"
    }
  
	; bulge remover:
	br
	{
		enabled				true
        main_iteration_only false
		max_bulge_length_coefficient	3.	; max_bulge_length = max_bulge_length_coefficient * k
       	max_additive_length_coefficient 100
		max_coverage			1000.0
		max_relative_coverage		1.1	; bulge_cov < this * not_bulge_cov
		max_delta			3
		max_relative_delta		0.1
        max_number_edges        1000
        parallel true
        buff_size 10000
        buff_cov_diff 2.
        buff_cov_rel_diff 0.2
	}
	
	; erroneous connections remover:
	ec
	{
       ; ec_lb: max_ec_length = k + ec_lb
       ; icb: iterative coverage bound
       ; to_ec_lb: max_ec_length = 2*tip_length(to_ec_lb) - 1
        condition               "{ to_ec_lb 5, icb auto }"
       ; condition               "{ ec_lb 9, icb 40.0 }"
    }
    
    ; relative coverage erroneous component remover:
    rcc
    {
        enabled false
        coverage_gap    5.
        max_length_coeff    2.0
        max_length_with_tips_coeff   3.0
        max_vertex_cnt      30
        max_ec_length_coefficient   30
        max_coverage_coeff  2.0
    }
    
    ; relative edge disconnector:
    relative_ed
    {
        enabled false
        diff_mult  20.
    }

    ; final tip clipper:
    final_tc
    {
        condition               ""
    }

    ; final bulge remover:
    final_br
    {
        enabled				false
        main_iteration_only false
        max_bulge_length_coefficient	3.	; max_bulge_length = max_bulge_length_coefficient * k
        max_additive_length_coefficient 100
        max_coverage			1000.0
        max_relative_coverage		1.1	; bulge_cov < this * not_bulge_cov
        max_delta			3
        max_relative_delta		0.1
        max_number_edges        1000
        parallel true
        buff_size 10000
        buff_cov_diff 2.
        buff_cov_rel_diff 0.2
    }
    
    ; topology based erroneous connection remover
    tec
    {
        max_ec_length_coefficient   55  ; max_ec_length = k + max_ec_length_coefficient
        uniqueness_length       5000
        plausibility_length     200
    }

    ; topology and reliability based erroneous connection remover
    trec
    {
        max_ec_length_coefficient   100 ; max_ec_length = k + max_ec_length_coefficient
        uniqueness_length       1500
        unreliable_coverage     2.5
    }
    
    ; interstrand erroneous connection remover (thorn remover)
    isec
    {
        max_ec_length_coefficient   100 ; max_ec_length = k + max_ec_length_coefficient
        uniqueness_length       1500
        span_distance       15000
    }

    ; max flow erroneous connection remover
    mfec
    {
        enabled false
        max_ec_length_coefficient   30  ; max_ec_length = k + max_ec_length_coefficient
        uniqueness_length       1500
        plausibility_length     200
    }
    
    piec
    {
        max_ec_length_coefficient   30  ; max_ec_length = k + max_ec_length_coefficient
        min_neighbour_length        100
    }

    ; isolated edges remover
    ier
    {
        enabled                     true
        max_length                  0
        max_coverage                2
        max_length_any_cov          150 ; will be taken max with read_length 
    }
    
    ; topology tip clipper:
    ttc
    {
        length_coeff    3.5
        plausibility_length 250
        uniqueness_length   1500
    }

    ; complex tip clipper
    complex_tc
    {
    enabled 0
    }       

    ; complex bulge remover
    cbr
    {
        enabled false
        max_relative_length 5.
        max_length_difference   5
    }

    ; hidden ec remover
    her
    {
        enabled false
        uniqueness_length           1500
        unreliability_threshold     4
        relative_threshold          5     
    }

    init_clean
    {
        self_conj_condition "{ ec_lb 100, cb 1.0 }"
        early_it_only   false
       ; will be enabled only if average coverage \leq activate_cov
        activation_cov  10.

        ; isolated edges remover
        ier
        {
            enabled                     true
            max_length                  0
            max_coverage                0
            max_length_any_cov          0 ; will be taken max with read_length 
        }

        tip_condition   "{ tc_lb 3.5, cb auto }"
        ec_condition    "{ ec_lb 10, cb 2.0 }"
        ; edges with flank cov around alternative less than value will be disconnected 
        ; negative value to disable
        disconnect_flank_cov    -1.0
    }
    
}

sc
{
    ; enable advanced ec removal algo
    topology_simplif_enabled true 

    ; tip clipper:
    tc
    {
        ; rctc: tip_cov < rctc * not_tip_cov
        ; tc_lb: max_tip_length = max((min(k, read_length / 2) * tc_lb), read_length);
        condition               "{ tc_lb 3.5, cb 1000000, rctc 2.0 }"
	}

	; erroneous connections remover:
	ec
	{
       ; ec_lb: max_ec_length = k + ec_lb
       ; icb: iterative coverage bound
       ; condition               "{ ec_lb 30, icb 20.0 }"
       condition               "{ ec_lb 30, icb auto }"
    }
    
    final_tc
    {
        condition               "{ tc_lb 3.5, cb 100000, rctc 10000 }"
    }

	; bulge remover:
	final_br
	{
        enabled true
		max_coverage			1000000.0
		max_relative_coverage		100000.		; bulge_cov < this * not_bulge_cov
	}
	
    ; relative coverage erroneous component remover:
    rcc
    {
        enabled true
        coverage_gap    20.
        max_length_coeff    2.0
        max_length_with_tips_coeff   3.0
        max_vertex_cnt      30
        max_ec_length_coefficient   30
        max_coverage_coeff  5.0
    }
    
    tec
    {
        max_ec_length_coefficient   55  ; max_ec_length = k + max_ec_length_coefficient
        uniqueness_length       1500
        plausibility_length     200
    }
    
    ; topology and reliability based erroneous connection remover
    trec
    {
        max_ec_length_coefficient   100 ; max_ec_length = k + max_ec_length_coefficient
        uniqueness_length       1500
        unreliable_coverage     2.5
    }
    
    ; topology tip clipper:
    ttc
    {
        length_coeff    3.5
        plausibility_length 250
        uniqueness_length   1500
    }

    ; complex bulge remover
    cbr
    {
        enabled true
    }

    ; hidden ec remover
    her
    {
        enabled                     true
        uniqueness_length           1500
        unreliability_threshold     0.2
        relative_threshold          5     
    }

    init_clean
    {
        activation_cov  -1.
        ier
        {
            enabled false
        }

        tip_condition   ""
        ec_condition    ""
    }
}

moleculo
{
    ; enable advanced ec removal algo
    topology_simplif_enabled false 

    ; tip clipper:
    tc
    {
        ; rctc: tip_cov < rctc * not_tip_cov
        ; tc_lb: max_tip_length = max((min(k, read_length / 2) * tc_lb), read_length);
        condition               "{ tc_lb 2.5, cb 3, rctc 10000 } { tc_lb 4.5, mmm 2 }"
    }

    ; bulge remover:
    br
    {
        max_coverage            3
        max_relative_coverage       100000.     ; bulge_cov < this * not_bulge_cov
    }
    
    ; erroneous connections remover:
    ec
    {
       ; ec_lb: max_ec_length = k + ec_lb
       ; icb: iterative coverage bound
       ; condition               "{ ec_lb 30, icb 20.0 }"
       condition               "{ ec_lb 30, icb 3.1 }"
    }
    
    ; relative coverage erroneous component remover:
    rcc
    {
        enabled true
        coverage_gap    20.
        max_length_coeff    2.0
        max_length_with_tips_coeff   3.0
        max_vertex_cnt      30
        max_ec_length_coefficient   30
        max_coverage_coeff  5.0
    }
    
    tec
    {
        max_ec_length_coefficient   55  ; max_ec_length = k + max_ec_length_coefficient
        uniqueness_length       1500
        plausibility_length     200
    }
    
    ; topology and reliability based erroneous connection remover
    trec
    {
        max_ec_length_coefficient   100 ; max_ec_length = k + max_ec_length_coefficient
        uniqueness_length       1500
        unreliable_coverage     2.5
    }
    
    ; topology tip clipper:
    ttc
    {
        length_coeff    3.5
        plausibility_length 250
        uniqueness_length   1500
    }

    ; complex bulge remover
    cbr
    {
        enabled true
        pics_enabled 0
        folder  complex_br_components 
        max_relative_length 5.
        max_length_difference   5
    }

    ; hidden ec remover
    her
    {
        enabled                     true
        uniqueness_length           1500
        unreliability_threshold     0.2
        relative_threshold          5     
    }

    init_clean
    {
        early_it_only   true

        activation_cov  -1.
        ier
        {
            enabled                     false
        }

        tip_condition   ""
        ec_condition    ""
    }
}

careful
{
    ; bulge remover:
    br
    {
        max_coverage            1000000.0
        max_relative_coverage       1.5     ; bulge_cov < this * not_bulge_cov
        parallel false
    }
    
    ; complex bulge remover
    cbr
    {
        enabled false
    }

    ; relative coverage erroneous component remover:
    rcc
    {
        enabled false
    }

    init_clean
    {
        early_it_only   true

        activation_cov  -1.
        ier
        {
            enabled                     false
        }

        tip_condition   ""
        ec_condition    ""
    }
}

diploid_simp
{
    post_simplif_enabled false

	; bulge remover:
	br
	{
		enabled				false
	}
}

meta
{
    cycle_iter_count 3

    ; enable advanced ec removal algo
    topology_simplif_enabled false

    ; erroneous connections remover:
    ec
    {
       ; ec_lb: max_ec_length = k + ec_lb
       ; icb: iterative coverage bound
       ; condition               "{ ec_lb 30, icb 20.0 }"
       condition               "{ ec_lb 30, icb 2.5 }"
    }
    
    ; tip clipper:
    tc
    {
        ; rctc: tip_cov < rctc * not_tip_cov
        ; tc_lb: max_tip_length = max((min(k, read_length / 2) * tc_lb), read_length);
        condition               "{ tc_lb 3.5, cb 10000 } { tc_lb 6., cb 2.5 }"
    }

    ; relative coverage erroneous component remover:
    rcc
    {
        enabled true
        coverage_gap    5.
        max_length_coeff    3.0
        max_length_with_tips_coeff   5.0
        max_vertex_cnt      100
        max_ec_length_coefficient   300
        max_coverage_coeff  -1.0
	}

	; relative edge disconnector:
	relative_ed
	{
        enabled true
        diff_mult  10.
	}

	; bulge remover:
	br
	{
		max_coverage			1000000.0
		max_relative_coverage		100000.		; bulge_cov < this * not_bulge_cov
		max_delta			10
		max_relative_delta		0.1
        parallel true
	}

    ; final tip clipper:
    final_tc
    {
        ; rctc: tip_cov < rctc * not_tip_cov
        ; tc_lb: max_tip_length = max((min(k, read_length / 2) * tc_lb), read_length);
        condition               "{ lb 500, cb 3., rctc 1.0 } { lb 1500, cb 20., rctc 0.2 }"
    }

    ; final bulge remover:
    final_br
    {
        enabled true
        main_iteration_only true
        max_bulge_length_coefficient    50.     ; max_bulge_length = max_bulge_length_coefficient * k
        max_coverage			1000000.0
        max_relative_coverage       0.5     ; bulge_cov < this * not_bulge_cov
        max_delta           50
        max_relative_delta		0.1
    }

    ; second final bulge remover:
    ; only in meta mode, inherits settings of final_br
    second_final_br
    {
        max_delta           1500
        max_number_edges        3
    }

    init_clean
    {
       early_it_only   true
       ier {
           enabled true
       }
       tip_condition   "{ tc_lb 3.5, cb 2.0 }"
       ec_condition    "{ ec_lb 10, cb 0.5 }"
    }

}

preliminary
{
    init_clean
    {
        self_conj_condition "{ ec_lb 100, cb 20.0 }"
        early_it_only   false
        ier
        {
            enabled true
        }
        tip_condition   "{ lb 20, cb 1.1, mmm 2 }"
        ec_condition    "{ ec_lb 0, cb 0.9 }"
        disconnect_flank_cov    0.9
    }

    post_simplif_enabled false

	; bulge remover:
	br
	{
		max_coverage			1000000.0
		max_relative_coverage		0.5		; bulge_cov < this * not_bulge_cov
		max_delta			10
		max_relative_delta		0.1
	}
	
}
