<commit_before>import QtQuick 2.9
import QtQuick.Controls 2.2
import QtQuick.Controls 1.4
import QtQuick.Layouts 1.3
import org.regovar 1.0

import "../../Regovar"
import "../../Framework"
import "../Common"


ScrollView
{
    id: root
    horizontalScrollBarPolicy: Qt.ScrollBarAlwaysOff

    property var geneData
    property var model
    onModelChanged: updateFromModel(model)
    Component.onCompleted: updateFromModel(model)

    function updateFromModel(data)
    {
        if (data)
        {
            if ("gene" in data)
                geneData = data["gene"];
            else
                geneData = data;
        }
    }

    Column
    {
        x: 10
        y: 10
        width: root.width - 30

        TextEdit
        {
            clip: true
            width: root.width - 30
            text: formatInfo(geneData)
            textFormat: TextEdit.RichText
            font.pixelSize: Regovar.theme.font.size.normal + 2
            color: Regovar.theme.frontColor.normal
            readOnly: true
            selectByMouse: true
            selectByKeyboard: true
            wrapMode: TextEdit.Wrap
            onLinkActivated: Qt.openUrlExternally(link)
        }
        Item
        {
            width: 1
            height: 10
        }
    }


    function formatInfo(data)
    {
        if (!data) return "";

        var text = "<table>";
        text += "<tr><td><b>Name:</b></td><td>" + data["name"] + "</td></tr>";
        text += "<tr><td><b>Symbol:</b></td><td>" + data["symbol"] + "</td></tr>";
        text += "<tr><td><b>HGNC Id:</b></td><td><a href=\"https://www.genenames.org/cgi-bin/gene_symbol_report?hgnc_id=" + data["hgnc_id"] + "\">" + data["hgnc_id"] + "</a></td></tr>";
        text += "<tr><td><b>Location:</b></td><td>" + data["location"] + "</td></tr>";
        text += "<tr><td><b>Locus type:</b></td><td>" + data["locus_type"] + "</td></tr>";
        // Former names/symbols
        text += "<tr><td><b>Former names:</b></td><td>";
        if ("prev_symbol" in data)
        {
            for (var idx=0; idx<data["prev_symbol"].length; idx++)
            {
                text += "<i>" + data["prev_symbol"][idx] + "</i>, ";
            }
        }
        text += "</td></tr>";

        // Synonyms
        text += "<tr><td><b>Synonyms:</b></td><td>";
        if ("alias_symbol" in data)
        {
            for (var idx=0; idx<data["alias_symbol"].length; idx++)
            {
                text += "<i>" + data["alias_symbol"][idx] + "</i>, ";
            }
        }
        text += "</td></tr>";
        // text += "<tr><td><b>:</b></td><td>" + data[""] + "</td></tr>";
        text += "</table><br/><br/>";

        // Genomes references<commit_msg>fix #124<commit_after>import QtQuick 2.9
import QtQuick.Controls 2.2
import QtQuick.Controls 1.4
import QtQuick.Layouts 1.3
import org.regovar 1.0

import "../../Regovar"
import "../../Framework"
import "../Common"


ScrollView
{
    id: root
    horizontalScrollBarPolicy: Qt.ScrollBarAlwaysOff

    property var geneData
    property var model
    onModelChanged: updateFromModel(model)
    Component.onCompleted: updateFromModel(model)

    function updateFromModel(data)
    {
        if (data)
        {
            if ("gene" in data)
                geneData = data["gene"];
            else
                geneData = data;
        }
    }

    Column
    {
        x: 10
        y: 10
        width: root.width - 30

        TextEdit
        {
            clip: true
            width: root.width - 30
            text: formatInfo(geneData)
            textFormat: TextEdit.RichText
            font.pixelSize: Regovar.theme.font.size.normal + 2
            color: Regovar.theme.frontColor.normal
            readOnly: true
            selectByMouse: true
            selectByKeyboard: true
            wrapMode: TextEdit.Wrap
            onLinkActivated: Qt.openUrlExternally(link)
        }
        Item
        {
            width: 1
            height: 10
        }
    }


    function formatInfo(data)
    {
        if (!data) return "";

        var text = "<b>HGNC informations:</b><table>";
        text += "<tr><td><b>Name:</b></td><td>" + data["name"] + "</td></tr>";
        text += "<tr><td><b>Symbol:</b></td><td>" + data["symbol"] + "</td></tr>";
        text += "<tr><td><b>HGNC Id:</b></td><td><a href=\"https://www.genenames.org/cgi-bin/gene_symbol_report?hgnc_id=" + data["hgnc_id"] + "\">" + data["hgnc_id"] + "</a></td></tr>";
        text += "<tr><td><b>Location:</b></td><td>" + data["location"] + "</td></tr>";
        text += "<tr><td><b>Locus type:</b></td><td>" + data["locus_type"] + "</td></tr>";
        // Former names/symbols
        text += "<tr><td><b>Former names:</b></td><td>";
        if ("prev_symbol" in data)
        {
            for (var idx=0; idx<data["prev_symbol"].length; idx++)
            {
                text += "<i>" + data["prev_symbol"][idx] + "</i>, ";
            }
        }
        text += "</td></tr>";

        // Synonyms
        text += "<tr><td><b>Synonyms:</b></td><td>";
        if ("alias_symbol" in data)
        {
            for (var idx=0; idx<data["alias_symbol"].length; idx++)
            {
                text += "<i>" + data["alias_symbol"][idx] + "</i>, ";
            }
        }
        text += "</td></tr>";
        // text += "<tr><td><b>:</b></td><td>" + data[""] + "</td></tr>";
        text += "</table><br/><br/>";

        // Genomes references
{'fraction_non_alphanumeric': 0.1924203588429147, 'fraction_numerical': 0.009337239106554375, 'mean_word_length': 1.7702839756592292, 'pattern_counts': {'":': 0, '<': 157, '<?xml version=': 0, '>': 153, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1678404', 'n_tokens_mistral': 1777, 'n_tokens_neox': 1697, 'n_words': 331}