Add management of local taxa from the new extension of the OBI Taxonomy library
git-svn-id: https://www.grenoble.prabi.fr/svn/LECASofts/ecoPCR/trunk@315 60f365c0-8329-0410-b2a4-ec073aeeaa1d
This commit is contained in:
@ -527,6 +527,7 @@ int main(int argc, char **argv)
|
|||||||
o1c = complementPattern(o1);
|
o1c = complementPattern(o1);
|
||||||
o2c = complementPattern(o2);
|
o2c = complementPattern(o2);
|
||||||
|
|
||||||
|
printf("#@ecopcr-v2\n");
|
||||||
printf("#\n");
|
printf("#\n");
|
||||||
printf("# ecoPCR version %s\n",VERSION);
|
printf("# ecoPCR version %s\n",VERSION);
|
||||||
printf("# direct strand oligo1 : %-32s ; oligo2c : %32s\n", o1->cpat,o2c->cpat);
|
printf("# direct strand oligo1 : %-32s ; oligo2c : %32s\n", o1->cpat,o2c->cpat);
|
||||||
|
@ -220,7 +220,7 @@ econameidx_t *read_nameidx(const char *filename,ecotaxonomy_t *taxonomy);
|
|||||||
* @return pointer to a taxonomy index structure
|
* @return pointer to a taxonomy index structure
|
||||||
*/
|
*/
|
||||||
|
|
||||||
ecotxidx_t *read_taxonomyidx(const char *filename);
|
ecotxidx_t *read_taxonomyidx(const char *filename,const char *filename2);
|
||||||
|
|
||||||
ecotaxonomy_t *read_taxonomy(const char *prefix,int32_t readAlternativeName);
|
ecotaxonomy_t *read_taxonomy(const char *prefix,int32_t readAlternativeName);
|
||||||
|
|
||||||
|
@ -169,7 +169,7 @@ FILE *open_seqfile(const char *prefix,int32_t index)
|
|||||||
prefix,
|
prefix,
|
||||||
index);
|
index);
|
||||||
|
|
||||||
fprintf(stderr,"# Coucou %s\n",filename_buffer);
|
// fprintf(stderr,"# Coucou %s\n",filename_buffer);
|
||||||
|
|
||||||
|
|
||||||
if (filename_length >= 1024)
|
if (filename_length >= 1024)
|
||||||
|
@ -10,23 +10,41 @@ static ecotx_t *readnext_ecotaxon(FILE *f,ecotx_t *taxon);
|
|||||||
* @param pointer to the database (.tdx file)
|
* @param pointer to the database (.tdx file)
|
||||||
* @return a ecotxidx_t structure
|
* @return a ecotxidx_t structure
|
||||||
*/
|
*/
|
||||||
ecotxidx_t *read_taxonomyidx(const char *filename)
|
ecotxidx_t *read_taxonomyidx(const char *filename,const char *filename2)
|
||||||
{
|
{
|
||||||
int32_t count;
|
int32_t count;
|
||||||
|
int32_t count2;
|
||||||
FILE *f;
|
FILE *f;
|
||||||
|
FILE *f2;
|
||||||
ecotxidx_t *index;
|
ecotxidx_t *index;
|
||||||
int32_t i;
|
int32_t i;
|
||||||
|
|
||||||
f = open_ecorecorddb(filename,&count,1);
|
f = open_ecorecorddb(filename,&count,1);
|
||||||
|
f2 = open_ecorecorddb(filename2,&count2,0);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
index = (ecotxidx_t*) ECOMALLOC(sizeof(ecotxidx_t) + sizeof(ecotx_t) * (count-1),
|
index = (ecotxidx_t*) ECOMALLOC(sizeof(ecotxidx_t) + sizeof(ecotx_t) * (count+count2-1),
|
||||||
"Allocate taxonomy");
|
"Allocate taxonomy");
|
||||||
|
|
||||||
index->count=count;
|
index->count=count+count2;
|
||||||
|
|
||||||
|
fprintf(stderr,"Readind %d taxa...\n",count);
|
||||||
for (i=0; i < count; i++){
|
for (i=0; i < count; i++){
|
||||||
readnext_ecotaxon(f,&(index->taxon[i]));
|
readnext_ecotaxon(f,&(index->taxon[i]));
|
||||||
index->taxon[i].parent=index->taxon + (int32_t)index->taxon[i].parent;
|
index->taxon[i].parent=index->taxon + (int32_t)index->taxon[i].parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (count2>0)
|
||||||
|
fprintf(stderr,"Readind %d local taxa...\n",count2);
|
||||||
|
else
|
||||||
|
fprintf(stderr,"No local taxon\n");
|
||||||
|
|
||||||
|
for (i=0; i < count2; i++){
|
||||||
|
readnext_ecotaxon(f2,&(index->taxon[count+i]));
|
||||||
|
index->taxon[count+i].parent=index->taxon + (int32_t)index->taxon[count+i].parent;
|
||||||
|
}
|
||||||
|
|
||||||
return index;
|
return index;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -111,6 +129,7 @@ ecotaxonomy_t *read_taxonomy(const char *prefix,int32_t readAlternativeName)
|
|||||||
{
|
{
|
||||||
ecotaxonomy_t *tax;
|
ecotaxonomy_t *tax;
|
||||||
char *filename;
|
char *filename;
|
||||||
|
char *filename2;
|
||||||
int buffsize;
|
int buffsize;
|
||||||
|
|
||||||
tax = ECOMALLOC(sizeof(ecotaxonomy_t),
|
tax = ECOMALLOC(sizeof(ecotaxonomy_t),
|
||||||
@ -120,14 +139,17 @@ ecotaxonomy_t *read_taxonomy(const char *prefix,int32_t readAlternativeName)
|
|||||||
|
|
||||||
filename = ECOMALLOC(buffsize,
|
filename = ECOMALLOC(buffsize,
|
||||||
"Allocate filename");
|
"Allocate filename");
|
||||||
|
filename2= ECOMALLOC(buffsize,
|
||||||
|
"Allocate filename");
|
||||||
|
|
||||||
snprintf(filename,buffsize,"%s.rdx",prefix);
|
snprintf(filename,buffsize,"%s.rdx",prefix);
|
||||||
|
|
||||||
tax->ranks = read_rankidx(filename);
|
tax->ranks = read_rankidx(filename);
|
||||||
|
|
||||||
snprintf(filename,buffsize,"%s.tdx",prefix);
|
snprintf(filename,buffsize,"%s.tdx",prefix);
|
||||||
|
snprintf(filename2,buffsize,"%s.ldx",prefix);
|
||||||
|
|
||||||
tax->taxons = read_taxonomyidx(filename);
|
tax->taxons = read_taxonomyidx(filename,filename2);
|
||||||
|
|
||||||
if (readAlternativeName)
|
if (readAlternativeName)
|
||||||
{
|
{
|
||||||
@ -326,4 +348,4 @@ ecotx_t *eco_getsuperkingdom(ecotx_t *taxon,
|
|||||||
ECOERROR(ECO_ASSERT_ERROR,"No taxonomy defined");
|
ECOERROR(ECO_ASSERT_ERROR,"No taxonomy defined");
|
||||||
|
|
||||||
return eco_findtaxonatrank(taxon,rankindex);
|
return eco_findtaxonatrank(taxon,rankindex);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user