001    /*
002     * Copyright 2007, 2012 Stephen Fisher and Junhyong Kim, University of
003     * Pennsylvania.
004     *
005     * This file is part of Glo-DB.
006     * 
007     * Glo-DB is free software: you can redistribute it and/or modify it
008     * under the terms of the GNU General Public License as published by
009     * the Free Software Foundation, either version 3 of the License, or
010     * (at your option) any later version.
011     * 
012     * Glo-DB is distributed in the hope that it will be useful, but
013     * WITHOUT ANY WARRANTY; without even the implied warranty of
014     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
015     * General Public License for more details.
016     * 
017     * You should have received a copy of the GNU General Public License
018     * along with Glo-DB. If not, see <http://www.gnu.org/licenses/>.
019     *
020     * @(#)FASTAParserDefault.java
021     */
022    
023    package edu.upenn.gloDB.io;
024    
025    import java.util.HashMap;
026    
027    /**
028     * The default parser for FASTA headers.  It returns a HashMap that
029     * contains one entry: the key is "FASTA" and the value is the header
030     * line with the leading '>' removed.  Thus no assumptions are made
031     * about the structure of the header, other than it beginning with a
032     * '>'.
033     *
034     * @author  Stephen Fisher
035     * @version $Id: FASTAParserDefault.java,v 1.2.2.4 2007/03/01 21:17:33 fisher Exp $
036     */
037    
038    public class FASTAParserDefault implements FASTAParser {
039             /**
040              * As the default parser, do not process the header at all,
041              * except to remove the leading '>'.  Add the header to
042              * Sequence.attributes using the key 'FASTA'.
043              */
044             public HashMap parseHeader(String header) {
045                      HashMap attributes = new HashMap();
046                      attributes.put("FASTA", header.substring(1));
047                      return attributes;
048             }
049    }
050