mode    meta

; two-step pipeline
two_step_rr true
; enables/disables usage of intermediate contigs in two-step pipeline
use_intermediate_contigs true

;if true simple mismatches are corrected
correct_mismatches          false

;flanking coverage range
flanking_range 30

simp
{
    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 1000000, rctc 2.0 } { tc_lb 6., cb 2.5, rctc 1.0 }"
    }

    ; 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
    }

    ; complex tip clipper
    complex_tc
    {
        enabled               true
    }
    
    ; 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 0.7 } { 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
    }

    ; hidden ec remover
    her
    {
        enabled                     true
        uniqueness_length           1500
        unreliability_threshold     -1.
        relative_threshold          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 }"
    }

}

;FIXME rename
preliminary_simp
{
    init_clean
    {
        self_conj_condition "{ ec_lb 100, cb 20.0 }"
        early_it_only   false
        ier
        {
            enabled true
        }
        tip_condition   "{ rlmk, cb 1.2, mmm 2 }"
        ec_condition    "{ ec_lb 0, cb 0.9 }"
        disconnect_flank_cov    0.8
    }

    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
	}
	
}

; undo single cell config changes, enforce filtering
de
{
    raw_filter_threshold	1
    rounding_coeff              0.5 ; rounding : min(de_max_distance * rounding_coeff, rounding_thr)
    rounding_threshold          0
}

;NB decsends from sc_pe
pe {

long_reads {
    pacbio_reads {
        filtering   1.9
        weight_priority    20.0
        unique_edge_priority 10.0
        min_significant_overlap 1000
    }
}

params {
    remove_overlaps     true
    cut_all_overlaps  true

    scaffolding_mode old_pe_2015

    normalize_weight     true
    
    ; extension selection
    extension_options
    {
        use_default_single_threshold true
        single_threshold           0.3
        weight_threshold           0.6
        priority_coeff             1.5
        max_repeat_length          1000000 
    }
    
    use_coordinated_coverage true
}

}

prelim_pe {
params {
    scaffolding_mode old

    use_coordinated_coverage false
    remove_overlaps     false
    scaffolding2015 {
        min_unique_length 100000000
    }
}
}
