Commit 970ccb1a authored by Andreas Tille's avatar Andreas Tille
Browse files

New upstream version 0.3

parent ebec6624
Loading
Loading
Loading
Loading

Makefile

0 → 100644
+49 −0
Original line number Diff line number Diff line
CC?=gcc
LD=${CC}
CFLAGS=  -Wall -pedantic -std=c99 -g -O3 -DSORTEDUNMAPPED -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DDBGNFO -DSHOWALIGN -DDBGLEVEL=0 -DPROGNFO -Ilibs -Ilibs/sufarray -Isamtools
CFLAGS += `pkg-config --cflags htslib`
INC := -I include
CTAGS = ctags > tags
LIB = -lm -lpthread -lz -lncurses -L libs -lform -lmenu -L/usr/local/lib/
LIB += `pkg-config --libs htslib`
LIB += "-Wl,-rpath,`pkg-config --variable=libdir htslib`"


PRGTARGETS := segemehl haarz

LIBDIR := libs
BUILDDIR:= build
TARGETDIR := .
TARGETEXT := .x
SRCEXT := c


SOURCES := $(shell find $(LIBDIR) -type f -name *.$(SRCEXT))
SOURCES := $(filter-out $(EXCLUDE), $(SOURCES)) 

PRGSOURCES := $(patsubst %,$(LIBDIR)/%.c,$(PRGTARGETS))
LIBSOURCES := $(filter-out $(PRGSOURCES), $(SOURCES)) 

OBJECTS := $(patsubst $(LIBDIR)/%,$(BUILDDIR)/%,$(SOURCES:.$(SRCEXT)=.o))
LIBOBJECTS :=  $(patsubst $(LIBDIR)/%,$(BUILDDIR)/%,$(LIBSOURCES:.$(SRCEXT)=.o))


$(PRGTARGETS): $(OBJECTS)
	@echo "Linking $@";	
	$(LD) $(LIBOBJECTS) $(BUILDDIR)/$@.o -o $(TARGETDIR)/$@$(TARGETEXT) $(LIB)


$(BUILDDIR)/%.o: $(LIBDIR)/%.c
	@echo "Building... library for source $@";
	@mkdir -p $(BUILDDIR)	
	$(CC) $(CFLAGS) $(INC) -c -o $@ $<

all: $(PRGTARGETS)

clean:
	@echo " Cleaning...";
	@echo " $(RM) -r $(BUILDDIR) $(PRGTARGETS)"; $(RM) -r $(BUILDDIR) $(PRGTARGETS)


.PHONY: clean

Makefile.bak

0 → 100644
+49 −0
Original line number Diff line number Diff line
CC?=gcc
LD=${CC}
CFLAGS=  -Wall -pedantic -std=c99 -g -O3 -DSORTEDUNMAPPED -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DDBGNFO -DSHOWALIGN -DDBGLEVEL=0 -DPROGNFO -Ilibs -Ilibs/sufarray -Isamtools
CFLAGS += `pkg-config --cflags htslib`
INC := -I include
CTAGS = ctags > tags
LIB = -lm -lpthread -lz -lncurses -L libs -lform -lmenu -L/usr/local/lib/
LIB += `pkg-config --libs htslib`
LIB += "-Wl,-rpath,`pkg-config --variable=libdir htslib`"


ENTERTHETARGETSHERE

LIBDIR := libs
BUILDDIR:= build
TARGETDIR := .
TARGETEXT := .x
SRCEXT := c


SOURCES := $(shell find $(LIBDIR) -type f -name *.$(SRCEXT))
SOURCES := $(filter-out $(EXCLUDE), $(SOURCES)) 

PRGSOURCES := $(patsubst %,$(LIBDIR)/%.c,$(PRGTARGETS))
LIBSOURCES := $(filter-out $(PRGSOURCES), $(SOURCES)) 

OBJECTS := $(patsubst $(LIBDIR)/%,$(BUILDDIR)/%,$(SOURCES:.$(SRCEXT)=.o))
LIBOBJECTS :=  $(patsubst $(LIBDIR)/%,$(BUILDDIR)/%,$(LIBSOURCES:.$(SRCEXT)=.o))


$(PRGTARGETS): $(OBJECTS)
	@echo "Linking $@";	
	$(LD) $(LIBOBJECTS) $(BUILDDIR)/$@.o -o $(TARGETDIR)/$@$(TARGETEXT) $(LIB)


$(BUILDDIR)/%.o: $(LIBDIR)/%.c
	@echo "Building... library for source $@";
	@mkdir -p $(BUILDDIR)	
	$(CC) $(CFLAGS) $(INC) -c -o $@ $<

all: $(PRGTARGETS)

clean:
	@echo " Cleaning...";
	@echo " $(RM) -r $(BUILDDIR) $(PRGTARGETS)"; $(RM) -r $(BUILDDIR) $(PRGTARGETS)


.PHONY: clean
+112 −0
Original line number Diff line number Diff line
/*
 *   segemehl - a read aligner
 *   Copyright (C) 2008-2017  Steve Hoffmann and Christian Otto
 *
 *   This program is free software: you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation, either version 3 of the License, or
 *   (at your option) any later version.
 *
 *   This program is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *   GNU General Public License for more details.
 *
 *   You should have received a copy of the GNU General Public License
 *   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */


#ifndef ALIGNMENT_H
#define ALIGNMENT_H

@@ -16,10 +35,11 @@
 */

#include "basic-types.h"
#include "biofiles.h"

typedef enum 
{
  Replacement, Deletion, Insertion
  Replacement, Deletion, Insertion, Skipped, Softclip, Match, Mismatch
} Eoptype;

typedef struct
@@ -39,10 +59,12 @@ typedef struct {
  Uint voff;
  Multieop *meops;
  Uint numofmeops;

  unsigned char rmvseq;
  unsigned char rmuseq;
} Alignment;



void copyAlignment(Alignment *to, Alignment *from);
void showmultieoplist(FILE *dev, Alignment *al);
void showDynmultieoplist(Alignment* al, int size);
@@ -55,17 +77,36 @@ void wrapAlignment(Alignment *al);
Uint getEdist(Alignment *al);
Uint getBisulfiteMismatches(Alignment *al, Uint bisulfite);
Uint getWrongStrandBisulfiteMismatches(Alignment *al, Uint bisulfite);
void countEops(Alignment *al, Uint *mat, Uint *mis, Uint *ins, Uint *del);
void countEops(Alignment *al, Uint *mat, Uint *mis, Uint *ins, Uint *del, Uint *lmat);
char * multieopstring(Alignment *al, Uint leftpad, Uint rightpad, unsigned char rev);
Uint getUalignlen(Alignment *al);
Uint getValignlen(Alignment *al);
Uint getValignlenAndSkipped(Alignment *al);
int getSubstringEdist(Alignment *al, Uint u, Uint v);
int getAlignScore(Alignment *al, int *scores, int indel);
char* cigarstring(Alignment *al, Uint leftpad, Uint rightpad, char clipch, unsigned char rev);
char* cigarstring(Alignment *al, Uint leftpad, Uint rightpad, char clipch, unsigned char rev, char brief);
char* mdstring(Alignment *al, unsigned char rev);
Uint bl_cigarGetAlignLen(char *cigar);
char* bl_cigarGetAlignString(char *cigar);
char* bl_mdGetDiffString(char *MD);
char* getNTcodekey(void *space);
void getSoftClipScores(Alignment *al, int polyAlen, int *scores, int indel, int *pAscr, int *adscr, int *adlen) ;
char* mdstrings(Alignment **al, Uint noofaligns, unsigned char rev);
char* bl_cigarGetAlignString(char *cigar, uint64_t **, uint64_t **, Uint *nsplits);
Uint* getSplitEdist(Alignment *al, Uint *noofsplits);
Uint* getUPartialAlignlen(Alignment *al, Uint *noofparts);
char* getEopString (Alignment *al);
char isMatch (Alignment *al, Uint i, Uint j);
void  showAlignModel(Alignment* al, FILE *dev, gene_t *model);
Alignment* getSubAlignment (Alignment *al, Uint l, Uint r);
Uint bl_alignGet5PrimeV (Alignment *al, char rc);
Uint bl_alignGet3PrimeU (Alignment *al, char rc);
Uint bl_alignGet5PrimeU (Alignment *al, char rc);
void insertMeop(Alignment *al, Eoptype eop, Uint steps);
Alignment* expandAlignment(Alignment *al, Uint* expandpos, Uint *expandlen);
Uint getPartialAlignNumber(Alignment *al);
int getUalignlenNoClip(Alignment *al);
Alignment* bl_getPartialAlignments (Alignment *al, char *vseq, Uint *noofparts);
char* getAlignString(Alignment* al, char lf);
Alignment* reevalAlignment(Alignment *al);
char predictStrand(Alignment *al, char *vseq); 
#endif
+19 −0
Original line number Diff line number Diff line
/*
 *   segemehl - a read aligner
 *   Copyright (C) 2008-2017  Steve Hoffmann and Christian Otto
 *
 *   This program is free software: you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation, either version 3 of the License, or
 *   (at your option) any later version.
 *
 *   This program is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *   GNU General Public License for more details.
 *
 *   You should have received a copy of the GNU General Public License
 *   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */


#ifndef ALURUSORT_H
#define ALURUSORT_H

include/annotation.h

0 → 100644
+166 −0
Original line number Diff line number Diff line
/*
 *   segemehl - a read aligner
 *   Copyright (C) 2008-2017  Steve Hoffmann and Christian Otto
 *
 *   This program is free software: you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation, either version 3 of the License, or
 *   (at your option) any later version.
 *
 *   This program is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *   GNU General Public License for more details.
 *
 *   You should have received a copy of the GNU General Public License
 *   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */


#ifndef _ANNOTATION_
#define _ANNOTATION_

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "stringutils.h"
#include "basic-types.h"
#include "charsequence.h"
#include "gzidx.h"

typedef struct {
  int64_t dir5prime;
  int64_t dir3prime; 
  int64_t left;
  int64_t right;
  int8_t select;
} annotationoffs_t;


typedef struct {

  unsigned char type;
  Uint trackid;
  /*
   *
   * chromname is gff seqname
   *
   */
  char *chromname; 
  Uint chromnamelen;

  /*
   * BED und GFF: 1-offset
   * for personalSNP: start with 0-offset
   * end base is not part of the feature ie. if 
   * end = 100 last feature base is 99. see below.
   *
   */

  uint64_t start;
  uint64_t end;

  /* 
   * GFF: name is the feature key
   * BED: name is the name of the acutal feature
   * for personalSNP track name is alleles A,C,T,G separated by '/'. 
   * Leading '-' is indel: insertion if start-end=0 
   *
   * */
  
  char *name;     
  Uint namelen;
  double score;
  unsigned char strand;

  /*GFF fields*/
  unsigned char frame; 
  char *source; 
  Uint sourcelen;
  Uint noofattributes;
  char **attributes;
  Uint *attributelen;

  /*BED fields*/
  uint64_t thickStart;
  uint64_t thickEnd;
  Uint *itemRgb;
  Uint blockCount;
  uint64_t* blockSizes;
  uint64_t* blockStarts;
  Uint noofovl;
  Uint firstovl;
  Uint level;
  /*extension*/
  char **blockRefseqs;
  char *blockStrands;

  /*SNPitem*/
  Uint alleleCount;//number of alleles in name
  Uint *alleleFreq;//from comma separated list of number of observed alleles - if unkowns 0
  Uint *alleleScores;//from a comma separated list - if unkown 0

} annotationitem_t;

typedef struct {
    uint64_t noofchr;
    char **chrname;
    Uint *chrnamelen;
    Uint sz;
    uint64_t *noofbins;
    uint64_t **last; //stores the last interval strictly left of indexed interval [i*sz,i+1*sz];

} annotationindex_t;

typedef struct {
 
  uint64_t init;
  char sorted;
  char *trackname;
  Uint tracknamelen;
  char *description;
  Uint descriptionlen;
  Uint noofitems;
  annotationitem_t *items;
  char *filename;
  Uint filenamelen;
} annotationtrack_t;


typedef struct {
    uint64_t init;
    char sorted;
    Uint nooftracks;
    char **trackname;
    Uint *tracknamelen;
    char **description;
    Uint *descriptionlen;
    char **filename;
    Uint *filenamelen;
    Uint noofitems;
    annotationitem_t *items;
} annotationmultitrack_t;

void bl_annotationtrackDestruct (void *space, annotationtrack_t *track);
Uint bl_annotationtrackGetStats (void *space, annotationtrack_t *track);
void bl_annotationitemInit (annotationitem_t *item, unsigned char type);
void bl_annotationtrackInit (annotationtrack_t *track);
void bl_annotationitemDestruct (void *space, annotationitem_t *item);
Uint bl_annotationitem_cmp_track (Uint item, void *track, void *elem, void *nfo);
int bl_annotationitem_nostrand_cmp (void const *a, void const *b);
int bl_annotationitem_cmp (void const *a, void const *b);
void bl_annotationtrackDestruct (void *space, annotationtrack_t *track);
void bl_annotationtrackAssignTrackLevel(annotationtrack_t *track);
annotationmultitrack_t* bl_annotationtrackJoin(void *space, annotationmultitrack_t *dest, annotationtrack_t *src);
annotationitem_t* bl_annotationitemCopy(annotationitem_t *dest, annotationitem_t *src);
void bl_annotationmultitrackInit (annotationmultitrack_t *track);
Uint bl_annotationitem_cmp_multitrack (Uint item, void *track, void *elem, void *nfo);
void bl_annotationtrackSetItems(annotationtrack_t* track, annotationitem_t* items, Uint n);
annotationindex_t* bl_annotationIndex(annotationtrack_t *t);
void bl_annotationtrackDumpIndex(annotationindex_t *idx,annotationtrack_t *track); 
void bl_annotationmultitrackDestruct (void *space, annotationmultitrack_t *track);
void bl_annotationitemApplyOffset(annotationitem_t *item, int64_t off3, int64_t off5, int64_t left, int64_t right, int8_t select);
void  bl_annotationitemDump(FILE *dev, annotationitem_t *item);
void bl_annotationmultitrackApplyOffset(annotationmultitrack_t *mtrack, annotationoffs_t *off);
#endif
Loading