<commit_before>#!/usr/bin/env node

var http = require('q-io/http')
  , fs = require('fs')
  , collections = require('gramene-mongodb-config')
  , _ = require('lodash')
  , Q = require('q');

var genesURL = process.argv[2];

var optionalFields = ['comment','xref','synonym'];
var mongo2solr = {
  GO: function(doc,genes,specificity) {
    var categoryLabel = {
      molecular_function : 'GO function',
      biological_process : 'GO process',
      cellular_component : 'GO component'
    };
    var solr = {
      category: categoryLabel[doc.namespace],
      int_id: doc._id,
      id: doc.id,
      display_name: doc.name,
      name: doc.name,
      def: doc.def,
      fq_field: 'GO__ancestors',
      fq_value: doc._id,
      num_genes: genes,
      relevance: 1.1 - 0.1/Math.sqrt(specificity) // prioritize less specific GO terms
    };
    if (doc.subset && doc.subset.indexOf('goslim_plant') !== -1) {
      solr.relevance+=0.1; // give goslim_plant terms a nice boost
    }
    optionalFields.forEach(function(f) {
      if (doc.hasOwnProperty(f)) {
        solr[f] = doc[f];
      }
    });
    return solr;
  },
  PO: function(doc,genes,specificity) {
    var categoryLabel = {
      plant_anatomy : 'Plant anatomy',
      plant_structure_development_stage: 'Plant structural/developmental stage'
    };
    var solr = {
      category: categoryLabel[doc.namespace], // 'Plant ontology',<commit_msg>update goslim_plant relevance function to penalize non-goslim_plant instead of boost goslim_plant<commit_after>#!/usr/bin/env node

var http = require('q-io/http')
  , fs = require('fs')
  , collections = require('gramene-mongodb-config')
  , _ = require('lodash')
  , Q = require('q');

var genesURL = process.argv[2];

var optionalFields = ['comment','xref','synonym'];
var mongo2solr = {
  GO: function(doc,genes,specificity) {
    var categoryLabel = {
      molecular_function : 'GO function',
      biological_process : 'GO process',
      cellular_component : 'GO component'
    };
    var solr = {
      category: categoryLabel[doc.namespace],
      int_id: doc._id,
      id: doc.id,
      display_name: doc.name,
      name: doc.name,
      def: doc.def,
      fq_field: 'GO__ancestors',
      fq_value: doc._id,
      num_genes: genes,
      relevance: 1.1 - 0.1/Math.sqrt(specificity) // prioritize less specific GO terms
    };
    if (doc.subset && doc.subset.indexOf('goslim_plant') === -1) {
      solr.relevance-=0.05; // penalize non-goslim_plant terms
    }
    optionalFields.forEach(function(f) {
      if (doc.hasOwnProperty(f)) {
        solr[f] = doc[f];
      }
    });
    return solr;
  },
  PO: function(doc,genes,specificity) {
    var categoryLabel = {
      plant_anatomy : 'Plant anatomy',
      plant_structure_development_stage: 'Plant structural/developmental stage'
    };
    var solr = {
      category: categoryLabel[doc.namespace], // 'Plant ontology',
{'fraction_non_alphanumeric': 0.14049586776859505, 'fraction_numerical': 0.0065426997245179065, 'mean_word_length': 2.9416553595658073, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '3261790', 'n_tokens_mistral': 993, 'n_tokens_neox': 962, 'n_words': 198}