obidebug(1,"\nError writing in a binary taxonomy file");
close(file_descriptor);
return-1;
}
}
// Close file
if(close(file_descriptor)<0)
{
obi_set_errno(OBIDMS_UNKNOWN_ERROR);
obidebug(1,"\nError closing a DMS information file");
return-1;
}
return0;
}
intwrite_taxonomyidx(OBIDMS_pdms,OBIDMS_taxonomy_ptax,constchar*taxonomy_name)// TODO prefix in taxonomy struct? keep argument but if NULL, use the one in struct?
{
inti;
char*file_name;
intfile_descriptor;
off_tfile_size;
char*taxonomy_path;
int32_tname_length;
int32_trecord_size;
// Compute file size
file_size=sizeof(int32_t);// To store record count
for(i=0;i<(tax->taxa)->count;i++)
{
file_size=file_size+sizeof(int32_t)*5;// To store record size, taxid, rank index, parent index, and name length
file_size=file_size+strlen(tax->taxa->taxon[i].name);// To store name
obidebug(1,"\nError writing in a binary taxonomy file");
close(file_descriptor);
return-1;
}
}
// Close file
if(close(file_descriptor)<0)
{
obi_set_errno(OBIDMS_UNKNOWN_ERROR);
obidebug(1,"\nError closing a DMS information file");
return-1;
}
return0;
}
intwrite_nameidx(OBIDMS_pdms,OBIDMS_taxonomy_ptax,constchar*taxonomy_name)// TODO prefix in taxonomy struct? keep argument but if NULL, use the one in struct?
{
inti;
char*file_name;
intfile_descriptor;
off_tfile_size;
char*taxonomy_path;
int32_tname_length;
int32_tclass_length;
int32_trecord_size;
// Compute file size
file_size=sizeof(int32_t);// To store record count
for(i=0;i<(tax->names)->count;i++)
{
file_size=file_size+sizeof(int32_t)*5;// To store record size, taxid, rank index, parent index, and name length
file_size=file_size+strlen(tax->names->names[i].name);// To store name
file_size=file_size+strlen(tax->names->names[i].class_name);// To store name