36 cout <<
"DEBUG readGenBank: filename=" << filename << endl;
39 ifstream fseq(filename.
c_str());
41 cerr <<
"Error: File " << filename <<
" not opened!" << endl;
49 int nid(0), nseq(0), nres(0);
50 int m(0), seq_flag(0);
59 while ( !fseq.eof() ) {
61 if ( strncmp(aline,
"LOCUS", 5) == 0 ) {
62 if ( strstr(aline,
"bp") || strstr(aline,
"DNA") ) type = 1;
65 cout <<
"DEBUG readGenBank: type=" << type << endl;
67 memcpy(item, aline, 12);
69 if ( strncmp(item,
"//", 2) == 0 ) {
83 }
else for ( i=0; i<strlen(aline); i++ ) {
84 if ( isalpha(aline[i]) ) {
85 seq[m] = toupper(aline[i]);
89 if ( ( aline[i] ==
'-' ) || ( aline[i] ==
'.' ) ) {
97 if ( strstr(item,
"LOCUS") != NULL ) {
98 sscanf(aline,
"%s %s", item, seqname);
102 if ( strstr(item,
"ORIGIN") != NULL ) seq_flag++;
108 cout <<
"Number of identifiers (" << nid <<
") don't agree with number of sequences (" << nseq <<
")" << endl;
126 cout <<
"DEBUG writeGenBank: filename=" << filename << endl;
128 ofstream fseq(filename.
c_str());
130 cerr <<
"Error: File " << filename <<
" not opened!" << endl;
140 for ( mol = molgroup->
mol; mol; mol = mol->
next ) {
144 fseq <<
"LOCUS " << mol->
id << endl;
146 fseq <<
"ORIGIN" << endl;
147 for ( j=0; j<n; j+=60 ) {
149 for ( k=j; k<j+60 && k<n; k+=10 ) {
151 strncat(aline, &seq[k], 10);
153 fseq << aline << endl;
155 fseq <<
"//" << endl << endl;