File: FileParser.h

package info (click to toggle)
clustalx 2.1%2Blgpl-8
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 3,320 kB
  • sloc: cpp: 40,050; sh: 163; xml: 102; makefile: 16
file content (63 lines) | stat: -rw-r--r-- 1,895 bytes parent folder | download | duplicates (11)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
/**
 * Author: Mark Larkin
 * 
 * Copyright (c) 2007 Des Higgins, Julie Thompson and Toby Gibson.  
 */
/** The aim of this class is to return one sequence at a time.
 * Note that the file must be open when it is passed to the FileParser.
 * The parser does not know the name of the file to open. Only the filereader knows.
 *
 * Changes: 
 *
 * Mark 24-1-2007. I added the function findDelimiter to determine if '\r' or '\n' 
 * will be used as the line delimiter when parsing the file.
 *
 * 10-02-07,Nigel Brown(EMBL): Removed delimiter and findDelimiter()
 * members, as functionality now handled by the stream class.
 */
#ifndef FILEPARSER_H
#define FILEPARSER_H

#include <ctype.h>
#include "../alignment/Sequence.h"
#include "../general/userparams.h"
#include <iostream>
#include "InFileStream.h"

namespace clustalw
{
 
class FileParser
{
    public:
        /* Functions */
        FileParser();
        virtual ~FileParser();
        virtual vector<Sequence> getSeqRange(int firstSeq, int num, string *offendingSeq) = 0;
        virtual Sequence getSeq(int seqNum, string *offendingSeq=NULL) = 0;
        virtual int countSeqs() = 0; // VIRTUAL 
        virtual void getSecStructure(vector<char>& gapPenaltyMask, 
                                     vector<char>& secStructMask,
                                     string& secStructName, int &structPenalties, int length) = 0;
        void fillCharTab(void);
        char getDelimiter(string filename);
        /* Attributes */
        char chartab[128];
        int getParseExitCode() { return parseExitCode; };
        
    protected:
        void freeFileResources(InFileStream* filePtr);
        InFileStream* _fileIn;
        int parseExitCode; // reason for returning empty sequence
                           // vector; same as used in FileReader

    private:
        /* Functions */

        /* Attributes */

};

}
#endif