<commit_before>package org.opencb.bionetdb.core.network;

import org.apache.commons.lang3.StringUtils;
import org.opencb.commons.datastore.core.ObjectMap;

import java.util.ArrayList;
import java.util.List;

public class Relation {

    private long uid;

    private String name;

    private long origUid;
    private Node.Type origType;

    private long destUid;
    private Node.Type destType;

    private Type type;
    private List<String> tags;

    private String source;

    private ObjectMap attributes;

    private static long counter = 0;

    public Relation(long uid, String name, long origUid, Node.Type origType, long destUid, Node.Type destType, Type type) {
        this (uid, name, origUid, origType, destUid, destType, type, null);
    }

    public Relation(long uid, String name, long origUid, Node.Type origType, long destUid, Node.Type destType, Type type, String source) {
        this.uid = uid;

        this.name = name;

        this.origUid = origUid;
        this.origType = origType;

        this.destUid = destUid;
        this.destType = destType;

        this.type = type;
        this.tags = new ArrayList<>(1);
        if (StringUtils.isNotEmpty(type.name())) {
            tags.add(type.name());
        }

        this.source = source;

        this.attributes = new ObjectMap();

        counter++;
    }

    public enum Type {
        COMPONENT_OF_PATHWAY("COMPONENT_OF_PATHWAY"),
        PATHWAY_NEXT_STEP("PATHWAY_NEXT_STEP"),

        REACTION            ("REACTION"),
        CATALYSIS           ("CATALYSIS"),
        REGULATION          ("REGULATION"),
        COLOCALIZATION      ("COLOCALIZATION"),
        CONSEQUENCE_TYPE    ("CONSEQUENCE_TYPE"),
        TRANSCRIPT          ("TRANSCRIPT"),
        SO                  ("SO"),
        GENE                ("GENE"),
        XREF                ("XREF"),
        POPULATION_FREQUENCY("POPULATION_FREQUENCY"),
        CONSERVATION        ("CONSERVATION"),
        FUNCTIONAL_SCORE    ("FUNCTIONAL_SCORE"),
        SUBSTITUTION_SCORE("SUBSTITUTION_SCORE"),
        PROTEIN("PROTEIN"),
        PROTEIN_FEATURE("PROTEIN_FEATURE"),
        TRAIT_ASSOCIATION("TRAIT_ASSOCIATION"),
        ANNOTATION("ANNOTATION"),
        DISEASE("DISEASE"),
        DRUG("DRUG"),
        EXPRESSION("EXPRESSION"),
        INTERACTION("INTERACTION"),
        COMPONENT_OF_COMPLEX("COMPONENT_OF_COMPLEX"),
        STOICHIOMETRY("STOICHIOMETRY"),
        ONTOLOGY("ONTOLOGY"),
        CELLULAR_LOCATION("CELLULAR_LOCATION"),
        CONTROLLED("CONTROLLED"),
        CONTROLLER("CONTROLLER"),
        COFACTOR("COFACTOR"),
        PRODUCT("PRODUCT"),
        REACTANT("REACTANT"),
        VARIANT_FILE_INFO("VARIANT_FILE_INFO"),
        VARIANT_CALL("VARIANT_CALL"),

        TRANSCRIPT_ANNOTATION_FLAG("TRANSCRIPT_ANNOTATION_FLAG"),
        EXON_OVERLAP("EXON_OVERLAP"),
        PROTEIN_KEYWORD("PROTEIN_KEYWORD"),
        PROTEIN_VARIANT_ANNOTATION("PROTEIN_VARIANT_ANNOTATION"),
        TFBS("TFBS"),

//        RNA__MIRNA("RNA__MIRNA"),
        MIRNA__TARGET_TRANSCRIPT("MIRNA__TARGET_TRANSCRIPT"),
        TARGET_TRANSCRIPT__TRANSCRIPT("TARGET_TRANSCRIPT__TRANSCRIPT"),

        TRANSCRIPT__PROTEIN("TRANSCRIPT__PROTEIN"),
        VARIANT__VARIANT_CALL("VARIANT__VARIANT_CALL"),
        VARIANT__CONSEQUENCE_TYPE("VARIANT__CONSEQUENCE_TYPE"),
        VARIANT__POPULATION_FREQUENCY("VARIANT__POPULATION_FREQUENCY"),
        VARIANT__CONSERVATION("VARIANT__CONSERVATION"),
        VARIANT__TRAIT_ASSOCIATION("VARIANT__TRAIT_ASSOCIATION"),
        VARIANT__FUNCTIONAL_SCORE("VARIANT__FUNCTIONAL_SCORE"),
        CONSEQUENCE_TYPE__SO("CONSEQUENCE_TYPE__SO"),
        CONSEQUENCE_TYPE__PROTEIN_VARIANT_ANNOTATION("CONSEQUENCE_TYPE__PROTEIN_VARIANT_ANNOTATION"),
        CONSEQUENCE_TYPE__GENE("CONSEQUENCE_TYPE__GENE"),
        CONSEQUENCE_TYPE__TRANSCRIPT("CONSEQUENCE_TYPE__TRANSCRIPT"),
        GENE__TRANSCRIPT("GENE__TRANSCRIPT"),
        GENE__DRUG("GENE__DRUG"),
        GENE__DISEASE("GENE__DISEASE"),
        TRANSCRIPT__TFBS("TRANSCRIPT__TFBS"),
        PROTEIN_VARIANT_ANNOTATION__PROTEIN("PROTEIN_VARIANT_ANNOTATION__PROTEIN"),
        PROTEIN_VARIANT_ANNOTATION__SUBSTITUTION_SCORE("PROTEIN_VARIANT_ANNOTATION__SUBSTITUTION_SCORE"),
        PROTEIN_VARIANT_ANNOTATION__PROTEIN_KEYWORD("PROTEIN_VARIANT_ANNOTATION__PROTEIN_KEYWORD"),
        PROTEIN_VARIANT_ANNOTATION__PROTEIN_FEATURE("PROTEIN_VARIANT_ANNOTATION__PROTEIN_FEATURE"),
        PROTEIN__PROTEIN_KEYWORD("PROTEIN__PROTEIN_KEYWORD"),
        PROTEIN__PROTEIN_FEATURE("PROTEIN__PROTEIN_FEATURE"),
        SAMPLE__VARIANT_CALL("SAMPLE__VARIANT_CALL"),<commit_msg>core: adds the relationships TARGET_GENE and IS in the enum containing all relationship types<commit_after>package org.opencb.bionetdb.core.network;

import org.apache.commons.lang3.StringUtils;
import org.opencb.commons.datastore.core.ObjectMap;

import java.util.ArrayList;
import java.util.List;

public class Relation {

    private long uid;

    private String name;

    private long origUid;
    private Node.Type origType;

    private long destUid;
    private Node.Type destType;

    private Type type;
    private List<String> tags;

    private String source;

    private ObjectMap attributes;

    private static long counter = 0;

    public Relation(long uid, String name, long origUid, Node.Type origType, long destUid, Node.Type destType, Type type) {
        this (uid, name, origUid, origType, destUid, destType, type, null);
    }

    public Relation(long uid, String name, long origUid, Node.Type origType, long destUid, Node.Type destType, Type type, String source) {
        this.uid = uid;

        this.name = name;

        this.origUid = origUid;
        this.origType = origType;

        this.destUid = destUid;
        this.destType = destType;

        this.type = type;
        this.tags = new ArrayList<>(1);
        if (StringUtils.isNotEmpty(type.name())) {
            tags.add(type.name());
        }

        this.source = source;

        this.attributes = new ObjectMap();

        counter++;
    }

    public enum Type {
        IS                  ("IS"),

        COMPONENT_OF_PATHWAY("COMPONENT_OF_PATHWAY"),
        PATHWAY_NEXT_STEP   ("PATHWAY_NEXT_STEP"),

        REACTION            ("REACTION"),
        CATALYSIS           ("CATALYSIS"),
        REGULATION          ("REGULATION"),
        COLOCALIZATION      ("COLOCALIZATION"),
        CONSEQUENCE_TYPE    ("CONSEQUENCE_TYPE"),
        TRANSCRIPT          ("TRANSCRIPT"),
        SO                  ("SO"),
        GENE                ("GENE"),
        XREF                ("XREF"),
        POPULATION_FREQUENCY("POPULATION_FREQUENCY"),
        CONSERVATION        ("CONSERVATION"),
        FUNCTIONAL_SCORE    ("FUNCTIONAL_SCORE"),
        SUBSTITUTION_SCORE("SUBSTITUTION_SCORE"),
        PROTEIN("PROTEIN"),
        PROTEIN_FEATURE("PROTEIN_FEATURE"),
        TRAIT_ASSOCIATION("TRAIT_ASSOCIATION"),
        ANNOTATION("ANNOTATION"),
        DISEASE("DISEASE"),
        DRUG("DRUG"),
        EXPRESSION("EXPRESSION"),
        INTERACTION("INTERACTION"),
        COMPONENT_OF_COMPLEX("COMPONENT_OF_COMPLEX"),
        STOICHIOMETRY("STOICHIOMETRY"),
        ONTOLOGY("ONTOLOGY"),
        CELLULAR_LOCATION("CELLULAR_LOCATION"),
        CONTROLLED("CONTROLLED"),
        CONTROLLER("CONTROLLER"),
        COFACTOR("COFACTOR"),
        PRODUCT("PRODUCT"),
        REACTANT("REACTANT"),
        VARIANT_FILE_INFO("VARIANT_FILE_INFO"),
        VARIANT_CALL("VARIANT_CALL"),

        TRANSCRIPT_ANNOTATION_FLAG("TRANSCRIPT_ANNOTATION_FLAG"),
        EXON_OVERLAP("EXON_OVERLAP"),
        PROTEIN_KEYWORD("PROTEIN_KEYWORD"),
        PROTEIN_VARIANT_ANNOTATION("PROTEIN_VARIANT_ANNOTATION"),
        TFBS("TFBS"),

//        RNA__MIRNA("RNA__MIRNA"),
        TARGET_GENE         ("TARGET_GENE"),
        MIRNA__TARGET_TRANSCRIPT("MIRNA__TARGET_TRANSCRIPT"),
        TARGET_TRANSCRIPT__TRANSCRIPT("TARGET_TRANSCRIPT__TRANSCRIPT"),

        TRANSCRIPT__PROTEIN("TRANSCRIPT__PROTEIN"),
        VARIANT__VARIANT_CALL("VARIANT__VARIANT_CALL"),
        VARIANT__CONSEQUENCE_TYPE("VARIANT__CONSEQUENCE_TYPE"),
        VARIANT__POPULATION_FREQUENCY("VARIANT__POPULATION_FREQUENCY"),
        VARIANT__CONSERVATION("VARIANT__CONSERVATION"),
        VARIANT__TRAIT_ASSOCIATION("VARIANT__TRAIT_ASSOCIATION"),
        VARIANT__FUNCTIONAL_SCORE("VARIANT__FUNCTIONAL_SCORE"),
        CONSEQUENCE_TYPE__SO("CONSEQUENCE_TYPE__SO"),
        CONSEQUENCE_TYPE__PROTEIN_VARIANT_ANNOTATION("CONSEQUENCE_TYPE__PROTEIN_VARIANT_ANNOTATION"),
        CONSEQUENCE_TYPE__GENE("CONSEQUENCE_TYPE__GENE"),
        CONSEQUENCE_TYPE__TRANSCRIPT("CONSEQUENCE_TYPE__TRANSCRIPT"),
        GENE__TRANSCRIPT("GENE__TRANSCRIPT"),
        GENE__DRUG("GENE__DRUG"),
        GENE__DISEASE("GENE__DISEASE"),
        TRANSCRIPT__TFBS("TRANSCRIPT__TFBS"),
        PROTEIN_VARIANT_ANNOTATION__PROTEIN("PROTEIN_VARIANT_ANNOTATION__PROTEIN"),
        PROTEIN_VARIANT_ANNOTATION__SUBSTITUTION_SCORE("PROTEIN_VARIANT_ANNOTATION__SUBSTITUTION_SCORE"),
        PROTEIN_VARIANT_ANNOTATION__PROTEIN_KEYWORD("PROTEIN_VARIANT_ANNOTATION__PROTEIN_KEYWORD"),
        PROTEIN_VARIANT_ANNOTATION__PROTEIN_FEATURE("PROTEIN_VARIANT_ANNOTATION__PROTEIN_FEATURE"),
        PROTEIN__PROTEIN_KEYWORD("PROTEIN__PROTEIN_KEYWORD"),
        PROTEIN__PROTEIN_FEATURE("PROTEIN__PROTEIN_FEATURE"),
        SAMPLE__VARIANT_CALL("SAMPLE__VARIANT_CALL"),
{'fraction_non_alphanumeric': 0.09820193637621023, 'fraction_numerical': 0.0006383657835939994, 'mean_word_length': 3.2323277802791535, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '3525082', 'n_tokens_mistral': 3263, 'n_tokens_neox': 3139, 'n_words': 403}