Commit ebe8c0b5 authored by Eric Coissac's avatar Eric Coissac

Initial version of ecoPCR

git-svn-id: https://www.grenoble.prabi.fr/svn/LECASofts/ecoPCR/trunk@5 60f365c0-8329-0410-b2a4-ec073aeeaa1d
parent f3d2273d
r -1acghtgd -2gctcagctagcta /Users/coissac/encours/ecoPCR/tools/ecodb
print put
print out
f ecoPCR
r -1GGGCAATCCTGAGCCAA -2CCATTGAGTCTCTGCACCTATC -l5 -L200 -e2 /Users/coissac/encours/ecoPCR/tools/ecodb
bt
print label1
up
print label1
print (char*)label1
r -1GGGCAATCCTGAGCCAA -2CCATTGAGTCTCTGCACCTATC -l5 -L200 -e2 /Users/coissac/encours/ecoPCR/tools/ecodb
bt
up 3
l
b 38
r
r -1GGGCAATCCTGAGCCAA -2CCATTGAGTCTCTGCACCTATC -l5 -L200 -e2 /Users/coissac/encours/ecoPCR/tools/ecodb
print label
print ranks
print *ranks
print ranks->label +1
print *ranks->label +1
print *(ranks->label +1)
print *(ranks->label +2)
b ecotax.c:147
r -1GGGCAATCCTGAGCCAA -2CCATTGAGTCTCTGCACCTATC -l5 -L200 -e2 /Users/coissac/encours/ecoPCR/tools/ecodb
print current_taxon ;
print current_taxon
n
print current_taxon ;
print current_taxon
print *current_taxon
print taxonomy->taxons[11]
print taxonomy->taxons[2952]
print taxonomy->taxons->taxon[2952]
print taxonomy->ranks->rank[11]
print taxonomy->ranks->label[11]
print taxonomy->ranks->label[3]
b ecotax.c:147
r -1GGGCAATCCTGAGCCAA -2CCATTGAGTCTCTGCACCTATC -l5 -L200 -e2 /Users/coissac/encours/ecoPCR/tools/ecodb
print current_taxon
print *current_taxon
n
print *current_taxon
b ecotax.c:147
r -1GGGCAATCCTGAGCCAA -2CCATTGAGTCTCTGCACCTATC -l5 -L200 -e2 /Users/coissac/encours/ecoPCR/tools/ecodb
n
print *current_taxon
r -1GGGCAATCCTGAGCCAA -2CCATTGAGTCTCTGCACCTATC -l5 -L200 -e2 /Users/coissac/encours/ecoPCR/tools/ecodb
n
print *current_taxon
b ecodna.c:70
r -1GGGCAATCCTGAGCC#A#A# -2CCATTGAGTCTCTGCACCTA#T#C# -l5 -L200 -e2 /Users/coissac/encours/ecoPCR/tools/ecodb
*sb
print *sb
print sb
print str
b 52
r -1GGGCAATCCTGAGCC#A#A# -2CCATTGAGTCTCTGCACCTA#T#C# -l5 -L200 -e2 /Users/coissac/encours/ecoPCR/tools/ecodb
print str
r -1GGGCAATCCTGAGCC#A#A# -2CCATTGAGTCTCTGCACCTA#T#C# -l5 -L200 -e2 /Users/coissac/encours/ecoPCR/tools/ecodb
bt
################################################################################
# Automatically-generated file. Do not edit!
################################################################################
-include ../makefile.init
RM := rm -rf
# All of the sources participating in the build are defined here
-include sources.mk
-include subdir.mk
-include src/libecoPCR/subdir.mk
-include src/libapat/subdir.mk
-include src/subdir.mk
-include objects.mk
ifneq ($(MAKECMDGOALS),clean)
ifneq ($(strip $(C_DEPS)),)
-include $(C_DEPS)
endif
endif
-include ../makefile.defs
# Add inputs and outputs from these tool invocations to the build variables
# All Target
all: ecoPCR
# Tool invocations
ecoPCR: $(OBJS) $(USER_OBJS)
@echo 'Building target: $@'
@echo 'Invoking: MacOS X C Linker'
gcc -o "ecoPCR" $(OBJS) $(USER_OBJS) $(LIBS)
@echo 'Finished building target: $@'
@echo ' '
# Other Targets
clean:
-$(RM) $(OBJS)$(EXECUTABLES)$(C_DEPS) ecoPCR
-@echo ' '
.PHONY: all clean dependents
.SECONDARY:
-include ../makefile.targets
################################################################################
# Automatically-generated file. Do not edit!
################################################################################
LIBS := -lz
USER_OBJS :=
\ No newline at end of file
################################################################################
# Automatically-generated file. Do not edit!
################################################################################
C_SRCS :=
O_SRCS :=
ASM_SRCS :=
S_SRCS :=
OBJ_SRCS :=
OBJS :=
EXECUTABLES :=
C_DEPS :=
# Every subdirectory with source files must be described here
SUBDIRS := \
src/libecoPCR \
src/libapat \
src \
################################################################################
# Automatically-generated file. Do not edit!
################################################################################
# Add inputs and outputs from these tool invocations to the build variables
C_SRCS += \
../src/libapat/CODES/gendual.c
OBJS += \
./src/libapat/CODES/gendual.o
C_DEPS += \
./src/libapat/CODES/gendual.d
# Each subdirectory must supply rules for building sources it contributes
src/libapat/CODES/%.o: ../src/libapat/CODES/%.c
@echo 'Building file: $<'
@echo 'Invoking: GCC C Compiler'
gcc -DMAC_OS_X -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o"$@" "$<"
@echo 'Finished building: $<'
@echo ' '
################################################################################
# Automatically-generated file. Do not edit!
################################################################################
# Add inputs and outputs from these tool invocations to the build variables
C_SRCS += \
../src/libapat/apat_parse.c \
../src/libapat/apat_search.c \
../src/libapat/libstki.c
OBJS += \
./src/libapat/apat_parse.o \
./src/libapat/apat_search.o \
./src/libapat/libstki.o
C_DEPS += \
./src/libapat/apat_parse.d \
./src/libapat/apat_search.d \
./src/libapat/libstki.d
# Each subdirectory must supply rules for building sources it contributes
src/libapat/%.o: ../src/libapat/%.c
@echo 'Building file: $<'
@echo 'Invoking: GCC C Compiler'
gcc -DMAC_OS_X -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o"$@" "$<"
@echo 'Finished building: $<'
@echo ' '
################################################################################
# Automatically-generated file. Do not edit!
################################################################################
# Add inputs and outputs from these tool invocations to the build variables
C_SRCS += \
../src/libecoPCR/ecoError.c \
../src/libecoPCR/ecoIOUtils.c \
../src/libecoPCR/ecoMalloc.c \
../src/libecoPCR/ecoapat.c \
../src/libecoPCR/ecodna.c \
../src/libecoPCR/ecorank.c \
../src/libecoPCR/ecoseq.c \
../src/libecoPCR/ecotax.c
OBJS += \
./src/libecoPCR/ecoError.o \
./src/libecoPCR/ecoIOUtils.o \
./src/libecoPCR/ecoMalloc.o \
./src/libecoPCR/ecoapat.o \
./src/libecoPCR/ecodna.o \
./src/libecoPCR/ecorank.o \
./src/libecoPCR/ecoseq.o \
./src/libecoPCR/ecotax.o
C_DEPS += \
./src/libecoPCR/ecoError.d \
./src/libecoPCR/ecoIOUtils.d \
./src/libecoPCR/ecoMalloc.d \
./src/libecoPCR/ecoapat.d \
./src/libecoPCR/ecodna.d \
./src/libecoPCR/ecorank.d \
./src/libecoPCR/ecoseq.d \
./src/libecoPCR/ecotax.d
# Each subdirectory must supply rules for building sources it contributes
src/libecoPCR/%.o: ../src/libecoPCR/%.c
@echo 'Building file: $<'
@echo 'Invoking: GCC C Compiler'
gcc -DMAC_OS_X -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o"$@" "$<"
@echo 'Finished building: $<'
@echo ' '
################################################################################
# Automatically-generated file. Do not edit!
################################################################################
# Add inputs and outputs from these tool invocations to the build variables
C_SRCS += \
../src/ecopcr.c
OBJS += \
./src/ecopcr.o
C_DEPS += \
./src/ecopcr.d
# Each subdirectory must supply rules for building sources it contributes
src/%.o: ../src/%.c
@echo 'Building file: $<'
@echo 'Invoking: GCC C Compiler'
gcc -DMAC_OS_X -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o"$@" "$<"
@echo 'Finished building: $<'
@echo ' '
################################################################################
# Automatically-generated file. Do not edit!
################################################################################
-include ../makefile.init
RM := rm -rf
# All of the sources participating in the build are defined here
-include sources.mk
-include subdir.mk
-include src/libecoPCR/subdir.mk
-include src/libapat/subdir.mk
-include src/subdir.mk
-include objects.mk
ifneq ($(MAKECMDGOALS),clean)
ifneq ($(strip $(C_DEPS)),)
-include $(C_DEPS)
endif
endif
-include ../makefile.defs
# Add inputs and outputs from these tool invocations to the build variables
# All Target
all: ecoPCR
# Tool invocations
ecoPCR: $(OBJS) $(USER_OBJS)
@echo 'Building target: $@'
@echo 'Invoking: MacOS X C Linker'
gcc -o "ecoPCR" $(OBJS) $(USER_OBJS) $(LIBS)
@echo 'Finished building target: $@'
@echo ' '
# Other Targets
clean:
-$(RM) $(OBJS)$(EXECUTABLES)$(C_DEPS) ecoPCR
-@echo ' '
.PHONY: all clean dependents
.SECONDARY:
-include ../makefile.targets
################################################################################
# Automatically-generated file. Do not edit!
################################################################################
LIBS := -lz
USER_OBJS :=
\ No newline at end of file
################################################################################
# Automatically-generated file. Do not edit!
################################################################################
C_SRCS :=
O_SRCS :=
ASM_SRCS :=
S_SRCS :=
OBJ_SRCS :=
OBJS :=
EXECUTABLES :=
C_DEPS :=
# Every subdirectory with source files must be described here
SUBDIRS := \
src/libecoPCR \
src/libapat \
src \
################################################################################
# Automatically-generated file. Do not edit!
################################################################################
# Add inputs and outputs from these tool invocations to the build variables
C_SRCS += \
../src/libapat/apat_parse.c \
../src/libapat/apat_search.c \
../src/libapat/libstki.c
OBJS += \
./src/libapat/apat_parse.o \
./src/libapat/apat_search.o \
./src/libapat/libstki.o
C_DEPS += \
./src/libapat/apat_parse.d \
./src/libapat/apat_search.d \
./src/libapat/libstki.d
# Each subdirectory must supply rules for building sources it contributes
src/libapat/%.o: ../src/libapat/%.c
@echo 'Building file: $<'
@echo 'Invoking: GCC C Compiler'
gcc -DMAC_OS_X -O3 -Wall -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o"$@" "$<"
@echo 'Finished building: $<'
@echo ' '
################################################################################
# Automatically-generated file. Do not edit!
################################################################################
# Add inputs and outputs from these tool invocations to the build variables
C_SRCS += \
../src/libecoPCR/ecoError.c \
../src/libecoPCR/ecoIOUtils.c \
../src/libecoPCR/ecoMalloc.c \
../src/libecoPCR/ecoapat.c \
../src/libecoPCR/ecodna.c \
../src/libecoPCR/ecorank.c \
../src/libecoPCR/ecoseq.c \
../src/libecoPCR/ecotax.c
OBJS += \
./src/libecoPCR/ecoError.o \
./src/libecoPCR/ecoIOUtils.o \
./src/libecoPCR/ecoMalloc.o \
./src/libecoPCR/ecoapat.o \
./src/libecoPCR/ecodna.o \
./src/libecoPCR/ecorank.o \
./src/libecoPCR/ecoseq.o \
./src/libecoPCR/ecotax.o
C_DEPS += \
./src/libecoPCR/ecoError.d \
./src/libecoPCR/ecoIOUtils.d \
./src/libecoPCR/ecoMalloc.d \
./src/libecoPCR/ecoapat.d \
./src/libecoPCR/ecodna.d \
./src/libecoPCR/ecorank.d \
./src/libecoPCR/ecoseq.d \
./src/libecoPCR/ecotax.d
# Each subdirectory must supply rules for building sources it contributes
src/libecoPCR/%.o: ../src/libecoPCR/%.c
@echo 'Building file: $<'
@echo 'Invoking: GCC C Compiler'
gcc -DMAC_OS_X -O3 -Wall -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o"$@" "$<"
@echo 'Finished building: $<'
@echo ' '
################################################################################
# Automatically-generated file. Do not edit!
################################################################################
# Add inputs and outputs from these tool invocations to the build variables
C_SRCS += \
../src/ecopcr.c
OBJS += \
./src/ecopcr.o
C_DEPS += \
./src/ecopcr.d
# Each subdirectory must supply rules for building sources it contributes
src/%.o: ../src/%.c
@echo 'Building file: $<'
@echo 'Invoking: GCC C Compiler'
gcc -DMAC_OS_X -O3 -Wall -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o"$@" "$<"
@echo 'Finished building: $<'
@echo ' '
This diff is collapsed.
#include "libecoPCR/ecoPCR.h"
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <getopt.h>
#define VERSION "0.1"
/* ----------------------------------------------- */
/* printout help */ /* ----------------------------------------------- */
#define PP fprintf(stdout,
static void PrintHelp()
{
PP "------------------------------------------\n");
PP " Apat Version %s\n", VERSION);
PP "------------------------------------------\n");
PP "synopsis : pattern(s) searching program\n");
PP "usage: apat [options] patfile datafile\n");
PP "------------------------------------------\n");
PP "options:\n");
PP "-a code : [A]lphabet encoding for pattern\n");
PP " code is one of : \n");
PP " dna: use IUPAC equivalences for dna/rna\n");
PP " prot: use IUPAC equivalences for proteins\n");
PP " alpha: no equivalences, just treat plain symbols\n");
PP " note: the equivalences are used in pattern only\n");
PP " *not* in sequence(s) (see note (4) below)\n");
PP " dft: alpha\n");
PP "-c : [C]ooccurences\n");
PP " print patterns cooccurence matrix \n");
PP " dft: off\n");
PP "-h : [H]elp - print <this> help\n");
PP "-m : [M]ultiple occurences\n");
PP " see -q option \n");
PP " dft: off\n");
PP "-o file : [O]utput sequences\n");
PP " additionaly output sequence(s) that match into\n");
PP " 'file' in fasta format\n");
PP " dft: off\n");
PP "-p : no [Print] - don't printout hits\n");
PP " when just counts are needed\n");
PP " dft: off\n");
PP "-q nn : [Quorum]\n");
PP " printout result if at least nn\n");
PP " different patterns are found on the sequence\n");
PP " (with -m : at least nn different <hits>)\n");
PP " dft: # of patterns read\n");
PP "-s : no [Sort] - don't sort hits before printing\n");
PP " usually hits are printed by increasing position\n");
PP " this option will list them by pattern\n");
PP " dft: off\n");
PP "-t : [T]est sequence\n");
PP " additionnaly check if sequences are uppercase\n");
PP " this is mostly used for testing\n");
PP " dft: off\n");
PP "-u : [U]pper\n");
PP " force lower->upper sequence conversion\n");
PP " without this option lowercase symbols in sequence\n");
PP " will not be considered to as matches\n");
PP " dft: off\n");
PP "-v : [V]erbose\n");
PP " just display a kind of progress clock on stderr\n");
PP " (this is only useful if you redirect stdout)\n");
PP "\n");
PP "patfile : pattern file (see below)\n");
PP "datafile : database file (see below)\n");
PP "------------------------------------------\n");
PP "pattern file format :\n");
PP " one pattern/line\n");
PP " format : <pattern> <space> #errors\n");
PP " <pattern> := pattern<symbol>\n");
PP " or !pattern<symbol>\n");
PP " or pattern<symbol>#\n");
PP " or !pattern<symbol>#\n");
PP " <symbol> := <letter>\n");
PP " or [<letter>....<letter>]\n");
PP " <letter> := uppercase letter (A-Z)\n");
PP " <number> := a positive number indicates max number of mismatches\n");
PP " a negative number indicates max number of mismatches or indels\n");
PP " # means that no error is allowed at this position\n");
PP " ! complement the <symbol>\n");
PP " [...] means that all symbols within [] are allowed\n");
PP " in addition IUPAC equivalences may be used as symbols\n");
PP " with the -a option\n");
PP "\n");
PP "example: G[DE]S#[GIV]!HP![DE]# 1\n");
PP "\n");
PP "------------------------------------------\n");
PP "datafile contains one or more sequences in\n");
PP "Fasta format, with *uppercase* symbols \n");
PP "\n");
PP "------------------------------------------\n");
PP "note (1): the maximum number of patterns is %d\n", MAX_PATTERN);
PP "\n");
PP "note (2): the maximum length for one pattern is %d\n", MAX_PAT_LEN);
PP "\n");
PP "note (3): indels are still experimental and are :\n");
PP " not handled gracefully with the # syntax\n");
PP " and hits are not printed very nicely\n");
PP "\n");
PP "note (4): the IUPAC equivalences (-a option) are used\n");
PP " in pattern only *not* in sequence(s).\n");
PP " for instance GATN (with option -a dna) is equivalent to GAT[ACGT]\n");
PP " and will match GATA/GATC/GATG/GATC but will not match GATN\n");
PP " (nor NNNN) in sequence.\n");
PP "\n");
}
#undef PP
/* ----------------------------------------------- */
/* printout usage and exit */
/* ----------------------------------------------- */
#define PP fprintf(stderr,
static void ExitUsage(stat)
int stat;
{
PP "usage: apat [-a dna|prot] [-c] [-h] [-m] [-o file] [-p]\n");
PP " [-q nn] [-t] [-u] [-v]\n");
PP " patfile datafile\n");
PP "type \"apat -h\" for help\n");
if (stat)
exit(stat);
}
#undef PP
void printRepeat(ecoseq_t *seq,
PatternPtr o1, PatternPtr o2,
char strand,
int32_t pos1, int32_t pos2,
int32_t err1, int32_t err2,
ecotaxonomy_t *taxonomy)
{
char *AC;
int32_t seqlength;
int32_t taxid;
int32_t species_taxid;
int32_t genus_taxid;
int32_t family_taxid;
int32_t superkingdom_taxid;
char *rank;
char *scientificName;
char *genus_name;
char *family_name;
char *superkingdom_name;
ecotx_t *taxon;
ecotx_t *main_taxon;
char oligo1[MAX_PAT_LEN+1];
char oligo2[MAX_PAT_LEN+1];
int32_t error1;
int32_t error2;
char *amplifia = NULL;
int32_t amplength;
AC = seq->AC;
seqlength = seq->SQ_length;
main_taxon = &taxonomy->taxons->taxon[seq->taxid];
taxid = main_taxon->taxid;
scientificName= main_taxon->name;
rank = taxonomy->ranks->label[main_taxon->rank];
taxon = eco_getspecies(main_taxon,taxonomy);
if (taxon)
{