Skip to content

MSI load falls to 0 indels /Mb after upgrading PURPLE 4 .0 .2 ➞ 4 .1 #7

Closed

Description

@qclayssen

PR: #4

In the latest version of sash was updated from PURPLE 4.0.2 to 4.1.
Purity, ploidy and TMB stay identical, but msIndelsPerMb drops to 0 for every tumour i re-processed.

exemple:

sample PURPLE 4 .0 .2 PURPLE 4 .1
L2500399 msIndelsPerMb = 0.1095 (MSS) 0.0000
L2500368 msIndelsPerMb = 0.0437 (MSS) 0.0000

PURPLE 4.1 release notes
“VAF 2 % filter for tumour and MSI load”

Activity

  1. self-assigned this
    on May 26, 2025
  2. added
    enhancement
    on May 26, 2025
  3. changed the title [-]MSI load falls to 0 indels /Mb after upgrading PURPLE 4 .0 .1 ➞ 4 .1[/-] [+]MSI load falls to 0 indels /Mb after upgrading PURPLE 4 .0 .2 ➞ 4 .1[/+] on May 26, 2025
  4. qclayssen commented on May 26, 2025

    @qclayssen
    CollaboratorAuthor

    I did run purple PURPLE 4.0.2 with data from sash on oncoanalyser v2 and find the same result as with as with v1 samples.
    But the log between the two version differ

    V4.1

    loaded 238 somatic SVs from L2500399.esvee.somatic.vcf.gz
    load(67.0 tml=67.0000) msiIndels(0 perMb=0.0000) burden(9874.0 perMb=3.4537)
    loaded 17581 germline SVs from L2500399.esvee.germline.vcf.gz
    

    v4.0.2

    loaded 15 somatic SVs from L2500399.esvee.somatic.BND.vcf.gz
    load(67.0 tml=67.0000) msiIndels(313 perMb=0.1095) burden(9874.0 perMb=3.4537)
    loaded 6380 germline SVs from L2500399.esvee.germline.BND.vcf.gz
    

    I made L2500399.esvee.germline.BND.vcf.gz because SGL tag creat error in v4.0.2

    for vcf in L2500399.esvee.{somatic,germline}.vcf.gz
    do
        out=${vcf/.vcf.gz/.BND.vcf.gz}
    
        zcat "$vcf" | \
          sed -e 's/ID=SGL/ID=BND/' \
              -e 's/SVTYPE=SGL/SVTYPE=BND/g' \
              -e 's/<SGL>/<BND>/g' | \
          bgzip -c > "$out"
    
        tabix -p vcf "$out"
    done
    
  5. qclayssen commented on May 27, 2025

    @qclayssen
    CollaboratorAuthor

    PURPLE 4.1 from oncoanalyser 2.0.0 also produces an positive results for L2500399:

    [INFO ] load(62.0 tml=62.0000) msiIndels(267 perMb=0.0934) burden(9425.0 perMb=3.2966)
    
  6. qclayssen commented on May 27, 2025

    @qclayssen
    CollaboratorAuthor

    I test the purple v4.1 on the data with Onconanalyser 1.0.0 and got same msiIndels(0 perMb=0.0000)

  7. added
    bug
    on May 27, 2025
  8. changed the issue type fromtoon May 27, 2025
  9. qclayssen commented on May 27, 2025

    @qclayssen
    CollaboratorAuthor

    From looking at how MSI is calcuated by purple and comparing VCF from oncoanalyser 2.0.0 and the one from sash.
    It looks this fields maybe critical for MSI calculation of purple, and missing from sash vcf

    ##INFO=<ID=RC_REPC,Number=1,Type=Integer,Description="Repeat count from read context">
    ##INFO=<ID=RC_REPS,Number=1,Type=String,Description="Repeat sequence from read context">
    ##INFO=<ID=REP_C,Number=1,Type=Integer,Description="Repeat sequence count">
    ##INFO=<ID=REP_S,Number=1,Type=String,Description="Repeat sequence">
    
  10. qclayssen commented on May 28, 2025

    @qclayssen
    CollaboratorAuthor

    Indeed, adding this fields and values REP_C=5;REP_S=A to indels records. Seams to add them to the count for the MSI

     bcftools view -H smlv_tumor.vcf.gz | grep "REP_C"  | wc -l
    700
    

    Give a purple msiIndels(695 perMb=0.2431)

    How add the field

    if [[ -f "L2500251.pass.pave.vcf.gz" ]]; then
        line_info=$(bcftools view -h L2500251.pass.pave.vcf.gz | grep -n '^##INFO' | cut -f1 -d: | tail -n1)
        rep_c_header='##INFO=<ID=REP_C,Number=1,Type=Integer,Description="Repeat sequence count">'
        rep_s_header='##INFO=<ID=REP_S,Number=1,Type=String,Description="Repeat sequence">'
        tier_header='##INFO=<ID=TIER,Number=1,Type=String,Description="Tier: [HOTSPOT, PANEL, HIGH_CONFIDENCE, LOW_CONFIDENCE]">'
    
        {
            # Add headers properly by creating a temporary header file
            bcftools view -h L2500251.pass.pave.vcf.gz > temp_header.txt
    
            # Insert the new headers after the last INFO line
            awk -v line_info="$line_info" -v rep_c="$rep_c_header" -v rep_s="$rep_s_header" -v tier="$tier_header" '
            NR == line_info {
                print $0
                print rep_c
                print rep_s
                print tier
                next
            }
            { print }
            ' temp_header.txt
    
            rm -f temp_header.txt
    
            # Process variants: add repeat annotations only to indels
            bcftools view -H L2500251.pass.pave.vcf.gz | awk -F$'\t' 'BEGIN { OFS="\t" } {
                # Check if this is an indel (different ref/alt lengths)
                if (length($4) != length($5)) {
                    # Indel: add repeat annotations + TIER
                    $8 = $8 ";REP_C=5;REP_S=A;TIER=HIGH_CONFIDENCE"
                } else {
                    # SNV: add only TIER
                    $8 = $8 ";TIER=HIGH_CONFIDENCE"
                }
                print $0
            }';
        } | bcftools view -Oz -o smlv_tumor.vcf.gz
    
        # Index the output
        bcftools index -t smlv_tumor.vcf.gz
    
    fi
    
  11. pdiakumis commented on May 28, 2025

    @pdiakumis
    Member

    Adding some notes:

    Looking at the history of the MSI-related JAVA file from hmftools: https://github.com/hartwigmedical/hmftools/commits/master/purple/src/main/java/com/hartwig/hmftools/purple/somatic/MicrosatelliteIndels.java

    The latest commit from July 25th 2024 changed some of the VAF filters:
    hartwigmedical/hmftools@fcf76d0

    • VAF 2% filter for tumor and MSI load
    • tumor-only and targeted fits ignore diploid status, no reversion from deleteed genes
    • VAF threshold 35% to use non-hotspot variant in tumor-only fit

    Let's take a look at the VAF distro of the VCFs fed into PURPLE, see if anything pops up.

  12. qclayssen commented on May 28, 2025

    @qclayssen
    CollaboratorAuthor

    Allele frequency distribution of same sample from oncoanalyser and sash v2

    red line represent 2% filter

    Image

    Image

  13. qclayssen commented on May 28, 2025

    @qclayssen
    CollaboratorAuthor

    One possible source of error is purple use AF as filter but may expect SAGE_AF which different from DRAGEN AF

    ##FORMAT=<ID=AF,Number=A,Type=Float,Description="Allele fractions for alt alleles in the order listed">
    ##FORMAT=<ID=SAGE_AF,Number=1,Type=Float,Description="Allelic frequency calculated from read context counts as (Full + Partial + Core + Real igned + Alt) / Coverage">

  14. pdiakumis commented on May 28, 2025

    @pdiakumis
    Member

    But that hasn't changed from the previous sash version, right?

  15. qclayssen commented on May 28, 2025

    @qclayssen
    CollaboratorAuthor

    This hasn't changed in sash, but purple now use AF for filtering (where it expects SAGE_AF)

    VAF 2% filter for tumor and MSI load
    PURPLE 4.1 release notes

  16. qclayssen commented on Jun 4, 2025

    @qclayssen
    CollaboratorAuthor

    We decide to filter out MSI from cancer report summary table for the moment, and use MSI from orange report in oncoanalyser.
    Related Slack thread.
    commit

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugenhancement

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions