00001 #ifndef KZ_SEQ_H 00002 #define KZ_SEQ_H 00003 #include <fstream.h> 00004 #include <sys/types.h> 00005 00006 /* $Id: kzseq.h,v 1.1.1.1 2007-07-13 03:44:06 kzhou Exp $ */ 00007 00008 class kzseq { 00009 private: 00010 char *seq; //the sequence data string 00011 //stored in UPPER case 00012 char *header; 00013 int slen; /* bytes in seq, not including '\0' */ 00014 int maxlen; //maximum allocated space 00015 bool rc; //wheather the seq string is derived from 00016 //the original sequence by reverse-complement 00017 00018 public: 00019 kzseq(); 00020 kzseq(int alloc); //if alloc = 0, no allocation of 00021 //dynamic memory 00022 ~kzseq(); 00023 bool readSeq(ifstream &infs, char ln[]); 00024 //reads in the one sequence at 00025 //a time, return true if success 00026 //will use old allocated memory 00027 void fastRead(caddr_t hstart, caddr_t sstart, size_t seqLen); 00028 const char* seqchar() const {return seq; } 00029 int seqlen() const { return slen; } 00030 int headlen() const { return strlen(header); } 00031 const char* seqhead() const {return header; } 00032 const char* getHeader() const { return header; } 00033 void getName(char name[]) const; 00034 void revcomp(char rc[]) const; //create an reverse complement string 00035 //the String will be in UPPER case 00036 kzseq& revcomp(); //reverse complement the sequence only 00037 //the resulting sequence string will be in UPPER case 00038 //the original sequence will be changed 00039 void seq2upper(); 00040 void polyATsize(int &pA, int &pT) const; 00041 bool isDNA() const; 00042 kzseq &operator=(const kzseq &ks); 00043 void copyRevcomp(const kzseq &ks); //creates a copy and reverse-complement it 00044 }; 00045 00046 unsigned long* readIndex(char inf[], int &seqCnt); 00047 #endif
1.5.6