Skip to content

Instantly share code, notes, and snippets.

@jvkersch
Last active January 16, 2019 14:53
Show Gist options
  • Select an option

  • Save jvkersch/c46423568e10818fd0012112d9e891f1 to your computer and use it in GitHub Desktop.

Select an option

Save jvkersch/c46423568e10818fd0012112d9e891f1 to your computer and use it in GitHub Desktop.
Version 1.2.10 of Velvet: diff between the tarball downloaded from EBI and the version on GitHub
diff --git a/Makefile b/Makefile
index 3e47adc..a4b46e2 100644
--- a/Makefile
+++ b/Makefile
@@ -3,8 +3,8 @@ CFLAGS = -Wall
DEBUG = -g
LIBS = -lm
OPT = -O3
-MAXKMERLENGTH=31
-CATEGORIES=2
+MAXKMERLENGTH?=31
+CATEGORIES?=2
DEF = -D MAXKMERLENGTH=$(MAXKMERLENGTH) -D CATEGORIES=$(CATEGORIES)
PDFLATEX_VERSION := $(shell pdflatex --version 2> /dev/null)
diff --git a/src/correctedGraph.c b/src/correctedGraph.c
index bdbf016..6e295f0 100644
--- a/src/correctedGraph.c
+++ b/src/correctedGraph.c
@@ -2094,9 +2094,11 @@ static void cleanUpRedundancy()
if (isTerminal(slowMarker))
slowLength = finalLength;
else {
- slowLength =
- slowToFastMapping[getPassageMarkerFinish
- (slowMarker) - 1];
+ if(getPassageMarkerFinish(slowMarker) != 0)
+ slowLength = slowToFastMapping[getPassageMarkerFinish(slowMarker) - 1];
+ else
+ slowLength = slowToFastMapping[0];
+
if (slowLength < slowConstraint)
slowLength = slowConstraint;
}
diff --git a/src/graph.c b/src/graph.c
index 826979c..7dd857b 100644
--- a/src/graph.c
+++ b/src/graph.c
@@ -906,7 +906,7 @@ void appendDescriptors(Node * destination, Node * source)
twinDestination->length = newLength;
}
-static void catDescriptors(Descriptor * descr, Coordinate destinationLength, Descriptor * copy, Coordinate sourceLength)
+static void catDescriptors(Descriptor * descr, Coordinate destinationLength, Descriptor * copy, Coordinate sourceLength)
{
Coordinate index;
Nucleotide nucleotide;
@@ -917,7 +917,7 @@ static void catDescriptors(Descriptor * descr, Coordinate destinationLength, Des
}
}
-static void reverseCatDescriptors(Descriptor * descr, Coordinate destinationLength, Descriptor * copy, Coordinate sourceLength, Coordinate totalLength)
+static void reverseCatDescriptors(Descriptor * descr, Coordinate destinationLength, Descriptor * copy, Coordinate sourceLength, Coordinate totalLength)
{
Coordinate shift = totalLength - destinationLength - sourceLength;
Coordinate index;
@@ -2052,7 +2052,7 @@ Graph *importGraph(char *filename)
short short_var;
char c;
- if (file == NULL)
+ if (file == NULL)
exitErrorf(EXIT_FAILURE, true, "Could not open %s", filename);
velvetLog("Reading graph file %s\n", filename);
@@ -2204,9 +2204,9 @@ Graph *importGraph(char *filename)
velvetLog
("ERROR: reading in graph - only %d items read for line '%s'",
sCount, line);
-#ifdef DEBUG
+#ifdef DEBUG
abort();
-#endif
+#endif
exit(1);
}
newMarker =
@@ -2404,7 +2404,7 @@ Graph *readPreGraphFile(char *preGraphFilename, boolean * double_strand)
#endif
}
}
-
+
index++;
}
@@ -2506,7 +2506,7 @@ Graph *readConnectedGraphFile(char *connectedGraphFilename, boolean * double_str
twin = node->twinNode;
twin->length = node->length;
twin->descriptor =
- callocOrExit(arrayLength, Descriptor);
+ callocOrExit(arrayLength, Descriptor);
index = 0;
while ((c = getc(file)) != '\n') {
@@ -3145,9 +3145,13 @@ ShortReadMarker *extractFrontOfNodeReads(Node * node,
}
free(sourceArray);
- graph->nodeReads[sourceID] = newArray;
graph->nodeReadCounts[sourceID] = newLength;
+ if(newLength > 0)
+ graph->nodeReads[sourceID] = newArray;
+ else
+ graph->nodeReads[sourceID] = NULL;
+
*length = mergeLength;
return mergeArray;
}
@@ -3275,9 +3279,13 @@ ShortReadMarker *extractBackOfNodeReads(Node * node, Coordinate breakpoint,
}
free(sourceArray);
- graph->nodeReads[sourceID] = newArray;
graph->nodeReadCounts[sourceID] = newLength;
+ if(newLength > 0)
+ graph->nodeReads[sourceID] = newArray;
+ else
+ graph->nodeReads[sourceID] = NULL;
+
*length = mergeLength;
return mergeArray;
}
@@ -3321,8 +3329,13 @@ void spreadReadIDs(ShortReadMarker * reads, IDnum readCount, Node * node,
sourceIndex++;
}
- graph->nodeReads[targetID] = mergeArray;
graph->nodeReadCounts[targetID] = sourceLength;
+
+ if(sourceLength > 0)
+ graph->nodeReads[targetID] = mergeArray;
+ else
+ graph->nodeReads[targetID] = NULL;
+
return;
}
@@ -3402,8 +3415,12 @@ void spreadReadIDs(ShortReadMarker * reads, IDnum readCount, Node * node,
}
free(targetArray);
- graph->nodeReads[targetID] = mergeArray;
graph->nodeReadCounts[targetID] = mergeLength;
+
+ if(mergeLength > 0)
+ graph->nodeReads[targetID] = mergeArray;
+ else
+ graph->nodeReads[targetID] = NULL;
}
static inline Coordinate min(Coordinate A, Coordinate B)
@@ -3437,8 +3454,13 @@ void injectShortReads(ShortReadMarker * sourceArray, IDnum sourceLength,
if (targetLength == 0) {
free(targetArray);
- graph->nodeReads[targetID] = sourceArray;
graph->nodeReadCounts[targetID] = sourceLength;
+
+ if(sourceLength > 0)
+ graph->nodeReads[targetID] = sourceArray;
+ else
+ graph->nodeReads[targetID] = NULL;
+
return;
}
@@ -3548,9 +3570,13 @@ void injectShortReads(ShortReadMarker * sourceArray, IDnum sourceLength,
}
free(targetArray);
- graph->nodeReads[targetID] = mergeArray;
graph->nodeReadCounts[targetID] = mergeLength;
+ if(mergeLength > 0)
+ graph->nodeReads[targetID] = mergeArray;
+ else
+ graph->nodeReads[targetID] = NULL;
+
free(sourceArray);
}
@@ -3693,12 +3719,20 @@ void foldSymmetricalNodeReads(Node * node, Graph * graph)
}
free(targetArray);
- graph->nodeReads[targetID] = mergeArray;
graph->nodeReadCounts[targetID] = mergeLength;
+ if(mergeLength > 0)
+ graph->nodeReads[targetID] = mergeArray;
+ else
+ graph->nodeReads[targetID] = NULL;
+
free(sourceArray);
- graph->nodeReads[sourceID] = mergeArray2;
graph->nodeReadCounts[sourceID] = mergeLength;
+
+ if(mergeLength > 0)
+ graph->nodeReads[sourceID] = mergeArray2;
+ else
+ graph->nodeReads[sourceID] = NULL;
}
void shareReadStarts(Node * target, Node * source, Graph * graph)
@@ -3973,7 +4007,7 @@ void reallocateNodeDescriptor(Node * node, Coordinate length) {
nucleotide = getNucleotideInDescriptor(twin->descriptor, index);
writeNucleotideInDescriptor(nucleotide, array, index + shift);
}
-
+
free(twin->descriptor);
twin->descriptor = array;
}
diff --git a/src/scaffold.h b/src/scaffold.h
index bd61e28..f14e1c8 100644
--- a/src/scaffold.h
+++ b/src/scaffold.h
@@ -18,7 +18,7 @@ Copyright 2007, 2008 Daniel Zerbino (zerbino@ebi.ac.uk)
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#ifndef _SSCAFFOLD_H_
+#ifndef _SCAFFOLD_H_
#define _SCAFFOLD_H_
typedef struct connection_st Connection;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment