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

/*
 * Copyright (C) 2002-2008 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.io.BufferedReader;
import java.io.StringReader;
import java.util.LinkedHashMap;
import java.util.Set;

import org.intermine.bio.io.gff3.GFF3Parser;
import org.intermine.dataconversion.ItemsTestCase;
import org.intermine.dataconversion.MockItemWriter;
import org.intermine.metadata.Model;

public class LongOligoGFF3RecordHandlerTest extends ItemsTestCase
{
    LongOligoGFF3RecordHandler handler;
    GFF3Converter converter;

    GFF3Parser parser = new GFF3Parser();
    MockItemWriter writer = new MockItemWriter(new LinkedHashMap());
    String seqClsName = "MRNA";
    String taxonId = "7227";
    String dataSetTitle = "INDAC long oligo data set";
    String dataSourceName = "Micklem lab";    

    public LongOligoGFF3RecordHandlerTest(String arg) {
        super(arg);
    }
    
    public void setUp() throws Exception {
        Model tgtModel = Model.getInstanceByName("genomic");
        handler = new LongOligoGFF3RecordHandler(tgtModel);
        LongOligoGFF3SeqHandler seqHandler = new LongOligoGFF3SeqHandler();
        converter = new GFF3Converter(writer, seqClsName, taxonId, dataSourceName, dataSetTitle,
                                      dataSourceName, tgtModel, handler, seqHandler);
    }

    public void tearDown() throws Exception {
        converter.close();
    }

    public void testParse() throws Exception {
        String gff = "CG4314-RA\tINDAC_1.0\tmicroarray_oligo\t0\t0\t.\t.\t.\tID=1000044388;olen=14;oaTm=92.25;geneID=CG4314;Alias=12-CG4314-RA_1;sequence=ACACGGGTCAGGAT";
            BufferedReader srcReader = new BufferedReader(new StringReader(gff));
        converter.parse(srcReader);
        converter.store();

        // uncomment to write a new items xml file
        writeItemsFile(writer.getItems(), "long-oligo_items.xml");

        Set expected = readItemSet("LongOligoGFF3RecordHandlerTest.xml");
        assertEquals(expected, writer.getItems());
    }
}<commit_msg>Don't create temp file from LongOligoGFF3RecordHandlerTest.<commit_after>package org.intermine.bio.dataconversion;

/*
 * Copyright (C) 2002-2008 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.io.BufferedReader;
import java.io.StringReader;
import java.util.LinkedHashMap;
import java.util.Set;

import org.intermine.bio.io.gff3.GFF3Parser;
import org.intermine.dataconversion.ItemsTestCase;
import org.intermine.dataconversion.MockItemWriter;
import org.intermine.metadata.Model;

public class LongOligoGFF3RecordHandlerTest extends ItemsTestCase
{
    LongOligoGFF3RecordHandler handler;
    GFF3Converter converter;

    GFF3Parser parser = new GFF3Parser();
    MockItemWriter writer = new MockItemWriter(new LinkedHashMap());
    String seqClsName = "MRNA";
    String taxonId = "7227";
    String dataSetTitle = "INDAC long oligo data set";
    String dataSourceName = "Micklem lab";

    public LongOligoGFF3RecordHandlerTest(String arg) {
        super(arg);
    }

    public void setUp() throws Exception {
        Model tgtModel = Model.getInstanceByName("genomic");
        handler = new LongOligoGFF3RecordHandler(tgtModel);
        LongOligoGFF3SeqHandler seqHandler = new LongOligoGFF3SeqHandler();
        converter = new GFF3Converter(writer, seqClsName, taxonId, dataSourceName, dataSetTitle,
                                      dataSourceName, tgtModel, handler, seqHandler);
    }

    public void tearDown() throws Exception {
        converter.close();
    }

    public void testParse() throws Exception {
        String gff = "CG4314-RA\tINDAC_1.0\tmicroarray_oligo\t0\t0\t.\t.\t.\tID=1000044388;olen=14;oaTm=92.25;geneID=CG4314;Alias=12-CG4314-RA_1;sequence=ACACGGGTCAGGAT";
            BufferedReader srcReader = new BufferedReader(new StringReader(gff));
        converter.parse(srcReader);
        converter.store();

        // uncomment to write a new items xml file
        // writeItemsFile(writer.getItems(), "/tmp/long-oligo_items.xml");

        Set expected = readItemSet("LongOligoGFF3RecordHandlerTest.xml");
        assertEquals(expected, writer.getItems());
    }
}
{'fraction_non_alphanumeric': 0.09365558912386707, 'fraction_numerical': 0.02611135088476478, 'mean_word_length': 3.607355864811133, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 6}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '382111', 'n_tokens_mistral': 1490, 'n_tokens_neox': 1412, 'n_words': 319}