32 cout <<
"DEBUG readPIR: filename=" << filename << endl;
35 ifstream fseq(filename.
c_str());
37 cerr <<
"Error: File " << filename <<
" not opened!" << endl;
44 int nid(0), nseq(0), nres;
45 int m(0), seq_flag(0);
54 nres = nid = nseq = 0;
55 while ( !fseq.eof() ) {
57 memcpy(item, aline, 5);
59 for ( i=0; i<strlen(aline); i++ ) {
60 if ( isalpha(aline[i]) ) {
61 seq[m] = toupper(aline[i]);
65 if ( ( aline[i] ==
'-' ) || ( aline[i] ==
'.' ) ) {
71 if ( aline[i] ==
'*' ) {
83 if ( seq_flag == 1 ) seq_flag++;
84 if ( strstr(item,
">P1") != NULL ) {
85 sscanf(aline,
">P1;%s", seqname);
94 cout <<
"Number of identifiers (" << nid <<
") don't agree with number of sequences (" << nseq <<
")" << endl;
112 cout <<
"DEBUG writePIR: filename=" << filename << endl;
114 ofstream fseq(filename.
c_str());
116 cerr <<
"Error: File " << filename <<
" not opened!" << endl;
126 for ( mol = molgroup->
mol; mol; mol = mol->
next ) {
130 fseq <<
">P1;" << mol->
id << endl;
131 fseq << mol->
id <<
", " << mol->
nres <<
" bases, 0 checksum" << endl;
132 for ( j=0; j<n; j+=50 ) {
134 for ( k=j; k<j+50 && k<n; k+=10 ) {
136 strncat(aline, &seq[k], 10);
139 fseq << aline << endl;