Commit f9410e5a authored by Eric Coissac's avatar Eric Coissac

Initial commit for this soft

git-svn-id: https://www.grenoble.prabi.fr/svn/LECASofts/ecoPrimers/trunk@175 60f365c0-8329-0410-b2a4-ec073aeeaa1d
parent f5abbabb
<?xml version="1.0" encoding="UTF-8"?>
<?fileVersion 4.0.0?>
<cproject>
<storageModule moduleId="org.eclipse.cdt.core.settings">
<cconfiguration id="cdt.managedbuild.toolchain.gnu.macosx.base.2134184396">
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.toolchain.gnu.macosx.base.2134184396" moduleId="org.eclipse.cdt.core.settings" name="MacOSX GCC">
<externalSettings/>
<extensions>
<extension id="org.eclipse.cdt.core.MachO" point="org.eclipse.cdt.core.BinaryParser"/>
<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.MakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
</extensions>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
<configuration artifactName="ecoPrimers" buildProperties="" id="cdt.managedbuild.toolchain.gnu.macosx.base.2134184396" name="MacOSX GCC" parent="org.eclipse.cdt.build.core.emptycfg">
<folderInfo id="cdt.managedbuild.toolchain.gnu.macosx.base.2134184396.1840911077" name="/" resourcePath="">
<toolChain id="cdt.managedbuild.toolchain.gnu.macosx.base.766054112" name="cdt.managedbuild.toolchain.gnu.macosx.base" superClass="cdt.managedbuild.toolchain.gnu.macosx.base">
<targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.MachO" id="cdt.managedbuild.target.gnu.platform.macosx.base.2057035265" name="Debug Platform" osList="macosx" superClass="cdt.managedbuild.target.gnu.platform.macosx.base"/>
<builder id="cdt.managedbuild.target.gnu.builder.macosx.base.783726363" managedBuildOn="false" name="Gnu Make Builder.MacOSX GCC" superClass="cdt.managedbuild.target.gnu.builder.macosx.base"/>
<tool id="cdt.managedbuild.tool.macosx.c.linker.macosx.base.914103467" name="MacOS X C Linker" superClass="cdt.managedbuild.tool.macosx.c.linker.macosx.base">
<inputType id="cdt.managedbuild.tool.macosx.c.linker.input.62980206" superClass="cdt.managedbuild.tool.macosx.c.linker.input">
<additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
<additionalInput kind="additionalinput" paths="$(LIBS)"/>
</inputType>
</tool>
<tool id="cdt.managedbuild.tool.macosx.cpp.linker.macosx.base.691108439" name="MacOS X C++ Linker" superClass="cdt.managedbuild.tool.macosx.cpp.linker.macosx.base"/>
<tool id="cdt.managedbuild.tool.gnu.assembler.macosx.base.695639877" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.macosx.base">
<inputType id="cdt.managedbuild.tool.gnu.assembler.input.1507665054" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
</tool>
<tool id="cdt.managedbuild.tool.gnu.archiver.macosx.base.1786370580" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.macosx.base"/>
<tool id="cdt.managedbuild.tool.gnu.cpp.compiler.macosx.base.454329831" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.macosx.base"/>
<tool id="cdt.managedbuild.tool.gnu.c.compiler.macosx.base.1928774909" name="GCC C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.macosx.base">
<inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.330854350" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
</tool>
</toolChain>
</folderInfo>
</configuration>
</storageModule>
<storageModule moduleId="scannerConfiguration">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile"/>
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="makefileGenerator">
<runAction arguments="-f ${project_name}_scd.mk" command="make" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileCPP">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.xlc.core.XLCManagedMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="false" filePath=""/>
<parser enabled="false"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -v ${plugin_state_location}/${specs_file}" command="${XL_compilerRoot}/xlc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.xlc.core.XLCManagedMakePerProjectProfileCPP">
<buildOutputProvider>
<openAction enabled="false" filePath=""/>
<parser enabled="false"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -v ${plugin_state_location}/${specs_file}" command="${XL_compilerRoot}/xlC" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
</cconfiguration>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
<project id="ecoPrimers.null.1292969001" name="ecoPrimers"/>
</storageModule>
</cproject>
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>ecoPrimers</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
<triggers>clean,full,incremental,</triggers>
<arguments>
<dictionary>
<key>org.eclipse.cdt.make.core.fullBuildTarget</key>
<value>all</value>
</dictionary>
<dictionary>
<key>?name?</key>
<value></value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.enableAutoBuild</key>
<value>false</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.enableFullBuild</key>
<value>true</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.enableCleanBuild</key>
<value>true</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.cleanBuildTarget</key>
<value>clean</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.append_environment</key>
<value>true</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.contents</key>
<value>org.eclipse.cdt.make.core.activeConfigSettings</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.useDefaultBuildCmd</key>
<value>true</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.buildArguments</key>
<value></value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.buildCommand</key>
<value>make</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.autoBuildTarget</key>
<value>all</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.stopOnError</key>
<value>true</value>
</dictionary>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.cdt.core.cnature</nature>
<nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
<nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
</natures>
</projectDescription>
File added
This diff is collapsed.
This diff is collapsed.
EXEC=ecoPrimer
PRIMER_SRC= ecoprimer.c
PRIMER_OBJ= $(patsubst %.c,%.o,$(PRIMER_SRC))
SRCS= $(PRIMER_SRC)
LIB= -lecoPCR -lapat -lKMRK -lz -lm
LIBFILE= libapat/libapat.a \
libecoPCR/libecoPCR.a \
libKMRK/libKMRK.a
include global.mk
all: $(EXEC)
########
#
# ecoPrimer compilation
#
########
# executable compilation and link
ecoPrimer: $(PRIMER_OBJ) $(LIBFILE)
$(CC) $(LDFLAGS) -o $@ $< $(LIBPATH) $(LIB)
########
#
# library compilation
#
########
libapat/libapat.a:
$(MAKE) -C libapat
libecoPCR/libecoPCR.a:
$(MAKE) -C libecoPCR
libKMRK/libKMRK.a:
$(MAKE) -C libKMRK
########
#
# project management
#
########
clean:
rm -f *.o
rm -f $(EXEC)
$(MAKE) -C libapat clean
$(MAKE) -C libecoPCR clean
$(MAKE) -C libKMRK clean
\ No newline at end of file
MACHINE=MAC_OS_X
LIBPATH= -Llibapat -LlibecoPCR -LlibKMRK
MAKEDEPEND = gcc -D$(MACHINE) -M $(CPPFLAGS) -o $*.d $<
CC=gcc
CFLAGS= -W -Wall -O2 -g
default: all
%.o: %.c
$(CC) -D$(MACHINE) $(CFLAGS) -c -o $@ $<
%.P : %.c
$(MAKEDEPEND)
@sed 's/\($*\)\.o[ :]*/\1.o $@ : /g' < $*.d > $@; \
rm -f $*.d; [ -s $@ ] || rm -f $@
include $(SRCS:.c=.P)
\ No newline at end of file
This diff is collapsed.
#ifndef _KMRK_H_
#define _KMRK_H_
/********************************************
********************************************
**
** Declaration of struct
**
********************************************
********************************************/
#include <stdint.h>
#include "repseek_types.h"
#include "KMRK_mask.h"
/**
* Structure used to manipulate simultanously
* the v and n vector
*
*/
typedef struct {
int32_t size; /**< size of vectors */
int32_t seqCount; /**< count of concatenated sequences */
int32_t complement; /**< if seqCount > 1 and complement !=0
* then second sequence is the inverted complement
* strand of first one */
int32_t symbmax;
int32_t* v; /**< sequence vector */
int32_t* n; /**< linked list vector */
int32_t limits[1]; /**< array of end limits of concatenated
* sequences in v (array size is seqCount) */
} vn_type;
/********************************************
********************************************
**
** Declaration of public macro
**
********************************************
********************************************/
// Return a pointer to a vector from a vn_type structure
#define GETVECTOR(x,vector) (((x)->vector) - 1)
#define IS_MARKED(x,i) ((x)[i] < 0)
#define MARK(x,i) ((x)[i]) = -ABS((x)[i])
#define UNMARK(x,i) ((x)[i]) = ABS((x)[i])
#define SET(x,i,v) ((x)[i]) = (v)
// set and mark in one operation
#define SETMARKED(x,i,v) ((x)[i]) = -(v)
//internal macro
#define GET(x,i) ABS((x)[i])
// get symbole at position i in vector x
#define SYMBOLE(x,i) ((IS_MARKED((x),(i))) ? (i): (GET(x,i)))
/**
* Macro used to declare a pointer to a quorum function.
*
* @param name name of the pointer
*
*/
#define KMRK_QUORUM_FUNC_PTR(name) int32_t (*name)(vn_type* x, \
int32_t pos, \
int32_t count, \
int32_t countSeq)
/**
* Macro used to declare a pointer to an initialisation function.
*
* @param name name of the pointer
* @param quorum name used for the quorum assiciated function
*
* @see KMRK_QUORUM_FUNC_PTR
*
*/
#define KMRK_INIT_FUNC_PTR(name,quorum) vn_type* (*name)(char *sequence, \
int32_t complement, \
int32_t count, \
int32_t countSeq, \
int32_t *k, \
KMRK_QUORUM_FUNC_PTR(quorum),\
masked_area_table_t *mask)
/********************************************
********************************************
**
** Declaration of public functions
**
********************************************
********************************************/
/**
* Initialise a vn_type record from one sequence to run KMRK algorithm
*
* @param sequence pointer to a C string containing the sequence
* @param complement != 0 means that seq one and two are the two strands of
* the same sequence.
* @param count parameter count passed to the quorun function
* @param countSeq parametter countSeq passed to the quorun function
* @param k length of the word represented by each symbole of v.
* k is an output parametter
* @param quorum pointer to a quorum function
*
* @return a pointer to vn_type structure correctly initialized
* to be used by KMRK_RunKMRK
*
* @see KMRK_HashOneSequence
*/
vn_type* KMRK_InitOneSequence(char *sequence,
int32_t complement,
int32_t count,
int32_t countSeq,
int32_t *k,
KMRK_QUORUM_FUNC_PTR(quorum),
masked_area_table_t *mask);
/**
* Initialise a vn_type record from one sequence to run KMRK algorithme.
* In more than KMRK_InitOneSequence, KMRK_HashOneSequence construct
* word of len k with an hash algorithm. k used is a function of
* sequence size and alphabet size. If calculed k is superior to lmax
* then k = lmax.
*
* @param sequence pointer to a C string containing the sequence
* @param complement != 0 means that seq one and two are the two strands of
* the same sequence.
* @param count parametter count passed to the quorun function
* @param countSeq parametter countSeq passed to the quorun function
* @param k maximum length of the created word (input)
* length of the word represented by each symbole
* of v (output).
* @param quorum pointer to a quorum function
*
* @return a pointer to vn_type structure correctly initialized
* to be used by KMRK_RunKMRK
*
* @see KMRK_InitOneSequence
*/
vn_type* KMRK_HashOneSequence(char *sequence,
int32_t complement,
int32_t count,
int32_t countSeq,
int32_t *k,
KMRK_QUORUM_FUNC_PTR(quorum),
masked_area_table_t *mask);
/**
* An example of quorum function testing than a factor is
* present a least two times. Because of definition of this
* quorum function count and countSeq parametter have no meanning
* in this instance of quorum function
*
* @param x a pointer to vn_type structure to check
* @param pos position in n of the beginning of the linked list to test
* @param count minimal number of occurence of factor
* @param countSeq minimal number of sequences concerned
*
* @return 1 if quorum is ok 0 otherwise.
*/
int32_t KMRK_CoupleQuorum(vn_type* x,
int32_t pos,
int32_t count,
int32_t countSeq);
/**
* An example of quorum function testing than a factor is
* present a least two times in the direct strand of a sequence or
* at least one time in the direct strand and one time in the reverse
* strand. Because of definition of this
* quorum function count and countSeq parametter have no meanning
* in this instance of quorum function
*
* @param x a pointer to vn_type structure to check
* @param pos position in n of the beginning of the linked list to test
* @param count minimal number of occurence of factor
* @param countSeq minimal number of sequences concerned
*
* @return 1 if quorum is ok 0 otherwise.
*/
int32_t KMRK_DirInvQuorum(vn_type* x,
int32_t pos,
int32_t count,
int32_t countSeq);
/**
* An example of quorum function testing than a factor is
* present a least one time in the direct strand and one time in the reverse
* strand. Because of definition of this
* quorum function count and countSeq parametter have no meanning
* in this instance of quorum function
*
* @param x a pointer to vn_type structure to check
* @param pos position in n of the beginning of the linked list to test
* @param count minimal number of occurence of factor
* @param countSeq minimal number of sequences concerned
*
* @return 1 if quorum is ok 0 otherwise.
*/
int32_t KMRK_InvQuorum(vn_type* x,
int32_t pos,
int32_t count,
int32_t countSeq);
int32_t KMRK_Int12Quorum(vn_type* x,
int32_t pos,
int32_t count,
int32_t countSeq);
int32_t KMRK_IntInv12Quorum(vn_type* x,
int32_t pos,
int32_t count,
int32_t countSeq);
int32_t KMRK_IntDirInv12Quorum(vn_type* x,
int32_t pos,
int32_t count,
int32_t countSeq);
/**
* realize one cycle of KMR.
*
* @param x a pointer to vn_type created by an intialisation
* function or returned by this function.
* @param k step used to join two words
* @param count parametter count passed to the quorun function
* @param countSeq parametter countSeq passed to the quorun function
* @param KMRK_QUORUM_FUNC_PTR quorum pointer to a quorum function
*/
void KMRK_RunKMRK(vn_type *x,
int32_t k,
int32_t count,
int32_t countSeq,
KMRK_QUORUM_FUNC_PTR(quorum));
/**
* realises serveral run of KMR cycle to make from a sequence
* a vn_type structure describing sequences of factors of a precise size.
*
* @param sequence pointer to a C string containing the sequence
* @param size word size to construct
* @param count parametter count passed to the quorun function
* @param countSeq parametter countSeq passed to the quorun function
* @param quorum pointer to a quorum function
* @param init pointer to a initialisation function
*
* @return a vn_type pointer to a structure containing sequences of factors
*/
vn_type *KMRK_RunTo(char *sequence,
int32_t size,
int32_t complement,
int32_t count,
int32_t countSeq,
KMRK_QUORUM_FUNC_PTR(quorum),
KMRK_INIT_FUNC_PTR(init,quorum),
masked_area_table_t *mask);
/**
* free memory associated to a vn_type pointer
*
* @param x a pointer to vn_type structure
*/
void KMRK_FreeVN(vn_type *x);
int32_t KMRK_upperCoupleCount(vn_type *x);
int32_t KMRK_upperInvertedCount(vn_type* x,int32_t wordsize);
int32_t KMRK_upperInterCount(vn_type* x,int32_t seq1,int32_t seq2,int32_t wordsize);
void KMRK_markStart(vn_type* x);
#endif //_KMRK_H_
This diff is collapsed.
#ifndef KMRK_Seeds_h
#define KMRK_Seeds_h
/********************************************
********************************************
**
** Declaration of struct
**
********************************************
********************************************/
#include <stdint.h>
#include <stdio.h>
#include "KMRK.h"
#define KMRK_SORT_SEEDS_FUNC_PTR(name) int32_t (*name)(SmallSeed_type*, \
SmallSeed_type*)
#define KMRK_DELTA_SEEDS_FUNC_PTR(name) int32_t (*name)(SmallSeed_type*)
/********************************************
********************************************
**
** Declaration of public functions
**
********************************************
********************************************/
AllSeeds_type *KMRK_allocSeeds(AllSeeds_type *AllSeeds,
int32_t size,
int8_t opt_dir,
int8_t opt_inv);
void KMRK_SetMultipleLenDirSeeds(SmallSeed_type* seeds,
int32_t nseeds,
int32_t wordSize,
AllSeeds_type *PtrAllSeeds);
void KMRK_freeSeeds(AllSeeds_type *AllSeeds);
void KMRK_compactSeeds(AllSeeds_type *AllSeeds);
void KMRK_pushSeed(AllSeeds_type *AllSeeds,
int32_t pos1,
int32_t pos2,
int32_t length,
int8_t dir);
AllSeeds_type* KMRK_enumerateDirectCouple(AllSeeds_type* Seeds,
int32_t expected,
int32_t wordSize,
vn_type* stack,
int32_t seq);
AllSeeds_type* KMRK_enumerateInvertedCouple(AllSeeds_type* Seeds,
int32_t expected,
int32_t wordSize,
vn_type* stack);
AllSeeds_type* KMRK_enumerateInterCouple(AllSeeds_type* Seeds,
int32_t seq1,
int32_t seq2,
int32_t expected,
int32_t wordSize,
vn_type* stack);
AllSeeds_type* KMRK_enumerateInterInvertedCouple(AllSeeds_type* Seeds,
int32_t seq2,
int32_t expected,
int32_t wordSize,
vn_type* stack);
/**
* Compare two seeds and return an integer less than, equal to or greater
* than zero considering the relative order of the two seeds. This
* version take into account only pos1 and pos2 of seeds without taking
* account of the sequences or of the relative direction
*
* @param s1 pointer to seed one
* @param s2 pointer to seed two
*
* @return a integer less than, equal to or greater than zero
*/
int32_t KMRK_cmpSeedsPos(SmallSeed_type *s1, SmallSeed_type *s2);
int32_t KMRK_cmpDeltaSeedsPos(SmallSeed_type *s1, SmallSeed_type *s2);
int32_t KMRK_cmpDeltaInvSeedsPos(SmallSeed_type *s1, SmallSeed_type *s2);
void KMRK_sortSeeds(SmallSeed_type* seeds,
int32_t nseeds,
KMRK_SORT_SEEDS_FUNC_PTR(compare));
AllSeeds_type* KMRK_get_seeds(char **seq,
int32_t SimpleSeqLen,
int16_t Lmin,
int8_t opt_dir,
int8_t opt_inv,
int8_t opt_verbose,
masked_area_table_t *mask);
AllSeeds_type* KMRK_get_seeds_2seqs(char **seq1,
char **seq2,
int32_t size1,
int32_t size2,
int16_t Lmin,
int8_t opt_dir,
int8_t opt_inv,
int8_t opt_verbose,
masked_area_table_t *mask);
/**
* Order an array of seeds by pos1,pos2
*
* @param seeds pointer to an array of Seed_type object to sort
* @param count count of element in the array
*/
void KMRK_sortSeedsByPos(Seed_type* seeds, int32_t count);
#endif /* KMRK_Seeds_h */
/*
* KMRK_mask.c
* repseek
*
* Created by Eric Coissac on 04/12/04.
* Copyright 2004 __MyCompanyName__. All rights reserved.
*
*/
#include "KMRK_mask.h"
#include <stdio.h>
#include <stdlib.h>
#include "memory.h"
#define MASKED_AREA_TABLE_SIZE(seqcount) (sizeof(masked_area_table_t) + (sizeof(masked_area_list_t*) * ((seqcount)-1)))
#define MASKED_AREA_LIST_SIZE(areacount) (sizeof(masked_area_list_t) + (sizeof(masked_area_t) * ((areacount)-1)))
#define AREA_COUNT_INIT (1000)
static masked_area_table_t *new_masked_area_table(int32_t seqcount, int32_t areacount);
static masked_area_list_t *new_masked_area_list(int32_t areacount);
static masked_area_list_t *realloc_masked_area_list(masked_area_list_t *list,int32_t areacount);
static int32_t push_area(masked_area_table_t* table,int32_t sequence,int32_t begin,int32_t end);
static void sort_area_table(masked_area_table_t* table);
static int32_t compare_area(const masked_area_t* v1,const masked_area_t* v2);
static int32_t search_area(const masked_area_t* v1,const masked_area_t* v2);
static masked_area_list_t *strip_area_list(masked_area_list_t* list);
static void strip_area_table(masked_area_table_t* table);
static masked_area_list_t *new_masked_area_list(int32_t areacount)
{
masked_area_list_t *list;
list = MyCalloc(1,MASKED_AREA_LIST_SIZE(areacount),"Not enougth memory for mask table");
list->reserved=areacount;
return list;
}
static masked_area_list_t *realloc_masked_area_list(masked_area_list_t *list,int32_t areacount)
{
list = MyRealloc(list,
MASKED_AREA_LIST_SIZE(areacount),
MASKED_AREA_LIST_SIZE(list->reserved),
"Not enougth memory for mask table");
list->reserved=areacount;
return list;
}
static masked_area_table_t *new_masked_area_table(int32_t seqcount, int32_t areacount)
{
masked_area_table_t *table;
int32_t i;
table = MyCalloc(1,MASKED_AREA_TABLE_SIZE(seqcount),"Not enougth memory for mask table");
table->seqcount=seqcount;
for (i=0;i<seqcount;i++)
table->sequence[i]=new_masked_area_list(areacount);
return table;
}
static int32_t push_area(masked_area_table_t* table,int32_t sequence,int32_t begin,int32_t end)
{
masked_area_list_t * list;
if (sequence >= table->seqcount)
return -1;
list = table->sequence[sequence];
if (list->reserved == list->count)
{
list = realloc_masked_area_list(list,list->reserved*2);
table->sequence[sequence]=list;
}
list->area[list->count].begin=begin;
list->area[list->count].end=end;
list->count++;
table->total++;
return table->total;
}
static int32_t compare_area(const masked_area_t* v1,const masked_area_t* v2)
{
return v1->begin - v2->begin;
}
static void sort_area_table(masked_area_table_t* table)
{
int32_t i;
for (i=0; i<table->seqcount;i++)
{
qsort(table->sequence[i]->area,
table->sequence[i]->count,
sizeof(masked_area_t),
(int (*)(const void *, const void *))compare_area);
}
}
static masked_area_list_t *strip_area_list(masked_area_list_t* list)
{
int32_t i;
int32_t j;
int32_t count;
int32_t newcount;
count = list->count;
newcount=count;
for (i=1;i<count;i++)
{
/* fprintf(stderr,"\n%d->%d %d->%d ==>",list->area[i-1].begin,list->area[i-1].end,list->area[i].begin,list->area[i].end); */
if ((list->area[i].begin-1) <= list->area[i-1].end)
{
/* fprintf(stderr," joined"); */
list->area[i].begin=list->area[i-1].begin;
list->area[i-1].begin=-1;
newcount--;
}
}
list->count=newcount;
for (i=0,j=0;i<count;i++)
{
if (list->area[i].begin>=0)
{
if (i!=j)
list->area[j]=list->area[i];
j++;
}
}
return realloc_masked_area_list(list,newcount);
}
static void strip_area_table(masked_area_table_t* table)
{
int32_t seq;
int32_t oldcount;
masked_area_list_t* list;
sort_area_table(table);
for (seq=0; seq < table->seqcount;seq++)
{
list = table->sequence[seq];
oldcount = list->count;
table->sequence[seq]=strip_area_list(list);
table->total-=oldcount - table->sequence[seq]->count;
}
}
static int32_t search_area(const masked_area_t* v1,const masked_area_t* v2)
{
int32_t pos;
pos = v1->begin;
if (pos < v2->begin)
return -1;
if (pos > v2->end)
return 1;
return 0;
}
masked_area_table_t *KMRK_ReadMaskArea(char *areafile,int32_t seqcount,int32_t complement)
{
FILE* area;
char buffer[1000];
char *ok;
int32_t begin;
int32_t end;
int32_t sequence;
int32_t column;
int32_t linecount;
masked_area_table_t *table;
if (complement > 0)
seqcount++;
else
complement=0;
area = fopen(areafile,"r");
linecount=0;
table=new_masked_area_table(seqcount,AREA_COUNT_INIT);
do {
linecount++;
ok = fgets(buffer,999,area);
if (ok)
{
column = sscanf(buffer,"%d %d %d",&begin,&end,&sequence);
if (column > 1 && begin <= end)
{
begin--;
end--;
if (column==3)
sequence--;
else
sequence=0;
if (sequence && complement)
sequence++;
push_area(table,sequence,begin,end);
if (!sequence && complement)
push_area(table,1,complement -1 - end,complement -1 -begin);
}
if (column==1)
fprintf(stderr,"WARNING in mask file reading line %d\n",linecount);
}
} while (ok);
fprintf(stderr,"\nread %d masked areas from file\n",table->total);
strip_area_table(table);
fprintf(stderr,"strip to %d non overlaping areas\n",table->total);
return table;
}
char KMRK_isMasked(masked_area_table_t *mask,int32_t seq, int32_t position)
{
masked_area_t input;
int32_t result;
masked_area_list_t *list;
if (! mask || (seq >= mask->seqcount))
return 0;
list = mask->sequence[seq];
input.begin=position;
result = bsearch(&input,
list->area,
list->count,
sizeof(masked_area_t),
(int (*)(const void *, const void *))search_area) != NULL;
return result;
}
\ No newline at end of file
/*
* KMRK_mask.h
* repseek
*
* Created by Eric Coissac on 04/12/04.
* Copyright 2004 __MyCompanyName__. All rights reserved.
*
*/
#include <stdint.h>
#ifndef _KMRK_MASK_H_
#define _KMRK_MASK_H_
typedef struct {
int32_t begin;
int32_t end;
} masked_area_t;
typedef struct {
int32_t reserved;
int32_t count;
masked_area_t area[1];
} masked_area_list_t;
typedef struct {
int32_t seqcount;
int32_t total;
masked_area_list_t *sequence[1];
} masked_area_table_t;
masked_area_table_t *KMRK_ReadMaskArea(char *areafile,int32_t seqcount,int32_t complement);
char KMRK_isMasked(masked_area_table_t *mask,int32_t seq, int32_t position);
#endif
\ No newline at end of file
/**
* @file KMRK_merge_seeds.c
* @author Eric Coissac <coissac@inrialpes.fr>
* @date Wed Mar 3 11:15:57 2004
*
* @brief Merge function of overlapping seeds
*
*
*/
#include "KMRK_merge_seeds.h"
void KMRK_MergeSeeds(AllSeeds_type *AllSeeds,
int8_t opt_dir,
int8_t opt_inv)
{
int32_t i; /* the current seed */
int32_t j; /* the checked seed */
int32_t N; /* the kept ones */
Seed_type* seeds;
if(opt_dir){
seeds = AllSeeds->dirSeeds;
for(i=0, N=0 ;i<AllSeeds->nDirSeeds; i++){
if(seeds[i].pos1==-1) /* any seed at -1 is removed */
continue;
j=i+1;
while( (seeds[j].pos1!=-1) &&
(seeds[i].pos1!=-1) &&
(j < AllSeeds->nDirSeeds) &&
(seeds[j].pos1 < seeds[i].pos1+ seeds[i].length))
{
if(
((seeds[j].pos2 >= seeds[i].pos2) &&
(seeds[j].pos2 < seeds[i].pos2 + seeds[i].length)) || /* if the seeds are overlapping */
((seeds[j].pos2 + seeds[j].length >= seeds[i].pos2) &&
(seeds[j].pos2 + seeds[j].length < seeds[i].pos2 + seeds[i].length)))
{
if(seeds[j].length <= seeds[i].length)
seeds[j].pos1=seeds[j].pos2=seeds[j].length=-1; /* removed the smallest */
else
seeds[i].pos1=seeds[i].pos2=seeds[i].length=-1;
}
j++;
}
if(seeds[i].pos1 !=-1)
{ /* if this seed is not out, store it */
seeds[N].pos1 = seeds[i].pos1;
seeds[N].pos2 = seeds[i].pos2;
seeds[N].length = seeds[i].length;
N++;
}
}
AllSeeds->nFilteredDirSeeds += AllSeeds->nDirSeeds-N;
AllSeeds->nDirSeeds=N;
}
if(opt_inv){
seeds = AllSeeds->invSeeds;
for(i=0, N=0 ;i<AllSeeds->nInvSeeds; i++){
if(seeds[i].pos1==-1)
continue;
j=i+1;
while( (seeds[j].pos1!=-1 ) &&
(seeds[i].pos1!=-1 ) &&
(j < AllSeeds->nInvSeeds) &&
(seeds[j].pos1 < seeds[i].pos1+seeds[i].length))
{
if(
((seeds[j].pos2 >= seeds[i].pos2) && /* if the seeds are overlapping */
(seeds[j].pos2 < seeds[i].pos2+seeds[i].length)) ||
((seeds[j].pos2 + seeds[j].length >= seeds[i].pos2) &&
(seeds[j].pos2 + seeds[j].length < seeds[i].pos2+seeds[i].length)))
{
if(seeds[j].length <= seeds[i].length)
seeds[j].pos1=seeds[j].pos2=seeds[j].length=-1; /* removed the smallest */
else
seeds[i].pos1=seeds[i].pos2=seeds[i].length=-1;
}
j++;
}
if(seeds[i].pos1!=-1)
{ /* if this seed is not out, store it */
seeds[N].pos1 = seeds[i].pos1;
seeds[N].pos2 = seeds[i].pos2;
seeds[N].length = seeds[i].length;
N++;
}
}
AllSeeds->nFilteredInvSeeds += AllSeeds->nInvSeeds-N;
AllSeeds->nInvSeeds=N;
}
KMRK_compactSeeds(AllSeeds);
}
#ifndef KMRK_merge_seeds_h
#define KMRK_merge_seeds_h
#include "KMRK_Seeds.h"
void KMRK_MergeSeeds(AllSeeds_type *AllSeeds,
int8_t opt_dir,
int8_t opt_inv);
#endif /* KMRK_MergeSeeds */
SOURCES = KMRK.c \
KMRK_mask.c \
KMRK_merge_seeds.c \
KMRK_Seeds.c
SRCS=$(SOURCES)
OBJECTS= $(patsubst %.c,%.o,$(SOURCES))
LIBFILE= libKMRK.a
RANLIB= ranlib
include ../global.mk
all: $(LIBFILE)
clean:
rm -rf $(OBJECTS) $(LIBFILE)
$(LIBFILE): $(OBJECTS)
ar -cr $@ $?
$(RANLIB) $@
/******
file : memory.c
function : All about memory of the KMR, Seeds and Repeats
All MyMalloc() series is about follwoing how mauch memory has been used
created : 19 Sep 2003
modif : Oct 2003, Feb 2004
modif : Dec 2004 <EC> ; Corrected Memory declaration
author : amikezor
*****/
#include <stdio.h>
#include <stdlib.h>
#include "repseek_types.h"
#include "memory.h"
MemUsage Memory;
/*
Functions to count the memory usage all along
dybamic allocation and free
*/
void PrintMem(char *Comment){
extern MemUsage Memory;
fprintf(stderr,"\n%s\nMemory Usage\n\t* Max is: %d bytes, %.2f Kb, %.2f Mb\n\t* Cur is: %d bytes, %.2f Kb, %.2f Mb\n",
Comment,
Memory.Max, (float)Memory.Max/1024, (float)Memory.Max/(1024*1024),
Memory.Current, (float)Memory.Current/1024, (float)Memory.Current/(1024*1024));
}
void PrintMaxMem( void ){
extern MemUsage Memory;
if(Memory.Max < 1024)
fprintf(stderr,"Max Memory Usage.. %d bytes\n", Memory.Max);
else if(Memory.Max < 1024*1024)
fprintf(stderr,"Max Memory Usage.. %.2f Kilobytes\n", (float)Memory.Max/1024);
else if(Memory.Max < 1024*1024*1024)
fprintf(stderr,"Max Memory Usage.. %.2f Megabytes\n", (float)Memory.Max/(1024*1024));
else
fprintf(stderr,"Max Memory Usage.. %.2f Gigabytes\n", (float)Memory.Max/(1024*1024*1024));
}
void Update_Mem(int32_t Value){
extern MemUsage Memory;
Memory.Current += Value;
Memory.Max = (Memory.Current>Memory.Max)?Memory.Current:Memory.Max;
}
void Init_Mem(int32_t Value){
extern MemUsage Memory;
Memory.Current = Value;
Memory.Max = Value;
}
/*
Replace functions of dynamic allocation
to allow the tracking of memory usage
*/
void *MyMalloc( int32_t size , char *Error ){
void *pointer;
pointer = malloc(size);
if(!pointer)fprintf(stderr,"%s\n",Error),exit(3);
Update_Mem(size);
return pointer;
}
void *MyCalloc( int32_t number, int32_t TypeSize , char *Error ){
void *pointer;
pointer = calloc(number, TypeSize);
if(!pointer)fprintf(stderr,"%s\n",Error),exit(3);
Update_Mem(number*TypeSize );
return pointer;
}
void MyFree( void *Pointer, int32_t size){
free(Pointer);
Pointer=NULL;
Update_Mem(-size);
}
void *MyRealloc( void *Pointer, int32_t newsize, int32_t oldsize, char *Error){
Pointer = realloc(Pointer,newsize);
if(!Pointer)fprintf(stderr,"%s\n",Error),exit(3);
Update_Mem( newsize-oldsize );
return Pointer;
}
/*
Deal with Stacks structure for KMR
void MallocStack(Stacks *s, int32_t number, int32_t *histo, int32_t AllValues){
int32_t i;
s->nStacks = number;
s->nValues = AllValues;
s->ppStacks = (int32_t **)MyMalloc( number * sizeof(int32_t *),
"MallocStack: ppStacks malloc error, bye\n");
s->lenStacks = (int32_t *)MyMalloc( number * sizeof(int32_t),
"MallocStack: lenStacks malloc error, bye\n");
s->ppStacks[0] = (int32_t *)MyMalloc( AllValues * sizeof(int32_t),
"MallocStack: ppStacks[0] malloc error, bye\n");
s->lenStacks[0]=0;
for(i=1;i < number; i++){
s->lenStacks[i]=0;
s->ppStacks[i] = s->ppStacks[i-1] + histo[i] ;
}
}
void FreeStack( Stacks *p){
MyFree(p->ppStacks[0] , p->nValues*sizeof(int32_t) );
MyFree(p->ppStacks , p->nStacks*sizeof(int32_t *) );
MyFree(p->lenStacks , p->nStacks*sizeof(int32_t));
}
*/
/*
Deal with the Seeds part
void free_Seeds(Seeds AllSeeds)
{
if( AllSeeds.nDirSeeds ){
MyFree(AllSeeds.DirPos1, AllSeeds.nDirSeeds*sizeof(int32_t));
MyFree(AllSeeds.DirPos2, AllSeeds.nDirSeeds*sizeof(int32_t));
MyFree(AllSeeds.DirLen, AllSeeds.nDirSeeds*sizeof(int32_t));
MyFree(AllSeeds.DirMeanR, AllSeeds.nDirSeeds*sizeof(float));
}
if(AllSeeds.nInvSeeds ){
MyFree(AllSeeds.InvPos1, AllSeeds.nInvSeeds*sizeof(int32_t));
MyFree(AllSeeds.InvPos2, AllSeeds.nInvSeeds*sizeof(int32_t));
MyFree(AllSeeds.InvLen, AllSeeds.nInvSeeds*sizeof(int32_t));
MyFree(AllSeeds.InvMeanR, AllSeeds.nInvSeeds*sizeof(float));
}
}
*/
/*
Malloc if it is the first time otherwise readjust
void AllocSeeds(Seeds *AllSeeds, int32_t size, int32_t old_size, int8_t opt_dir, int8_t opt_inv){
if(opt_inv != 1 && opt_dir != 1)
fprintf(stderr,"AllocSeeds: requiere at least one of opt_dir and opt_inv to be 1\n"),exit(4);
if(opt_dir == 1){
if( AllSeeds->DirPos1 == NULL){
AllSeeds->DirPos1 = (int32_t *)MyCalloc(size , sizeof(int32_t),"AllocSeeds: Alloc for DirPos1 failed, bye");
AllSeeds->DirPos2 = (int32_t *)MyCalloc(size , sizeof(int32_t),"AllocSeeds: Alloc for DirPos2 failed, bye");
}
else{
AllSeeds->DirPos1 = (int32_t *)MyRealloc(AllSeeds->DirPos1, size * sizeof(int32_t), old_size* sizeof(int32_t),
"AllocSeeds: realloc for DirPos1 failed, bye");
AllSeeds->DirPos2 = (int32_t *)MyRealloc(AllSeeds->DirPos2, size * sizeof(int32_t), old_size* sizeof(int32_t),
"AllocSeeds: realloc for DirPos2 failed, bye");
}
}
if(opt_inv == 1){
if( AllSeeds->InvPos1 == NULL){
AllSeeds->InvPos1 = (int32_t *)MyCalloc(size , sizeof(int32_t), "AllocSeeds: Alloc for InvPos1 failed, bye");
AllSeeds->InvPos2 = (int32_t *)MyCalloc(size , sizeof(int32_t), "AllocSeeds: Alloc for InvPos2 failed, bye");
}
else{
AllSeeds->InvPos1 = (int32_t *)MyRealloc(AllSeeds->InvPos1, size * sizeof(int32_t), old_size* sizeof(int32_t),
"AllocSeeds: realloc for InvPos1 failed, bye");
AllSeeds->InvPos2 = (int32_t *)MyRealloc(AllSeeds->InvPos2, size * sizeof(int32_t), old_size* sizeof(int32_t),
"AllocSeeds: realloc for InvPos2 failed, bye");
}
}
}
*/
/*
Deal with the Repeats structure
*/
Repeats mem_Repeats(int32_t Ndir, int32_t Ninv){
Repeats AllRepeats; /* All Repeats structure */
AllRepeats.nDirRep = Ndir; /* set the number of repeats to the number of seeds */
AllRepeats.nInvRep = Ninv;
AllRepeats.nDirBadRep = 0; /* set the "bad" repet (included into another rep) as 0 */
AllRepeats.nInvBadRep = 0;
if(AllRepeats.nDirRep)
AllRepeats.DirRep = (Rep *)MyMalloc( (AllRepeats.nDirRep)*sizeof(Rep), "init_Repeats: repdir malloc error" );
else
AllRepeats.DirRep = NULL;
if(AllRepeats.nInvRep)
AllRepeats.InvRep = (Rep *)MyMalloc( (AllRepeats.nInvRep)*sizeof(Rep), "init_Repeats: repinv malloc error" );
else
AllRepeats.InvRep = NULL;
return AllRepeats;
}
void free_Repeats(Repeats AllRep)
{
if(AllRep.nDirRep)
MyFree(AllRep.DirRep, AllRep.nDirRep*sizeof(Rep));
if(AllRep.nInvRep)
MyFree(AllRep.InvRep, AllRep.nInvRep*sizeof(Rep));
}
/**
* @file memory.h
* @author Achaz G
* @date April 2004
*
* @brief header for memory alloc/dealloc
* modif : Dec 2004 <EC> ; Corrected Memory declaration
*
*
*/
#ifndef _MEMORY_H_
#define _MEMORY_H_
#include "repseek_types.h"
typedef struct { /********** Memory Usage structure **************/
int32_t Max;
int32_t Current;
} MemUsage;
#include <stdint.h>
/********** **********
Global Variable(s)
********** **********/
extern MemUsage Memory; /* Instance of the global variable for memory tracking */
/*
Follow memory usage
*/
void PrintMem(char *Comment);
void PrintMaxMem( void );
void Update_Mem(int32_t Value);
void Init_Mem(int32_t Value);
/*
All Alloc/Free to follow of memory usage
*/
void *MyMalloc( int32_t size , char *Error );
void *MyCalloc( int32_t number, int32_t TypeSize , char *Error );
void MyFree( void *Pointer, int32_t size);
void *MyRealloc( void *Pointer, int32_t newsize, int32_t oldsize, char *Error);
/*
For Stacks
void MallocStack(Stacks *s, int32_t number, int32_t *histo, int32_t AllValues);
void FreeStack( Stacks *p);
For Seeds
void free_Seeds(Seeds AllSeeds);
void AllocSeeds(Seeds *AllSeeds, int32_t size, int32_t old_size, int8_t opt_dir, int8_t opt_inv);
*/
/*
For Repeats
*/
Repeats mem_Repeats(int32_t Ndir, int32_t Ninv);
void free_Repeats(Repeats AllRep);
/*
Not used anymore, but just in case
*/
#include <stdio.h>
#include <stdlib.h>
#define KMRK_MALLOC(var,type,size,message) { \
var = (type*) malloc(size); \
if (!var) \
{ \
fprintf(stderr,"%s\n",message); \
exit(4); \
} \
}
#define KMRK_CALLOC(var,type,length,message) { \
var = (type*) calloc(length,sizeof(type)); \
if (!var) \
{ \
fprintf(stderr,"%s\n",message); \
exit(4); \
} \
}
#define KMRK_REALLOC(var,type,size,message) { \
var = (type*) realloc(var,size); \
if (!var) \
{ \
fprintf(stderr,"%s\n",message); \
exit(4); \
} \
}
#endif /* _MEMORY_H_*/
/**
* @file repseek_types.h
* @author Guillaume Achaz <gachaz@oeb.harvard.edu>
* @date April 2004
* @modif July 2004 turn scores into doubles
* @brief definition of general types and macros for repseek
*
*
*/
#ifndef _REPSEEK_TYPES_
#define _REPSEEK_TYPES_
/*
Version of the program
*/
#define REPSEEK_VERSION "4.2"
#define REPSEEK_DATE "Nov 2004"
/********** **********
General Macros
********** **********/
/*
Macros to compare 2 or three values
*/
#define MAX2( A, B ) ( ((A)>(B))?(A):(B) )
#define MAX3( A, B, C ) ( ((MAX2(A,B))>(C))?(MAX2(A,B)):(C) )
#define MIN2( A, B ) ( ((A)<(B))?(A):(B) )
#define MAX( A, B ) MAX2( A, B )
#define MIN( A, B ) MIN2( A, B )
/*
Absolute values
*/
#define ABS(x) (( (x)>=0 )? (x) : -(x))
/********** **********
All types used in repseek
********** **********/
#include <stdio.h> /* The type FILE * is defined here */
#include <stdint.h> /* all, the int??_t are defined in there */
/**
* Store informations about one STRICT repeat (seeds)
*
*/
typedef struct { /* the complete seed structure */
int32_t pos1; /**< position of the first copy */
int32_t pos2; /**< position of the second copy */
int32_t length; /**< length of the strict repeats */
float rmean; /**< mean repeat leavel */
} Seed_type;
typedef struct { /* Just after a KMRK length X, only the 2 pos matter */
int32_t pos1; /**< postion of the first copy */
int32_t pos2; /**< postion of the second copy */
} SmallSeed_type;
/**
* Store informations about all strict repeat (seeds)
*
*/
typedef struct {
int32_t cDirSeeds; /**< currently allocated space in dirSeeds array */
int32_t nDirSeeds; /**< count of direct strict repeats */
int32_t nFilteredDirSeeds; /**< ??? */
Seed_type* dirSeeds; /**< array of direct repeats */
int32_t cInvSeeds; /**< currently allocated space in invSeeds array */
int32_t nInvSeeds; /**< count of inverted strict repeats */
int32_t nFilteredInvSeeds; /**< ??? */
Seed_type* invSeeds; /**< array of inverted repeats */
} AllSeeds_type;
/**
* Store informations about one GENERIC repeat
*
*/
typedef struct{
char type[20]; /* its name; i.e. Tandem, Palindrome, etc... */
int32_t pos1, pos2, /* both copies postions */
len1, len2, /* both copies length */
seed_pos1,seed_pos2, /* pos1 and pos2 of the originate seed */
seed_len, /* len of the seed */
match, align_len; /* number of match and length of alignment */
double score; /* the alignment score */
float seed_meanR; /* the seed meanR */
float meanR; /* The mean R-level of the repeat */
int32_t mainR; /* its Mode R */
float fraction_mainR; /* the fraction of length containing the Mode R */
} Rep;
/**
* Store informations about All GENERIC repeats
*
*/
typedef struct {
int32_t nDirRep; /* Total Number of Direct Repats in Mem */
int32_t nDirBadRep; /* Direct repeats set to -1 -- filtered out and co. */
Rep *DirRep; /* The array of Dir Rep */
int32_t nInvRep; /* Total Number of Inverted Repats in Mem */
int32_t nInvBadRep; /* Inverted Repeats set to -1 -- filtered out and co. */
Rep *InvRep; /* The array of Inverted Rep */
} Repeats;
#define MATRIX_SIZE 26
typedef struct { /******* The scoring Matrix ************/
double matrix[MATRIX_SIZE][MATRIX_SIZE]; /* the matrix of match/missmatch */
double gap_open; /* value of gap-open */
double gap_ext; /* value of gap_ext */
double expect;
} SCORING;
typedef struct { /******* The Results of Alignement by Dynamik programming ************/
double *scores; /* the score strings (+/- 'matrix') */
double *pscore; /* pointer to the current score */
char *traces; /* the path matrix - could take values 'l'eft, 'd'iagonal, or 'a'bove or 'u'nknown */
double *F; /* *Above -- needed for memorizing deletion in seq2 */
double *pBestScore; /* pointer to it */
int32_t BestScore_row; /* its row and col */
int32_t BestScore_col;
char *traceback; /* all you need for bactracking */
char *traceback_f; /* memory for forward traceback and then check other seeds */
char *traceback_b; /* memory needed for backward traceback - to avoid erasing the forward one */
int32_t alignment_len; /* guess ?? */
int32_t matches; /* number of match (score>0 in scoring matrix) */
int32_t nSegment; /* number of segment */
int32_t *Segment_begin; /* begin and end of each segment */
int32_t *Segment_end;
int32_t max_scores; /* size of the matrices only for memory purposes */
int32_t max_col;
int32_t max_row;
int32_t max_alignlen;
} RESULTS;
#endif /* _REPSEEK_TYPES_ */
/**
* @file KMRK_sequence.h
* @author Eric Coissac <coissac@inrialpes.fr>
* @date Tue Feb 24 22:22:57 2004
*
* @brief Header file for sequence utilities
*
*
*/
#ifndef KMRK_sequence_h
#define KMRK_sequence_h
#include <stdint.h>
int8_t CheckSeq(char *seq, char *alpha);
void nonACGTXtoN(char *seq);
void UpperSequence(char *seq);
void invseq(char *seqsrc, char *seqdest);
#endif /* KMRK_sequence_h */
/* ----------------------------------------------- */
/* dft_pat_seq_code.h */
/* default alphabet encoding for alpha */
/* ----------------------------------------------- */
0x00000001 /* A */, 0x00000002 /* B */, 0x00000004 /* C */,
0x00000008 /* D */, 0x00000010 /* E */, 0x00000020 /* F */,
0x00000040 /* G */, 0x00000080 /* H */, 0x00000100 /* I */,
0x00000200 /* J */, 0x00000400 /* K */, 0x00000800 /* L */,
0x00001000 /* M */, 0x00002000 /* N */, 0x00004000 /* O */,
0x00008000 /* P */, 0x00010000 /* Q */, 0x00020000 /* R */,
0x00040000 /* S */, 0x00080000 /* T */, 0x00100000 /* U */,
0x00200000 /* V */, 0x00400000 /* W */, 0x00800000 /* X */,
0x01000000 /* Y */, 0x02000000 /* Z */
/* ----------------------------------------------- */
/* dna_code.h */
/* alphabet encoding for dna/rna */
/* ----------------------------------------- */
/* IUPAC encoding */
/* ----------------------------------------- */
/* G/A/T/C */
/* U=T */
/* R=AG */
/* Y=CT */
/* M=AC */
/* K=GT */
/* S=CG */
/* W=AT */
/* H=ACT */
/* B=CGT */
/* V=ACG */
/* D=AGT */
/* N=ACGT */
/* X=ACGT */
/* EFIJLOPQZ not recognized */
/* ----------------------------------------- */
/* dual encoding */
/* ----------------------------------------- */
/* A=ADHMNRVW */
/* B=BCDGHKMNRSTUVWY */
/* C=BCHMNSVY */
/* D=ABDGHKMNRSTUVWY */
/* G=BDGKNRSV */
/* H=ABCDHKMNRSTUVWY */
/* K=BDGHKNRSTUVWY */
/* M=ABCDHMNRSVWY */
/* N=ABCDGHKMNRSTUVWY */
/* R=ABDGHKMNRSVW */
/* S=BCDGHKMNRSVY */
/* T=BDHKNTUWY */
/* U=BDHKNTUWY */
/* V=ABCDGHKMNRSVWY */
/* W=ABDHKMNRTUVWY */
/* X=ABCDGHKMNRSTUVWY */
/* Y=BCDHKMNSTUVWY */
/* EFIJLOPQZ not recognized */
/* ----------------------------------------------- */
#ifndef USE_DUAL
/* IUPAC */
0x00000001 /* A */, 0x00080044 /* B */, 0x00000004 /* C */,
0x00080041 /* D */, 0x00000000 /* E */, 0x00000000 /* F */,
0x00000040 /* G */, 0x00080005 /* H */, 0x00000000 /* I */,
0x00000000 /* J */, 0x00080040 /* K */, 0x00000000 /* L */,
0x00000005 /* M */, 0x00080045 /* N */, 0x00000000 /* O */,
0x00000000 /* P */, 0x00000000 /* Q */, 0x00000041 /* R */,
0x00000044 /* S */, 0x00080000 /* T */, 0x00080000 /* U */,
0x00000045 /* V */, 0x00080001 /* W */, 0x00080045 /* X */,
0x00080004 /* Y */, 0x00000000 /* Z */
#else
/* DUAL */
0x00623089 /* A */, 0x017e34ce /* B */, 0x01243086 /* C */,
0x017e34cb /* D */, 0x00000000 /* E */, 0x00000000 /* F */,
0x0026244a /* G */, 0x017e348f /* H */, 0x00000000 /* I */,
0x00000000 /* J */, 0x017e24ca /* K */, 0x00000000 /* L */,
0x0166308f /* M */, 0x017e34cf /* N */, 0x00000000 /* O */,
0x00000000 /* P */, 0x00000000 /* Q */, 0x006634cb /* R */,
0x012634ce /* S */, 0x0158248a /* T */, 0x0158248a /* U */,
0x016634cf /* V */, 0x017a348b /* W */, 0x017e34cf /* X */,
0x017c348e /* Y */, 0x00000000 /* Z */
#endif
/* ----------------------------------------------- */
/* prot_code.h */
/* alphabet encoding for proteins */
/* ----------------------------------------- */
/* IUPAC encoding */
/* ----------------------------------------- */
/* B=DN */
/* Z=EQ */
/* X=any - {X} */
/* JOU not recognized */
/* ----------------------------------------- */
/* dual encoding */
/* ----------------------------------------- */
/* B=BDN */
/* D=BD */
/* E=EZ */
/* N=BN */
/* Q=QZ */
/* X=any - {X} */
/* Z=EQZ */
/* JOU not recognized */
/* ----------------------------------------------- */
#ifndef USE_DUAL
/* IUPAC */
0x00000001 /* A */, 0x00002008 /* B */, 0x00000004 /* C */,
0x00000008 /* D */, 0x00000010 /* E */, 0x00000020 /* F */,
0x00000040 /* G */, 0x00000080 /* H */, 0x00000100 /* I */,
0x00000000 /* J */, 0x00000400 /* K */, 0x00000800 /* L */,
0x00001000 /* M */, 0x00002000 /* N */, 0x00000000 /* O */,
0x00008000 /* P */, 0x00010000 /* Q */, 0x00020000 /* R */,
0x00040000 /* S */, 0x00080000 /* T */, 0x00000000 /* U */,
0x00200000 /* V */, 0x00400000 /* W */, 0x037fffff /* X */,
0x01000000 /* Y */, 0x00010010 /* Z */
#else
/* DUAL */
0x00000001 /* A */, 0x0000200a /* B */, 0x00000004 /* C */,
0x0000000a /* D */, 0x02000010 /* E */, 0x00000020 /* F */,
0x00000040 /* G */, 0x00000080 /* H */, 0x00000100 /* I */,
0x00000000 /* J */, 0x00000400 /* K */, 0x00000800 /* L */,
0x00001000 /* M */, 0x00002002 /* N */, 0x00000000 /* O */,
0x00008000 /* P */, 0x02010000 /* Q */, 0x00020000 /* R */,
0x00040000 /* S */, 0x00080000 /* T */, 0x00000000 /* U */,
0x00200000 /* V */, 0x00400000 /* W */, 0x037fffff /* X */,
0x01000000 /* Y */, 0x02010010 /* Z */
#endif
/* ---------------------------------------------------------------- */
/* Copyright (c) Atelier de BioInformatique */
/* @file: Gmach.h */
/* @desc: machine dependant setup */
/* @+ *should* be included in all ABI softs */
/* */
/* @history: */
/* @+ <Gloup> : Jul 95 : MWC first draft */
/* @+ <Gloup> : Jan 96 : adapted to Pwg */
/* @+ <Gloup> : Nov 00 : adapted to Mac_OS_X */
/* ---------------------------------------------------------------- */
#ifndef _H_Gmach
/* OS names */
#define _H_Gmach
/* Macintosh Classic */
/* Think C environment */
#ifdef THINK_C
#define MACINTOSH
#define MAC_OS_C
#endif
/* Macintosh Classic */
/* Code-Warrior */
#ifdef __MWERKS__
#define MACINTOSH
#define MAC_OS_C
#endif
/* Macintosh OS-X */
#ifdef MAC_OS_X
#define MACINTOSH
#define UNIX
#define UNIX_BSD
#endif
/* LINUX */
#ifdef LINUX
#define UNIX
#define UNIX_BSD
#endif
/* other Unix Boxes */
/* SunOS / Solaris */
#ifdef SUN
#define UNIX
#ifdef SOLARIS
#define UNIX_S7
#else
#define UNIX_BSD
#endif
#endif
/* SGI Irix */
#ifdef SGI
#define UNIX
#define UNIX_S7
#endif
/* ansi setup */
/* for unix machines see makefile */
#ifndef PROTO
#define PROTO 1
#endif
#ifndef ANSI_PROTO
#define ANSI_PROTO PROTO
#endif
#ifndef ANSI_STR
#define ANSI_STR 1
#endif
/* unistd.h header file */
#ifdef UNIX
#define HAS_UNISTD_H <unistd.h>
#endif
/* getopt.h header file */
#ifdef MAC_OS_C
#define HAS_GETOPT_H "getopt.h"
#endif
#ifdef SGI
#define HAS_GETOPT_H <getopt.h>
#endif
#endif
This diff is collapsed.
SOURCES = apat_parse.c \
apat_search.c \
libstki.c
SRCS=$(SOURCES)
OBJECTS= $(patsubst %.c,%.o,$(SOURCES))
LIBFILE= libapat.a
RANLIB=ranlib
include ../global.mk
all: $(LIBFILE)
clean:
rm -rf $(OBJECTS) $(LIBFILE)
$(LIBFILE): $(OBJECTS)
ar -cr $@ $?
$(RANLIB) $@
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
SOURCES = ecoapat.c \
ecodna.c \
ecoError.c \
ecoIOUtils.c \
ecoMalloc.c \
ecorank.c \
ecoseq.c \
ecotax.c \
ecofilter.c \
econame.c
SRCS=$(SOURCES)
OBJECTS= $(patsubst %.c,%.o,$(SOURCES))
LIBFILE= libecoPCR.a
RANLIB= ranlib
include ../global.mk
all: $(LIBFILE)
clean:
rm -rf $(OBJECTS) $(LIBFILE)
$(LIBFILE): $(OBJECTS)
ar -cr $@ $?
$(RANLIB) $@
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
#include "ecoPCR.h"
int eco_is_taxid_included( ecotaxonomy_t *taxonomy,
int32_t *restricted_taxid,
int32_t tab_len,
int32_t taxid)
{
int i;
ecotx_t *taxon;
taxon = eco_findtaxonbytaxid(taxonomy, taxid);
for (i=0; i < tab_len; i++)
if ( (taxon->taxid == restricted_taxid[i]) ||
(eco_isundertaxon(taxon, restricted_taxid[i])) )
return 1;
return 0;
}
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment