<commit_before>package org.phenoscape.kb.ingest.zfin

import scala.collection.JavaConversions._
import scala.collection.mutable
import scala.io.Source

import org.apache.commons.lang3.StringUtils
import org.phenoscape.owl.Vocab._
import org.phenoscape.owl.util.ExpressionUtil
import org.phenoscape.owl.util.OBOUtil
import org.phenoscape.owl.util.OntologyUtil
import org.phenoscape.scowl.OWL._
import org.semanticweb.owlapi.model.OWLAxiom

object ZFINExpressionToOWL {

  def convert(expressionData: Source): Set[OWLAxiom] = expressionData.getLines.flatMap(translate).toSet[OWLAxiom]

  def translate(expressionLine: String): Set[OWLAxiom] = {
    val items = expressionLine.split("\t", -1)
    if (items(0).startsWith("ZDB-EFG")) {
      Set.empty
    } else {
      val axioms = mutable.Set.empty[OWLAxiom]
      val expression = OntologyUtil.nextIndividual()<commit_msg>Added axiom example for ZFIN expression.<commit_after>package org.phenoscape.kb.ingest.zfin

import scala.collection.JavaConversions._
import scala.collection.mutable
import scala.io.Source

import org.apache.commons.lang3.StringUtils
import org.phenoscape.owl.Vocab._
import org.phenoscape.owl.util.ExpressionUtil
import org.phenoscape.owl.util.OBOUtil
import org.phenoscape.owl.util.OntologyUtil
import org.phenoscape.scowl.OWL._
import org.semanticweb.owlapi.model.OWLAxiom

object ZFINExpressionToOWL {

  /**
   * @param expressionData tab-delimited input from http://zfin.org/downloads/wildtype-expression_fish.txt
   * Each line (an annotation) is translated into a set of OWL axioms
   * @return
   */
  def convert(expressionData: Source): Set[OWLAxiom] = expressionData.getLines.flatMap(translate).toSet[OWLAxiom]

  /**
   * @param expressionLine
   * Example line:
   * ZDB-GENE-000125-4	dlc	AB/TU	ZFA:0000107	eye	\ 	\ 	Pharyngula:Prim-15	Pharyngula:Prim-25	mRNA in situ hybridization	ZDB-PUB-051025-1	ZDB-EST-051107-52		ZDB-FISH-150901-29084
   * Should generate OWL:
   *
   * Prefix: GO: <http://purl.obolibrary.org/obo/GO_>
   * Prefix: NCBITaxon: <http://purl.obolibrary.org/obo/NCBITaxon_>
   * Prefix: ZFA: <http://purl.obolibrary.org/obo/ZFA_>
   * Prefix: BFO: <http://purl.obolibrary.org/obo/BFO_>
   * Prefix: dc: <http://purl.org/dc/terms/>
   * Prefix: ps: <http://purl.org/phenoscape/vocab.owl#>
   * Prefix: zfin: <http://zfin.org/>
   * Prefix: uuid: <http://purl.org/phenoscape/uuid/>
   * 
   *
   * Individual: uuid:033ab9ee-e20a-4049-8780-24c422bb3c90
   *     Types: ZFA:0000107 # eye
   *
   * Individual: zfin:ZDB-GENE-000125-4 # dlc
   *
   * Individual: uuid:3e1ad895-56b2-4b54-a3f8-c99e7b42f646
   *     Types: GO:0010467 # gene expression
   *     Facts:
   *         ps:associated_with_taxon  NCBITaxon:7955, # Danio rerio
   *         dc:source                 zfin:ZDB-PUB-051025-1, 
   *         BFO:0000066               uuid:033ab9ee-e20a-4049-8780-24c422bb3c90, # occurs_in that eye
   *         ps:associated_with_gene   zfin:ZDB-GENE-000125-4 # dlc
   *
   * @return
   */
  def translate(expressionLine: String): Set[OWLAxiom] = {
    val items = expressionLine.split("\t", -1)
    if (items(0).startsWith("ZDB-EFG")) {
      Set.empty
    } else {
      val axioms = mutable.Set.empty[OWLAxiom]
      val expression = OntologyUtil.nextIndividual()
{'fraction_non_alphanumeric': 0.12542061792597126, 'fraction_numerical': 0.04925053533190578, 'mean_word_length': 3.535367545076283, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1794110', 'n_tokens_mistral': 1380, 'n_tokens_neox': 1230, 'n_words': 192}