9 Commits

7 changed files with 124 additions and 171 deletions

5
.gitignore vendored
View File

@ -1,8 +1,12 @@
/.gitignore
/.cproject
/.project
# /src/
/src/ecoPCR
/src/ecofind
/src/*.P
/src/*.o
/src/ecogrep
# /src/libapat/
@ -14,3 +18,4 @@
# /src/libthermo/
/src/libthermo/*.P

View File

@ -1 +1 @@
0.7.0
1.0.0

Binary file not shown.

View File

@ -6,7 +6,7 @@
#include <getopt.h>
#define VERSION "0.7.0"
#define VERSION "1.0.1"
/* ----------------------------------------------- */
@ -80,7 +80,7 @@ static void PrintHelp()
PP "column 21 : sequence\n");
PP "column 22 : definition\n");
PP "------------------------------------------\n");
PP " http://www.grenoble.prabi.fr/trac/ecoPCR/\n");
PP " https://git.metabarcoding.org/obitools/ecopcr/wikis/home\n");
PP "------------------------------------------\n\n");
PP "\n");
@ -566,11 +566,11 @@ int main(int argc, char **argv)
)
{
scname = taxonomy->taxons->taxon[seq->taxid].name;
strncpy(head,seq->SQ,10);
head[10]=0;
strncpy(tail,seq->SQ+seq->SQ_length-10,10);
tail[10]=0;
//scname = taxonomy->taxons->taxon[seq->taxid].name;
//strncpy(head,seq->SQ,10);
//head[10]=0;
//strncpy(tail,seq->SQ+seq->SQ_length-10,10);
//tail[10]=0;
apatseq=ecoseq2apatseq(seq,apatseq,circular);
@ -614,14 +614,17 @@ int main(int argc, char **argv)
length = 0;
if (posj > posi)
length = posj - posi - o1->patlen - o2->patlen;
if (posj < posi)
else {
if (circular > 0)
length = posj + apatseq->seqlen - posi - o1->patlen - o2->patlen;
if (length &&
}
if ((length>0) && // For when primers touch or overlap
(!lmin || (length >= lmin)) &&
(!lmax || (length <= lmax)))
{
printRepeat(seq,oligo1,oligo2,&tparm,o1,o2c,'D',kingdom_mode,posi,posj,erri,errj,taxonomy,delta);
//printf("%s\tD\t%s...%s (%d)\t%d\t%d\t%d\t%d\t%s\n",seq->AC,head,tail,seq->SQ_length,o1Hits,o2cHits,posi,posj,scname);
}
}
}
}
@ -647,7 +650,7 @@ int main(int argc, char **argv)
}
o1cHits = ManberAll(apatseq,o1c,3,begin,length);
// printf("circular= %d\n",circular);
if (o1cHits)
for (i=0; i < o2Hits;i++)
{
@ -666,13 +669,16 @@ int main(int argc, char **argv)
length = 0;
if (posj > posi)
length=posj - posi + 1 - o2->patlen - o1->patlen; /* - o1->patlen : suppress by <EC> */
if (posj < posi)
length = posj - posi + 1 - o2->patlen - o1->patlen; /* - o1->patlen : deleted by <EC> (prior to the OBITools3) */
else {
if (circular > 0)
length = posj + apatseq->seqlen - posi - o1->patlen - o2->patlen;
}
if (length &&
if ((length>0) && // For when primers touch or overlap
(!lmin || (length >= lmin)) &&
(!lmax || (length <= lmax)))
{
printRepeat(seq,oligo1,oligo2,&tparm,o2,o1c,'R',kingdom_mode,posi,posj,erri,errj,taxonomy,delta);
//printf("%s\tR\t%s...%s (%d)\t%d\t%d\t%d\t%d\t%s\n",seq->AC,head,tail,seq->SQ_length,o2Hits,o1cHits,posi,posj,scname);
}
@ -680,6 +686,7 @@ int main(int argc, char **argv)
}
}
}
}
} /* End of taxonomic selection */

View File

@ -34,14 +34,11 @@ ecorankidx_t *read_rankidx(const char *filename)
int32_t rank_index(const char* label,ecorankidx_t* ranks)
{
char **rep;
fprintf(stderr,"Looking for rank -%s-... ",label);
rep = bsearch(label,ranks->label,ranks->count,sizeof(char*),compareRankLabel);
if (rep)
return rep-ranks->label;
else
ECOERROR(ECO_NOTFOUND_ERROR,"Rank label not found");
return -1;
}

View File

@ -341,6 +341,9 @@ ecotx_t *eco_getsuperkingdom(ecotx_t *taxon,
if (taxonomy && tax!=taxonomy)
{
rankindex = rank_index("superkingdom",taxonomy->ranks);
if (rankindex < 0) {
rankindex = rank_index("domain",taxonomy->ranks);
}
tax=taxonomy;
}

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python2.7
import re
import gzip
@ -7,12 +7,9 @@ import sys
import time
import getopt
try:
import psycopg2
_dbenable=True
except ImportError:
_dbenable=False
#####
#
#
@ -221,55 +218,6 @@ def readTaxonomyDump(taxdir):
return taxonomy,ranks,alternativeName,index
def readTaxonomyDB(dbname):
connection = psycopg2.connect(database=dbname)
cursor = connection.cursor()
cursor.execute("select numid,rank,parent from ncbi_taxonomy.taxon")
taxonomy=[list(x) for x in cursor]
cursor.execute("select rank_class from ncbi_taxonomy.taxon_rank_class order by rank_class")
ranks=cursor.fetchall()
ranks = dict(map(None,(x[0] for x in ranks),xrange(len(ranks))))
print >>sys.stderr,"Sorting taxons..."
taxonomy.sort(taxonCmp)
print >>sys.stderr,"Indexing taxonomy..."
index = {}
for t in taxonomy:
index[t[0]]=bsearchTaxon(taxonomy, t[0])
print >>sys.stderr,"Indexing parent and rank..."
for t in taxonomy:
t[1]=ranks[t[1]]
try:
t[2]=index[t[2]]
except KeyError,e:
if t[2] is None and t[0]==1:
t[2]=index[t[0]]
else:
raise e
cursor.execute("select taxid,name,category from ncbi_taxonomy.name")
alternativeName=[]
for taxid,name,classname in cursor:
alternativeName.append((name,classname,index[taxid]))
if classname == 'scientific name':
taxonomy[index[taxid]].append(name)
cursor.execute("select old_numid,current_numid from ncbi_taxonomy.taxon_id_alias")
print >>sys.stderr,"Adding taxid alias..."
for taxid,current in cursor:
if current is not None:
index[taxid]=index[current]
else:
index[taxid]=None
return taxonomy,ranks,alternativeName,index
#####
#
@ -585,10 +533,9 @@ def ecoParseOptions(arguments):
}
o,filenames = getopt.getopt(arguments,
'ht:T:n:gfe',
'ht:n:gfe',
['help',
'taxonomy=',
'taxonomy_db=',
'name=',
'genbank',
'fasta',
@ -601,9 +548,6 @@ def ecoParseOptions(arguments):
elif name in ('-t','--taxonomy'):
opt['taxmod']='dump'
opt['taxdir']=value
elif name in ('-T','--taxonomy_db'):
opt['taxmod']='db'
opt['taxdb']=value
elif name in ('-n','--name'):
opt['prefix']=value
elif name in ('-g','--genbank'):
@ -622,6 +566,7 @@ def ecoParseOptions(arguments):
return opt,filenames
def printHelp():
print "-----------------------------------"
print " ecoPCRFormat.py"
@ -641,11 +586,7 @@ if __name__ == '__main__':
opt,filenames = ecoParseOptions(sys.argv[1:])
if opt['taxmod']=='dump':
taxonomy = readTaxonomyDump(opt['taxdir'])
elif opt['taxmod']=='db':
taxonomy = readTaxonomyDB(opt['taxdb'])
ecoDBWriter(opt['prefix'], taxonomy, filenames, opt['parser'])