Skip to content

Commit

Permalink
Release v0.12.1 - clean build
Browse files Browse the repository at this point in the history
  • Loading branch information
arendsee committed Aug 30, 2016
2 parents 27841fc + a8e145f commit 7ef9e31
Show file tree
Hide file tree
Showing 24 changed files with 53 additions and 78 deletions.
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,9 @@ dtest-leak:
.PHONY: dclean
dclean:
rm -f vgcore.* gmon.out *log valgrind*
rm -rf zzz* db [a-z] gdb.txt ark
rm -rf zzz* db [a-z] gdb.txt ark .gdb_cmds
rm -f expected-output gdb input.gff observed-output synteny-map.tab
rm -f synmap.txt


# Runs the sample data, linking files for review
Expand Down
9 changes: 5 additions & 4 deletions src/Makefile
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
# CFLAGS=-Wall -g -std=gnu99 -lm
# CFLAGS=-Wall -g -std=gnu99 -lm -m64
CFLAGS=-Wall -gdwarf-4 -g3 -std=gnu99 -lm
# CFLAGS=-Wall -g -std=gnu99
# CFLAGS=-Wall -g -std=gnu99 -m64
CFLAGS=-Wall -gdwarf-4 -g3 -std=gnu99
LINKER_FLAGS=-lm
CC=gcc
TARGET=synder

OBJECTS=ia.o iv.o interval.o itree.o search.o ui.o lev.o block.o contig.o genome.o contiguous_set.o synmap.o io.o analysis.o map.o main.o global.o

${TARGET}: ${OBJECTS}
${CC} -o ${TARGET} ${CFLAGS} ${OBJECTS}
${CC} -o ${TARGET} ${OBJECTS} ${LINKER_FLAGS}

global.o: global.c global.h
${CC} -c ${CFLAGS} global.[ch]
Expand Down
8 changes: 4 additions & 4 deletions src/block.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ void set_Block(
Block* block,
long start,
long stop,
float score,
double score,
char strand,
Contig* parent,
Block* over,
Expand Down Expand Up @@ -117,9 +117,9 @@ void merge_block_a_into_b(Block * a, Block * b){
long olen = overlap_length(a, b);
long al = a->pos[1] - a->pos[0] + 1;
long bl = b->pos[1] - b->pos[0] + 1;
float score =
((float)(al - olen) / (al)) * a->score +
((float)(bl - olen) / (bl)) * b->score +
double score =
((double)(al - olen) / (al)) * a->score +
((double)(bl - olen) / (bl)) * b->score +
olen * (a->score / al + b->score / bl) / 2;

b->score = score;
Expand Down
2 changes: 1 addition & 1 deletion src/block.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ void set_Block(
Block* block,
long start,
long stop,
float score,
double score,
char strand,
Contig* parent,
Block* over,
Expand Down
6 changes: 3 additions & 3 deletions src/global.h
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
#ifndef __GLOBAL_H__
#define __GLOBAL_H__

#include <math.h>
#include <errno.h>
#include <stdlib.h>
#include <stdio.h>
#include <stdbool.h>
#include <string.h>
#include <stdint.h>
#include <errno.h>
#include <limits.h>
#include <assert.h>
#include <math.h>


#define REL_GT(x, y, d) ((d) ? (x) > (y) : (x) < (y))
#define REL_LT(x, y, d) ((d) ? (x) < (y) : (x) > (y))
Expand Down Expand Up @@ -151,7 +151,7 @@ struct Block {
Block *cnr[2]; // adjacent block in contiguous set
ContiguousSet *cset; // contiguous set id
long pos[2]; // start and stop positions
float score; // score provided by synteny program
double score; // score provided by synteny program
size_t grpid; // overlapping group id;
char strand; // strand [+-.]
size_t linkid; // a unique block id used mostly for debugging
Expand Down
5 changes: 2 additions & 3 deletions src/io.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#include "global.h"
#include "io.h"

void check_args(size_t line_no, size_t nargs, size_t correct_nargs);
Expand Down Expand Up @@ -56,7 +55,7 @@ Synmap *load_Synmap(FILE * synfile, int swap, long k, char trans)
line_no = 0;
size_t qcon_id, qblk_id, tcon_id, tblk_id;
long qstart, qstop, tstart, tstop;
float score;
double score;
char strand;

Block *qblk, *tblk;
Expand All @@ -67,7 +66,7 @@ Synmap *load_Synmap(FILE * synfile, int swap, long k, char trans)
if (line[0] != '$')
continue;
unloaded_blocks -= 2;
status = sscanf(line, "$ %zu %zu %zu %zu %zu %zu %zu %zu %f %c %c\n",
status = sscanf(line, "$ %zu %zu %zu %zu %zu %zu %zu %zu %lf %c %c\n",
&qcon_id, &qblk_id, &qstart, &qstop,
&tcon_id, &tblk_id, &tstart, &tstop, &score, &strand, &dummy);
check_args(line_no, status, 10);
Expand Down
3 changes: 0 additions & 3 deletions src/itree/ia.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
#include <stdlib.h>

#include "ia.h"
#include "interval.h"

IA * init_IA(){
IA * ia = (IA *)malloc(sizeof(IA));
Expand Down
3 changes: 0 additions & 3 deletions src/itree/interval.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
#include <stdlib.h>
#include <stdio.h>

#include "interval.h"

Interval * init_Interval(long start, long stop){
Expand Down
1 change: 1 addition & 0 deletions src/itree/interval.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#ifndef __INTERVAL_H__
#define __INTERVAL_H__

#include <stdio.h>
#include <stdlib.h>

/** the eponymous structure */
Expand Down
9 changes: 0 additions & 9 deletions src/itree/itree.c
Original file line number Diff line number Diff line change
@@ -1,13 +1,4 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <assert.h>
#include <stdbool.h>

#include "itree.h"
#include "interval.h"
#include "ia.h"
#include "iv.h"

/* local function prototypes */
IntervalTree * build_tree_r(IA * intervals, IntervalTree * parent, Orientation orientation);
Expand Down
9 changes: 8 additions & 1 deletion src/itree/itree.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
#ifndef __ITREE_H__
#define __ITREE_H__

#include "ia.h"
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <assert.h>
#include <stdbool.h>

#include "interval.h"
#include "ia.h"
#include "iv.h"

typedef enum orientation {
O_LEFT = -1,
Expand Down
6 changes: 0 additions & 6 deletions src/itree/iv.c
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
#include <stdio.h>
#include <assert.h>

#include "iv.h"

IV * init_IV(size_t available){
Expand Down
4 changes: 3 additions & 1 deletion src/itree/iv.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@

#define IV_INITIAL_SIZE 8

#include <string.h>
#include <stdio.h>
#include <assert.h>
#include <stdlib.h>
#include <stdbool.h>


#include "interval.h"
#include "ia.h"

Expand Down
7 changes: 0 additions & 7 deletions src/itree/search.c
Original file line number Diff line number Diff line change
@@ -1,11 +1,4 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <assert.h>
#include <stdbool.h>

#include "search.h"
#include "iv.h"

long count_interval_overlaps_r(Interval *, IntervalTree *, long);
long count_point_overlaps_r(long, IntervalTree *, long);
Expand Down
5 changes: 4 additions & 1 deletion src/itree/search.h
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
#ifndef __SEARCH_H__
#define __SEARCH_H__

#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <assert.h>
#include <stdbool.h>

#include "ia.h"
#include "iv.h"
#include "interval.h"
#include "itree.h"

Expand Down
6 changes: 0 additions & 6 deletions src/lev.c
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
#include <stdbool.h>

#include "lev.h"

void convert_seqname(FILE * synfile, FILE * intfile, int swap)
Expand Down
2 changes: 0 additions & 2 deletions src/lev.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
#ifndef __LEV_H__
#define __LEV_H__

#include <stdint.h>

#include "global.h"

#define TOLC(s) for(char *p =(s);*p;++p) *p=*p>0x40&&*p<0x5b?*p|0x60:*p
Expand Down
16 changes: 7 additions & 9 deletions src/map.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
#include "map.h"
#include "contig.h"
#include "synmap.h"

// A local utility structure used filter and store contiguous sets
typedef struct CSList{
Expand Down Expand Up @@ -55,7 +53,7 @@ void find_search_intervals(Synmap * syn, FILE * intfile, bool pblock)
// Row output of ctree
ResultContig * crc;
// Search interval score
float score;
double score;

char *line = (char *) malloc(LINE_BUFFER_SIZE * sizeof(char));
while (fgets(line, LINE_BUFFER_SIZE, intfile) && !feof(intfile)) {
Expand Down Expand Up @@ -107,7 +105,7 @@ void find_search_intervals(Synmap * syn, FILE * intfile, bool pblock)
get_si_bound(bounds[HI], set_bounds, blk_bounds, HI, inverted);


printf("%s\t%s\t%zu\t%zu\t%s\t%zu\t%zu\t%c\t%f\t%zu\t%i\t%i\t%i\n",
printf("%s\t%s\t%zu\t%zu\t%s\t%zu\t%zu\t%c\t%lf\t%zu\t%i\t%i\t%i\n",
// Output column ids:
seqname, // 1
blk_bounds[LO]->parent->name, // 2
Expand Down Expand Up @@ -274,7 +272,7 @@ SI_Bound * get_si_bound(
// |===| | | |===|
// |<------>| far | near |<-->|
// |<-->| near | far |<------>|
float _flank_area(long near, long far, float k){
double _flank_area(long near, long far, double k){

// If far <= 0, this means there is no interval to score in this direction
if(far > 0){
Expand All @@ -296,12 +294,12 @@ float _flank_area(long near, long far, float k){
return 0;
}

float calculate_score(long a1, long a2, Block * blk){
double calculate_score(long a1, long a2, Block * blk){

float weighted_length;
double weighted_length;
long b1, b2, actual_length;
float k = 0.001;
float score = 0;
double k = 0.001;
double score = 0;

if(blk == NULL)
return score;
Expand Down
8 changes: 4 additions & 4 deletions src/map.h
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#ifndef __MAP_H__
#define __MAP_H__

#include <stdint.h>

#include "global.h"
#include "block.h"
#include "synmap.h"
#include "contig.h"
#include "synmap.h"

#define ANCHORED 0
#define BOUND 1
Expand All @@ -30,8 +30,8 @@
*/
void find_search_intervals(Synmap * syn, FILE * intfile, bool pblock);

float calculate_score(long start, long stop, Block * blk);
double calculate_score(long start, long stop, Block * blk);

float calculate_target_score(long a1, long a2, Block * bounds[2]);
double calculate_target_score(long a1, long a2, Block * bounds[2]);

#endif
3 changes: 0 additions & 3 deletions src/synmap.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
#include "global.h"
#include "synmap.h"
#include "contiguous_set.h"


Synmap* init_Synmap()
{
Expand Down
2 changes: 2 additions & 0 deletions src/synmap.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

#include "global.h"
#include "genome.h"
#include "global.h"
#include "contiguous_set.h"

/**
* Allocate memory for a new Synmap.
Expand Down
8 changes: 2 additions & 6 deletions src/ui.c
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
#define _GNU_SOURCE
#include <getopt.h>

#include "global.h"
#include "ui.h"
#include "version.h"

#define MAX_POS 5
#define _GNU_SOURCE
#include <getopt.h>

/** contains all legal arguments from all subcommands */
Arguments create_Arguments()
Expand Down
4 changes: 4 additions & 0 deletions src/ui.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
#define __UI_U__

#include "global.h"
#include "version.h"

// maximum number of positional arguments
#define MAX_POS 5

/** Parsed command line arguments */
typedef struct Arguments {
Expand Down
2 changes: 1 addition & 1 deletion src/version.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#ifndef __VERSION_H__
#define __VERSION_H__

#define VERSION "v0.12.0"
#define VERSION "v0.12.1"

#endif

0 comments on commit 7ef9e31

Please sign in to comment.