diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..20157a7 --- /dev/null +++ b/Makefile @@ -0,0 +1,74 @@ +# -*- makefile -*- +# just make headings for each thing and put the headings +# on the line for ALL +PROJECTDIR = . +BINDIR = $(PROJECTDIR) + +CC = gcc +CPPC = g++ +CFLAGS = -O3 -g -Wall +LDFLAGS = -lm + +DEPEND_FILES = *.cc *.c *.h +CLEANABLE_FILES = *.o *~ + +ALL = adjust anomaly build-icm check codon-usage compare-lists \ + extract generate get-len get-putative glimmer2 long-orfs + +.SUFFIXES: .cc .c + +.c.o: + $(CC) $(CFLAGS) -c $*.c -o $*.o + +.cc.o: + $(CPPC) $(CFLAGS) -c $*.cc -o $*.o + +all: $(ALL) + +adjust: adjust.o delcher.o + $(CPPC) -o $(BINDIR)/$@ adjust.o delcher.o $(LDFLAGS) + +anomaly: anomaly.o delcher.o gene.o + $(CPPC) -o $(BINDIR)/$@ anomaly.o delcher.o gene.o $(LDFLAGS) + +build-icm: build-icm.o misc.o + $(CC) -o $(BINDIR)/$@ build-icm.o misc.o $(LDFLAGS) + +check: check.o delcher.o + $(CPPC) -o $(BINDIR)/$@ check.o delcher.o $(LDFLAGS) + +codon-usage: codon-usage.o delcher.o gene.o + $(CPPC) -o $(BINDIR)/$@ codon-usage.o delcher.o gene.o $(LDFLAGS) + +compare-lists: compare-lists.o delcher.o + $(CPPC) -o $(BINDIR)/$@ compare-lists.o delcher.o $(LDFLAGS) + +extract: extract.o delcher.o + $(CPPC) -o $(BINDIR)/$@ extract.o delcher.o $(LDFLAGS) + +generate: generate.o delcher.o gene.o + $(CPPC) -o $(BINDIR)/$@ generate.o delcher.o gene.o $(LDFLAGS) + +get-len: get-len.o delcher.o + $(CPPC) -o $(BINDIR)/$@ get-len.o delcher.o $(LDFLAGS) + +get-putative: get-putative.o delcher.o + $(CPPC) -o $(BINDIR)/$@ get-putative.o delcher.o $(LDFLAGS) + +glimmer2: glimmer2.o delcher.o gene.o rnabin.o + $(CPPC) -o $(BINDIR)/$@ glimmer2.o delcher.o gene.o rnabin.o $(LDFLAGS) + +long-orfs: long-orfs.o delcher.o gene.o + $(CPPC) -o $(BINDIR)/$@ long-orfs.o delcher.o gene.o $(LDFLAGS) + +rnabin: rnabin.o delcher.o + $(CPPC) -o $(BINDIR)/$@ rnabin.o delcher.o $(LDFLAGS) + +depend: + makedepend $(DEPEND_FILES) + +clean: + /bin/rm -f $(CLEANABLE_FILES) + +# DO NOT DELETE THIS LINE -- make depend depends on it. + diff --git a/delcher.h b/delcher.h new file mode 100644 index 0000000..085f135 --- /dev/null +++ b/delcher.h @@ -0,0 +1,120 @@ +// A. L. Delcher +// +// File: ANNOTATION/Glimmer/delcher.h +// Version: 2.03 3 Dec 2002 +// +// Copyright (c) 2002 by Arthur Delcher, Steven Salzberg, Simon +// Kasif, and Owen White. All rights reserved. Redistribution +// is not permitted without the express written permission of +// the authors. +// +// Common generic routines. +// + + +#ifndef __DELCHER_H_INCLUDED +#define __DELCHER_H_INCLUDED + + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +#define TRUE 1 +#define FALSE 0 +#ifndef EXIT_FAILURE + #define EXIT_FAILURE -1 +#endif +#ifndef EXIT_SUCCESS + #define EXIT_SUCCESS 0 +#endif + + +const int FASTA_WIDTH = 60; + // Max number of characters to print on a FASTA data line + + +const char * Commatize + (long int n); +void Fasta_Print + (FILE * fp, char * s, char * hdr); +void Fasta_Print_N + (FILE * fp, char * s, int n, char * hdr); +FILE * File_Open + (const char *, const char *); +double Percent + (double a, double b); +void * Safe_calloc + (size_t N, size_t Len, size_t line_num = 0); +void * Safe_malloc + (size_t Len, size_t line_num = 0); +void * Safe_realloc + (void * Q, size_t Len, size_t line_num = 0); + + +template + DT Max (DT, DT); +template + DT Min (DT, DT); +template + void Swap (DT &, DT &); + + +template +DT Max (DT A, DT B) + +// Return the larger of A and B . + + { + if (A > B) + return A; + else + return B; + } + + + +template +DT Min (DT A, DT B) + +// Return the smaller of A and B . + + { + if (A < B) + return A; + else + return B; + } + + + +template +void Swap (DT & A, DT & B) + +// Swap the values in A and B . + + { + DT Save; + + Save = A; + A = B; + B = Save; + + return; + } + + + +#endif diff --git a/run-glimmer2 b/run-glimmer2 new file mode 100755 index 0000000..263bff2 --- /dev/null +++ b/run-glimmer2 @@ -0,0 +1,16 @@ +echo "run Glimmer2" +clear +echo "Genome is " $1 +echo "Find non-overlapping orfs in tmp.coord" +rm -f tmp.coord +long-orfs $1 | get-putative >tmp.coord +echo "Extract training sequences to tmp.train" +rm -f tmp.train +extract $1 tmp.coord >tmp.train +wc tmp.train +echo "Build interpolated context model in tmp.model" +rm -f tmp.model +build-icm tmp.model +echo "Predict genes with Glimmer2 with coordinates in g2.coord" +rm -f g2.coord +glimmer2 $1 tmp.model | get-putative >g2.coord