package function.external.knownvar;

import function.annotation.base.AnnotatedVariant;
import java.util.StringJoiner;
import utils.FormatManager;

/**
 *
 * @author nick
 */
public class KnownVarOutput {

    private HGMDOutput hgmdOutput;
    private ClinVarOutput clinVarOutput;
    private ClinVarPathoratio clinVarPathoratio;
    private ClinGen clinGen;
    private String omimDiseaseName;
    private int recessiveCarrier;
    private String acmg;
    private DBDSMOutput dbDSMOutput;

    public static String getTitle() {
        return "Variant ID,"
                + "Gene Name,"
                + KnownVarManager.getTitle();
    }

    public KnownVarOutput(AnnotatedVariant annotatedVar) {
        String geneName = annotatedVar.getGeneName().toUpperCase();
        hgmdOutput = KnownVarManager.getHGMDOutput(annotatedVar);
        clinVarOutput = KnownVarManager.getClinVarOutput(annotatedVar);
        clinVarPathoratio = KnownVarManager.getClinPathoratio(geneName);
        clinGen = KnownVarManager.getClinGen(geneName);
        omimDiseaseName = KnownVarManager.getOMIM(geneName);
        recessiveCarrier = KnownVarManager.getRecessiveCarrier(geneName);
        acmg = KnownVarManager.getACMG(geneName);
        dbDSMOutput = KnownVarManager.getDBDSMOutput(annotatedVar);
    }

    public StringJoiner getStringJoiner() {
        StringJoiner sj = new StringJoiner(",");

        sj.merge(hgmdOutput.getStringJoiner());
        sj.merge(clinVarOutput.getStringJoiner());
        sj.merge(clinVarPathoratio.getStringJoiner());
        sj.merge(clinGen.getStringJoiner());
        sj.add(omimDiseaseName);
        sj.add(FormatManager.getInteger(recessiveCarrier));
        sj.add(acmg);
        sj.merge(dbDSMOutput.getStringJoiner());

        return sj;
    }
    
    @Override
    public String toString() {
        return getStringJoiner().toString();
    }
}

@@ -80,16 +80,61 @@
 ariant;%0A
+import function.annotation.base.GeneManager;%0A
 import j
@@ -766,16 +766,44 @@
 eName = 
+GeneManager.getUpToDateGene(
 annotate
@@ -820,16 +820,17 @@
 neName()
+)
 .toUpper

use UpToDate gene to get values from KnownVar dataset - issue 4260