32 cout <<
"DEBUG readEMBL: filename=" << filename << endl;
35 ifstream fseq(filename.
c_str());
37 cerr <<
"Error: File " << filename <<
" not opened!" << endl;
42 char item[40], tag[20], seqname[1000];
44 long nid(0), nseq(0), nres;
45 int n(0), m(0), seq_flag(0);
52 while ( !fseq.eof() ) {
54 if ( strncmp(aline,
"ID",2) == 0 ) nid++;
55 if ( strncmp(aline,
"SQ",2) == 0 ) nseq++;
56 memcpy(item, aline, 5);
57 if ( seq_flag && strstr(item,
"//") != NULL ) {
68 for ( i=0; i<strlen(aline); i++ ) {
69 if ( isalpha(aline[i]) ) {
70 seq[m] = toupper(aline[i]);
74 if ( ( aline[i] ==
'-' ) || ( aline[i] ==
'.' ) ) {
79 if ( strstr(item,
"ID") != NULL ) {
80 sscanf(aline,
"%s %s", tag, seqname);
82 if ( strstr(item,
"SQ") != NULL ) {
90 cerr <<
"Error: Number of identifiers (" << nid <<
") don't agree with number of sequences (" << nseq <<
")!" << endl;
108 cout <<
"DEBUG writeEMBL: filename=" << filename << endl;
110 ofstream fseq(filename.
c_str());
112 cerr <<
"Error: File " << filename <<
" not opened!" << endl;
121 for ( mol = molgroup->
mol; mol; mol = mol->
next ) {
125 fseq <<
"ID " << mol->
id << endl;
126 fseq <<
"DE " << mol->
id <<
", " << n <<
" bases, 0 checksum" << endl;
127 fseq <<
"SQ " << n <<
" BP" << endl;
128 for ( j=0; j<n; j+=60 ) {
130 for ( k=j; k<j+60 && k<n; k+=10 ) {
132 strncat(aline, &seq[k], 10);
134 fseq << aline << endl;
136 fseq <<
"//" << endl;