<commit_before>package edu.columbia.gemma.loader.association;

import java.io.IOException;
import java.io.InputStream;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import java.util.zip.GZIPInputStream;

import org.apache.commons.configuration.ConfigurationException;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import edu.columbia.gemma.association.Gene2GOAssociation;
import edu.columbia.gemma.common.description.OntologyEntry;
import edu.columbia.gemma.common.description.OntologyEntryDao;
import edu.columbia.gemma.genome.Gene;
import edu.columbia.gemma.genome.GeneDao;
import edu.columbia.gemma.loader.genome.gene.Parser;
import edu.columbia.gemma.loader.loaderutils.BasicLineMapParser;
import edu.columbia.gemma.loader.loaderutils.LoaderTools;

/**
 * <hr>
 * <p>
 * Copyright (c) 2004 - 2005 Columbia University
 * 
 * @author keshav
 * @version $Id$
 * @spring.bean id="gene2GOAssociationParser"
 * @spring.property name="ontologyEntryDao" ref="ontologyEntryDao"
 * @spring.property name="geneDao" ref="geneDao"
 * @spring.property name="gene2GOAssociationMappings" ref="gene2GOAssociationMappings"
 */

/**
 * <hr>
 * <p>
 * Copyright (c) 2004 - 2005 Columbia University
 * 
 * @author keshav
 * @version $Id$
 */
public class Gene2GOAssociationParserImpl extends BasicLineMapParser implements Parser {
    protected static final Log log = LogFactory.getLog( Gene2GOAssociationParserImpl.class );

    Method methodToInvoke = null;

    Map<String, Gene2GOAssociation> g2GOMap = null;

    private OntologyEntryDao ontologyEntryDao = null;

    private GeneDao geneDao = null;

    private Gene2GOAssociationMappings gene2GOAssociationMappings = null;

    private String filename;

    int i = 0;

    public Gene2GOAssociationParserImpl() {
        g2GOMap = new HashMap();
    }

    /**
     * @param name
     */
    public Gene2GOAssociationParserImpl( String name ) {
        g2GOMap = new HashMap();
        filename = name;
    }

    /**
     * @param is
     * @param lineParseMethod
     * @return Map
     * @throws IOException
     */
    public Map parse( InputStream is, Method lineParseMethod ) throws IOException {
        methodToInvoke = lineParseMethod;
        parse( is );
        LoaderTools.debugMap( g2GOMap );
        return g2GOMap;
    }

    /**
     * @param filename
     * @return Map
     * @throws IOException
     */
    public Map parseFile( String filename ) throws IOException {
        // TODO Auto-generated method stub
        return null;
    }

    /**
     * @param url
     * @return Map
     * @throws IOException
     * @throws ConfigurationException
     */
    public Map parseFromHttp( String url ) throws IOException, ConfigurationException {

        InputStream is = LoaderTools.retrieveByHTTP( url );

        GZIPInputStream gZipInputStream = new GZIPInputStream( is );<commit_msg>*** empty log message ***<commit_after>package edu.columbia.gemma.loader.association;

import java.io.IOException;
import java.io.InputStream;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import java.util.zip.GZIPInputStream;

import org.apache.commons.configuration.ConfigurationException;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import edu.columbia.gemma.association.Gene2GOAssociation;
import edu.columbia.gemma.common.description.OntologyEntry;
import edu.columbia.gemma.common.description.OntologyEntryDao;
import edu.columbia.gemma.genome.Gene;
import edu.columbia.gemma.genome.GeneDao;
import edu.columbia.gemma.loader.genome.gene.Parser;
import edu.columbia.gemma.loader.loaderutils.BasicLineMapParser;
import edu.columbia.gemma.loader.loaderutils.LoaderTools;

/**
 * <hr>
 * <p>
 * Copyright (c) 2004 - 2005 Columbia University
 * 
 * @author keshav
 * @version $Id$
 * @spring.bean id="gene2GOAssociationParser"
 * @spring.property name="ontologyEntryDao" ref="ontologyEntryDao"
 * @spring.property name="geneDao" ref="geneDao"
 * @spring.property name="gene2GOAssociationMappings" ref="gene2GOAssociationMappings"
 */

/**
 * <hr>
 * <p>
 * Copyright (c) 2004 - 2005 Columbia University
 * 
 * @author keshav
 * @version $Id$
 */
public class Gene2GOAssociationParserImpl extends BasicLineMapParser implements Parser {
    protected static final Log log = LogFactory.getLog( Gene2GOAssociationParserImpl.class );

    Method methodToInvoke = null;

    Map<String, Gene2GOAssociation> g2GOMap = null;

    private OntologyEntryDao ontologyEntryDao = null;

    private GeneDao geneDao = null;

    private Gene2GOAssociationMappings gene2GOAssociationMappings = null;

    private String filename;

    int i = 0;

    public Gene2GOAssociationParserImpl() {
        g2GOMap = new HashMap();
    }

    /**
     * @param name
     */
    public Gene2GOAssociationParserImpl( String name ) {
        g2GOMap = new HashMap();
        filename = name;
    }

    /**
     * @param is
     * @param lineParseMethod
     * @return Map
     * @throws IOException
     */
    public Map parse( InputStream is, Method lineParseMethod ) throws IOException {
        methodToInvoke = lineParseMethod;
        parse( is );
        LoaderTools.debugMap( g2GOMap );
        return g2GOMap;
    }

    /**
     * @param filename
     * @return Map
     * @throws IOException
     */
    public Map parseFile( String filename ) throws IOException {
        // TODO implement
        throw new UnsupportedOperationException();
    }

    /**
     * @param url
     * @return Map
     * @throws IOException
     * @throws ConfigurationException
     */
    public Map parseFromHttp( String url ) throws IOException, ConfigurationException {

        InputStream is = LoaderTools.retrieveByHTTP( url );

        GZIPInputStream gZipInputStream = new GZIPInputStream( is );
{'fraction_non_alphanumeric': 0.09903736335454397, 'fraction_numerical': 0.010768477728830151, 'mean_word_length': 3.5644080416976918, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, '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': '6650881', 'n_tokens_mistral': 1907, 'n_tokens_neox': 1818, 'n_words': 409}