Skip to content

Commit

Permalink
Addressed calculation of non-BS mismatches for paired-end data. Closes
Browse files Browse the repository at this point in the history
  • Loading branch information
FelixKrueger committed May 29, 2019
1 parent c752170 commit 2c7aee3
Showing 1 changed file with 16 additions and 14 deletions.
30 changes: 16 additions & 14 deletions bismark
Original file line number Diff line number Diff line change
Expand Up @@ -8570,7 +8570,7 @@ sub paired_end_SAM_output{
}

### CIGAR 2
if ($cigar_2 =~ /(D|I)/) {
if ($cigar_2 =~ /(D|I)/) {
# warn "$cigar_2\n";

# parsing CIGAR string
Expand Down Expand Up @@ -8605,23 +8605,25 @@ sub paired_end_SAM_output{
die "The CIGAR string contained undefined CIGAR operations in addition to 'M', 'I', 'D' and 'N': $cigar_2";
}
}
}

### Now we have InDel corrected Alignment scores

### if the actual sequence contained Ns we need to adjust the number of mismatches. Ns receive a penalty of -1,
### but normal mismatches receive -6. This might still break if the sequence contained more than 5 Ns, but this should occur close to never
### Now we have InDel corrected Alignment scores

my $seq_1_N_count = $number_of_mismatches_1 % 6; # modulo 6 will return the integer rest after the division
my $seq_2_N_count = $number_of_mismatches_2 % 6;
# warn "N count 1: $seq_1_N_count\n";
# warn "N count 2: $seq_2_N_count\n";
### if the actual sequence contained Ns we need to adjust the number of mismatches. Ns receive a penalty of -1,
### but normal mismatches receive -6. This might still break if the sequence contained more than 5 Ns, but this should occur close to never

$number_of_mismatches_1 = int ($number_of_mismatches_1 / 6) + $seq_1_N_count;
$number_of_mismatches_2 = int ($number_of_mismatches_2 / 6) + $seq_2_N_count;
my $seq_1_N_count = $number_of_mismatches_1 % 6; # modulo 6 will return the integer rest after the division
my $seq_2_N_count = $number_of_mismatches_2 % 6;
# warn "N count 1: $seq_1_N_count\n";
# warn "N count 2: $seq_2_N_count\n";

# warn "MM1 $number_of_mismatches_1 \n";
# warn "MM2 $number_of_mismatches_2 \n";
}
$number_of_mismatches_1 = int ($number_of_mismatches_1 / 6) + $seq_1_N_count;
$number_of_mismatches_2 = int ($number_of_mismatches_2 / 6) + $seq_2_N_count;

# warn "MM1 $number_of_mismatches_1 \n";
# warn "MM2 $number_of_mismatches_2 \n";

}

####
Expand Down Expand Up @@ -9430,6 +9432,6 @@ Bismark BAM/SAM OUTPUT (default):
Each read of paired-end alignments is written out in a separate line in the above format.
Last modified on 14 May 2019
Last modified on 29 May 2019
HOW_TO
}

0 comments on commit 2c7aee3

Please sign in to comment.