#Use input file with format "chrom start end sample cell class scalar num_bins sv_call_name sv_call_haplotype sv_call_name_2nd sv_call_haplotype_2nd llr_to_ref llr_to_2nd af"
#
...
...
@@ -13,8 +15,9 @@ my $input_file = $ARGV[0];
if(!$ARGV[0]){
printSTDERR"Input filname missinf=g (use e.g. sv_calls_txt_file_all/RPE1-WT/100000_fixed_norm.selected_j0.01_s0.1/simpleCalls_llr4_poppriorsTRUE_haplotagsTRUE_gtcutoff0.05_regfactor6.txt )\n";
printSTDERR"Filters inversions unless they are seen at least $min_N_inv times.\n";
printSTDERR"Filters deletions only seen in WW and CC chromosomes\n";
printSTDERR"Filters duplications only seen in WW and CC chromosomes (but gives inv-dups seen in such context a PASS)\n";
printSTDERR"Filters deletions seen in less then $min_WC WC chromosomes\n";
printSTDERR"Filters duplications seen in less then $min_WC WC chromosomes (but gives inv-dups seen in such context a PASS)\n";
printSTDERR"Del and Dup events with llr_to_ref>=$safe_llr_to_ref will never be masked\n";
printSTDERR"-> cluster into groups by chromosome, if similar AF (relative threshold=$AF_simiarity_threshold), if same SV event, if SVs are directly adjacent, and if at least one cell shared\n";
my($chrom,$start,$end,$sample,$cell,$strand_state_class,$scalar,$num_bins,$sv_call_name,$sv_call_haplotype,$sv_call_name_2nd,$sv_call_haplotype_2nd,$llr_to_ref,$llr_to_2nd,$af,$passfail)=split(/[\t ]+/,$_);#split by TAB/whitespace
#--- cluster into groups by chromosome, if similar averaged AF, same primary SV type, directly adjacent call, and at least one cell shared
my$group_name=0;
foreachmy$chrom(sortkeys%STARTs){
my$previous_shared=0;
for(my$i=0;$i<@{$STARTs{$chrom}}-1;$i++){
unless($ENDs{$chrom}[$i]==$STARTs{$chrom}[$i+1]){#only consider events that are directly adjacent
$previous_shared=0;#initialize
next;
}
unless(($averaged_AF{$chrom}{$STARTs{$chrom}[$i]}/$averaged_AF{$chrom}{$STARTs{$chrom}[$i+1]}>= (1-$AF_simiarity_threshold)) and ($averaged_AF{$chrom}{$STARTs{$chrom}[$i+1]}/$averaged_AF{$chrom}{$STARTs{$chrom}[$i]}>=(1-$AF_simiarity_threshold))){#compare AFs
$previous_shared=0;#initialize
next;
}
unless($MAIN_SV_TYPE{$chrom}{$STARTs{$chrom}[$i]}eq$MAIN_SV_TYPE{$chrom}{$STARTs{$chrom}[$i+1]}){#must be same primary SV type