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

/*
 * Copyright (C) 2002-2010 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.regex.Matcher;
import java.util.regex.Pattern;

import org.intermine.model.bio.Location;
import org.intermine.model.bio.Organism;
import org.intermine.model.bio.Region;
import org.intermine.model.bio.SequenceFeature;
import org.intermine.objectstore.ObjectStoreException;

/**
 * Code for loading fasta for flybase, setting feature attribute from the FASTA header.
 * @author <NAME>
 */
public class FlyBaseFeatureFastaLoaderTask extends FastaLoaderTask
{
    private Map<String, Region> chrMap = new HashMap<String, Region>();

    /**
     * Return a Chromosome object for the given item.
     * @param chromosomeId the id
     * @param organism the Organism to reference from the Chromosome
     * @return the Chromosome
     * @throws ObjectStoreException if problem fetching Chromosome
     */
    protected Region getChromosome(String chromosomeId, Organism organism)
        throws ObjectStoreException {
        if (chrMap.containsKey(chromosomeId)) {
            return chrMap.get(chromosomeId);
        }
        Region chr = (Region) getDirectDataLoader().createObject(Region.class);
        chr.setPrimaryIdentifier(chromosomeId);
        chr.setOrganism(organism);
        chr.addDataSets(getDataSet());<commit_msg>load chromosome as feature instead of region.<commit_after>package org.intermine.bio.dataconversion;

/*
 * Copyright (C) 2002-2010 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.regex.Matcher;
import java.util.regex.Pattern;

import org.intermine.model.bio.Location;
import org.intermine.model.bio.Organism;
import org.intermine.model.bio.SequenceFeature;
import org.intermine.objectstore.ObjectStoreException;

/**
 * Code for loading fasta for flybase, setting feature attribute from the FASTA header.
 * @author <NAME>
 */
public class FlyBaseFeatureFastaLoaderTask extends FastaLoaderTask
{
    private Map<String, SequenceFeature> chrMap = new HashMap<String, SequenceFeature>();

    /**
     * Return a Chromosome object for the given item.
     * @param chromosomeId the id
     * @param organism the Organism to reference from the Chromosome
     * @return the Chromosome
     * @throws ObjectStoreException if problem fetching Chromosome
     */
    protected SequenceFeature getChromosome(String chromosomeId, Organism organism)
        throws ObjectStoreException {
        if (chrMap.containsKey(chromosomeId)) {
            return chrMap.get(chromosomeId);
        }
        SequenceFeature chr = (SequenceFeature) getDirectDataLoader().createObject(
                SequenceFeature.class);
        chr.setPrimaryIdentifier(chromosomeId);
        chr.setOrganism(organism);
        chr.addDataSets(getDataSet());
{'fraction_non_alphanumeric': 0.08625817965496728, 'fraction_numerical': 0.004759071980963712, 'mean_word_length': 3.7433004231311706, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, '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': '2775014', 'n_tokens_mistral': 972, 'n_tokens_neox': 905, 'n_words': 272}