<commit_before>package org.intermine.bio.dataconversion;

/*
 * Copyright (C) 2002-2005 FlyMine
 *
 * This code may be freely distributed and modified under the
 * terms of the GNU Lesser General Public Licence.  This should
 * be distributed with the code.  See the LICENSE file for more
 * information or http://www.gnu.org/copyleft/lesser.html.
 *
 */

import java.util.HashMap;
import java.util.Map;
import java.util.List;

import org.intermine.metadata.Model;
import org.intermine.xml.full.Item;
import org.intermine.util.XmlUtil;

import org.intermine.bio.dataconversion.GFF3RecordHandler;
import org.intermine.bio.io.gff3.GFF3Record;

/**
 * A converter/retriever for the Drosophila tiling path GFF3 files.
 *
 * @author <NAME>
 */

public class TilingPathGFF3RecordHandler extends GFF3RecordHandler
{
    private Map references;

    /**
     * Create a new TilingPathGFF3RecordHandler for the given target model.
     * @param tgtModel the model for which items will be created
     */
    public TilingPathGFF3RecordHandler (Model tgtModel) {
        super(tgtModel);

        // create a map of classname to reference name for parent references
        // this will add the parents of any SimpleRelations from getParents() to the
        // given collection
        references = new HashMap();
        references.put("PCRProduct", "tilingPathSpan");
        references.put("ForwardPrimer", "pcrProduct");
        references.put("ReversePrimer", "pcrProduct");
    }

    /**
     * @see GFF3RecordHandler#process(GFF3Record)
     */
    public void process(GFF3Record record) {
        Item feature = getFeature();
        String clsName = XmlUtil.getFragmentFromURI(feature.getClassName());

        List newIds = (List) record.getAttributes().get("newID");
        if (newIds != null) {
            String newId = (String) newIds.get(0);
            addSynonym(feature, "name", newId);
            feature.setAttribute("name", newId);
        }
        
        List oldIds = (List) record.getAttributes().get("oldID");
        if (oldIds != null) {
            String oldId = (String) oldIds.get(0);
            if (!oldId.equals(record.getId())) {<commit_msg>Use the newID attribute as the identifier field when reading the tiling_path source.<commit_after>package org.intermine.bio.dataconversion;

/*
 * Copyright (C) 2002-2005 FlyMine
 *
 * This code may be freely distributed and modified under the
 * terms of the GNU Lesser General Public Licence.  This should
 * be distributed with the code.  See the LICENSE file for more
 * information or http://www.gnu.org/copyleft/lesser.html.
 *
 */

import java.util.HashMap;
import java.util.Map;
import java.util.List;

import org.intermine.metadata.Model;
import org.intermine.xml.full.Item;
import org.intermine.util.XmlUtil;

import org.intermine.bio.dataconversion.GFF3RecordHandler;
import org.intermine.bio.io.gff3.GFF3Record;

/**
 * A converter/retriever for the Drosophila tiling path GFF3 files.
 *
 * @author <NAME>
 */

public class TilingPathGFF3RecordHandler extends GFF3RecordHandler
{
    private Map references;

    /**
     * Create a new TilingPathGFF3RecordHandler for the given target model.
     * @param tgtModel the model for which items will be created
     */
    public TilingPathGFF3RecordHandler (Model tgtModel) {
        super(tgtModel);

        // create a map of classname to reference name for parent references
        // this will add the parents of any SimpleRelations from getParents() to the
        // given collection
        references = new HashMap();
        references.put("PCRProduct", "tilingPathSpan");
        references.put("ForwardPrimer", "pcrProduct");
        references.put("ReversePrimer", "pcrProduct");
    }

    /**
     * @see GFF3RecordHandler#process(GFF3Record)
     */
    public void process(GFF3Record record) {
        Item feature = getFeature();
        String clsName = XmlUtil.getFragmentFromURI(feature.getClassName());

        List newIds = (List) record.getAttributes().get("newID");
        if (newIds != null) {
            String newId = (String) newIds.get(0);
            addSynonym(feature, "identifier", newId);
            feature.setAttribute("identifier", newId);
        }
        
        List oldIds = (List) record.getAttributes().get("oldID");
        if (oldIds != null) {
            String oldId = (String) oldIds.get(0);
            if (!oldId.equals(record.getId())) {
{'fraction_non_alphanumeric': 0.10539381629429023, 'fraction_numerical': 0.009478672985781991, 'mean_word_length': 3.007233273056058, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 2}, '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': '2684110', 'n_tokens_mistral': 1309, 'n_tokens_neox': 1284, 'n_words': 360}