summarylogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.SRCINFO30
-rw-r--r--0001-corrected-Makefile-in-order-to-work-with-ViennaRNA-2.patch46
-rw-r--r--0002-remove-redefinition-of-INF-energies.patch81
-rw-r--r--0003-remove-unnecessary-and-deprecated-wrong-declarations.patch104
-rw-r--r--0004-make-kinwalker-comply-to-stricter-g.patch75
-rw-r--r--0005-remove-all-the-remaining-unnecessary-stuff.patch86
-rw-r--r--0006-fix-bug-for-co-transcriptional-folding-with-dangles-.patch42
-rw-r--r--0007-Do-not-fail-on-using-B-heuristic.patch329
-rw-r--r--0008-Removed-findpath.h-and-cleaned-up-remnants-of-false-.patch91
-rw-r--r--PKGBUILD59
10 files changed, 943 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO
new file mode 100644
index 000000000000..5ad69240adfb
--- /dev/null
+++ b/.SRCINFO
@@ -0,0 +1,30 @@
+pkgbase = kinwalker
+ pkgdesc = Compute cotranscriptional folding trajectories of RNAs
+ pkgver = 2.0
+ pkgrel = 1
+ url = http://www.bioinf.uni-leipzig.de/Software/Kinwalker/
+ arch = x86_64
+ arch = i686
+ license = Custom
+ depends = viennarna
+ source = http://www.bioinf.uni-leipzig.de/Software/Kinwalker/kinwalker.tar.gz
+ source = 0001-corrected-Makefile-in-order-to-work-with-ViennaRNA-2.patch
+ source = 0002-remove-redefinition-of-INF-energies.patch
+ source = 0003-remove-unnecessary-and-deprecated-wrong-declarations.patch
+ source = 0004-make-kinwalker-comply-to-stricter-g.patch
+ source = 0005-remove-all-the-remaining-unnecessary-stuff.patch
+ source = 0006-fix-bug-for-co-transcriptional-folding-with-dangles-.patch
+ source = 0007-Do-not-fail-on-using-B-heuristic.patch
+ source = 0008-Removed-findpath.h-and-cleaned-up-remnants-of-false-.patch
+ md5sums = 7723b173de294ef96b86d94f4f6cbeb9
+ md5sums = 2f92e91e58badff10d4fe697bca3abf0
+ md5sums = dba93e6fce292b6e9b9e7e0b667e6e6c
+ md5sums = 9ae628a2c89ac2654813b87a54605966
+ md5sums = 73489a3b0f68a5bbfd158b5ea06f422a
+ md5sums = 39bd8b46857edd134671c30260dcc93c
+ md5sums = a6bab92d415092d4e47e08564ae9c48e
+ md5sums = 285cfd82e05b9e0c69d0196089d82e3b
+ md5sums = 4afda6634ea89393975b953ca7788497
+
+pkgname = kinwalker
+
diff --git a/0001-corrected-Makefile-in-order-to-work-with-ViennaRNA-2.patch b/0001-corrected-Makefile-in-order-to-work-with-ViennaRNA-2.patch
new file mode 100644
index 000000000000..75912ca1d530
--- /dev/null
+++ b/0001-corrected-Makefile-in-order-to-work-with-ViennaRNA-2.patch
@@ -0,0 +1,46 @@
+From f5efd6d09fc7441ee9db14c5fdbe7cb901bbb6f3 Mon Sep 17 00:00:00 2001
+From: Ronny Lorenz <ronny@tbi.univie.ac.at>
+Date: Tue, 28 Jan 2014 16:31:16 +0100
+Subject: [PATCH 1/8] corrected Makefile in order to work with ViennaRNA 2.x
+
+---
+ Makefile | 12 +++++++-----
+ 1 file changed, 7 insertions(+), 5 deletions(-)
+
+diff --git a/Makefile b/Makefile
+index b2276b2..2640e58 100644
+--- a/Makefile
++++ b/Makefile
+@@ -10,14 +10,16 @@ CC = gcc
+ CXX = g++
+ LL = g++
+ DEFS =
+-VRNADIR = ${HOME}/C/ViennaRNA
+-INCL = -I. -I$(VRNADIR)/H
++VRNA_INC = $(shell pkg-config --cflags RNAlib2)
++VRNA_LIB = $(shell pkg-config --libs RNAlib2)
++LDFLAGS =
++INCL = -I. $(VRNA_INC)
+ WARN = -Wall -ansi -pedantic
+ OPTI = -O3
+ #OPTI = -O3 -p -g3
+ CFLAGS = $(WARN) $(OPTI) $(DEFS) $(INCL)
+-LIBS = -L$(VRNADIR)/lib -lRNA -lm -lstdc++
+-CSRC = options.c findpath.c
++LIBS = ${VRNA_LIB} -lm -lstdc++
++CSRC = options.c
+ COBJ = $(foreach file, $(CSRC:.c=.o), $(file))
+ CXXSRC = Energy.cpp Node.cpp Util.cpp MorganHiggs.cpp main.cpp
+ CXXOBJ = $(foreach file, $(CXXSRC:.cpp=.o), $(file))
+@@ -35,7 +37,7 @@ $(CXXOBJ): %.o: %.cpp
+ $(COBJ): %.o: %.c
+ $(CC) -c $(CFLAGS) $< -o $@
+ $(EXE): $(COBJ) $(CXXOBJ)
+- $(LL) $(CFLAGS) -o $(EXE) $(COBJ) $(CXXOBJ) $(LIBS)
++ $(LL) $(LDFLAGS) $(CFLAGS) -o $(EXE) $(COBJ) $(CXXOBJ) $(LIBS)
+ clean:
+ rm -f $(COBJ) $(CXXOBJ) $(EXE)
+ backup: clean
+--
+2.5.2
+
diff --git a/0002-remove-redefinition-of-INF-energies.patch b/0002-remove-redefinition-of-INF-energies.patch
new file mode 100644
index 000000000000..08c43cd95efe
--- /dev/null
+++ b/0002-remove-redefinition-of-INF-energies.patch
@@ -0,0 +1,81 @@
+From 9f85164b96b049426705a52b72d1feaedc808b21 Mon Sep 17 00:00:00 2001
+From: Ronny Lorenz <ronny@tbi.univie.ac.at>
+Date: Tue, 28 Jan 2014 16:39:49 +0100
+Subject: [PATCH 2/8] remove redefinition of INF energies
+
+---
+ Barrier.cpp | 5 ++++-
+ MorganHiggs.cpp | 6 +++++-
+ Node.cpp | 4 ++--
+ 3 files changed, 11 insertions(+), 4 deletions(-)
+
+diff --git a/Barrier.cpp b/Barrier.cpp
+index db399e6..6fd2c02 100644
+--- a/Barrier.cpp
++++ b/Barrier.cpp
+@@ -12,7 +12,10 @@
+ #include "Neighbor.h"
+ #include "Utils.h"
+ #include "options.h"
+-#define INF 1000000
++
++extern "C" {
++#include "energy_const.h" /* defines INF */
++}
+
+
+ /**
+diff --git a/MorganHiggs.cpp b/MorganHiggs.cpp
+index d4c579f..083fc05 100644
+--- a/MorganHiggs.cpp
++++ b/MorganHiggs.cpp
+@@ -3,14 +3,18 @@
+ $Id: MorganHiggs.cpp,v 1.13 2007/10/21 21:01:35 Kinwalker Exp $
+ */
+
++#include <cstring>
+ #include "MorganHiggs.h"
+ #define BP_ADD_CONST 10000
+-#define INF 1000000
+ using std::cout;
+ using std::endl;
+
+ extern short * pair_table;
+
++extern "C" {
++#include "energy_const.h" /* defines INF */
++}
++
+ bool MHS_debug=false;
+ int min_stack_size=1;
+
+diff --git a/Node.cpp b/Node.cpp
+index 94ce681..3ddcb0f 100644
+--- a/Node.cpp
++++ b/Node.cpp
+@@ -2,12 +2,12 @@
+ Last changed Time-stamp: <2007-07-10 19:27:22 xtof>
+ $Id: Node.cpp,v 1.35 2007/11/03 16:45:58 Kinwalker Exp $
+ */
+-#include "Node.h"
+
+ #include <algorithm>
+ #include <iostream>
+ #include <iterator>
+ #include <utility>
++#include "Node.h"
+
+ #include "template_utils.c"
+
+@@ -16,7 +16,7 @@
+ #define EPSILON .00000000001
+
+ #define MIN_ENERGY_DIFF .01
+-#define INF 1000000
++
+ double BARRIER_TOO_HIGH=10000;//std::numeric_limits<int>::max();
+ // class variables
+ int Node::verbose;
+--
+2.5.2
+
diff --git a/0003-remove-unnecessary-and-deprecated-wrong-declarations.patch b/0003-remove-unnecessary-and-deprecated-wrong-declarations.patch
new file mode 100644
index 000000000000..dd95530cce9b
--- /dev/null
+++ b/0003-remove-unnecessary-and-deprecated-wrong-declarations.patch
@@ -0,0 +1,104 @@
+From fa8d5c6b78cebee3d2df987150375d415e46593a Mon Sep 17 00:00:00 2001
+From: Ronny Lorenz <ronny@tbi.univie.ac.at>
+Date: Tue, 28 Jan 2014 16:46:51 +0100
+Subject: [PATCH 3/8] remove unnecessary and deprecated/wrong declarations of
+ stuff from RNAlib
+
+---
+ Energy.cpp | 2 --
+ Node.h | 7 +------
+ Util.cpp | 4 ++++
+ findpath.h | 33 ++++++++++++++++++++++++---------
+ 4 files changed, 29 insertions(+), 17 deletions(-)
+
+diff --git a/Energy.cpp b/Energy.cpp
+index 6cb9455..67659de 100644
+--- a/Energy.cpp
++++ b/Energy.cpp
+@@ -13,8 +13,6 @@ extern "C" {
+ #include "fold_vars.h"
+ #include "utils.h"
+ #include "pair_mat.h"
+-extern int
+-energy_of_struct_pt (char *string, short * ptable, short *s, short *s1);
+ }
+ extern short * S;
+ extern short * S1;
+diff --git a/Node.h b/Node.h
+index b1d090c..3f99d23 100644
+--- a/Node.h
++++ b/Node.h
+@@ -33,12 +33,7 @@ extern "C" {
+ #include "fold.h"
+ #include "energy_const.h"
+ #include "utils.h"
+- extern float fold(const char* sequence, char* structure);
+- extern void export_fold_arrays(int **f5_p, int **c_p, int **fML_p,
+- int **fM1_p, int **indx_p, char **ptype_p);
+- extern char * backtrack_fold_from_pair(char* seq,int i,int j);
+- extern void free_arrays(void);
+- extern int fold_constrained;
++ #include "fold_vars.h"
+ }
+ #include "Energy.h"
+ #include "MorganHiggs.h"
+diff --git a/Util.cpp b/Util.cpp
+index 75cdec5..d0a9ecb 100644
+--- a/Util.cpp
++++ b/Util.cpp
+@@ -5,6 +5,10 @@ extern short *pair_table;
+ /*@exits@*/
+ //extern void nrerror(const char message[]);
+
++extern "C" {
++#include "utils.h"
++}
++
+ void Cout(std::string s){std::cout<<s;}
+
+ std::string Str(double x)
+diff --git a/findpath.h b/findpath.h
+index a0b3e4e..2e27237 100644
+--- a/findpath.h
++++ b/findpath.h
+@@ -1,13 +1,28 @@
+-#ifndef FIND_PATH_H
+-#define FIND_PATH_H
++/*
++* file borrowed from ViennaRNA Package 2.0.4
++* (this file may be removed completely since it is also present in the ViennaRNA includes
++*/
++#ifndef __VIENNA_RNA_PACKAGE_FIND_PATH_H__
++#define __VIENNA_RNA_PACKAGE_FIND_PATH_H__
+
+-typedef struct path {
+- double en;
+- char *s;
+-} path_t;
++#include "data_structures.h"
+
+-extern int find_saddle (char *seq, char *struc1, char *struc2, int max);
+-extern path_t* get_path(char *seq, char *s1, char* s2,
+- int maxkeep, int *num_entry);
++/**
++ * \file findpath.h
++ * \brief Compute direct refolding paths between two secondary structures
++ */
++
++int find_saddle(char *seq,
++ char *struc1,
++ char *struc2,
++ int max);
++
++
++path_t* get_path( char *seq,
++ char *s1,
++ char* s2,
++ int maxkeep);
++
++void free_path(path_t *path);
+
+ #endif
+--
+2.5.2
+
diff --git a/0004-make-kinwalker-comply-to-stricter-g.patch b/0004-make-kinwalker-comply-to-stricter-g.patch
new file mode 100644
index 000000000000..e73893a0d3ae
--- /dev/null
+++ b/0004-make-kinwalker-comply-to-stricter-g.patch
@@ -0,0 +1,75 @@
+From 561039364ab627c332e4debef3c3cc78a571e608 Mon Sep 17 00:00:00 2001
+From: Ronny Lorenz <ronny@tbi.univie.ac.at>
+Date: Tue, 28 Jan 2014 16:56:01 +0100
+Subject: [PATCH 4/8] make kinwalker comply to stricter g++
+
+---
+ Energy.cpp | 3 ++-
+ MorganHiggs.h | 4 ++--
+ Node.h | 1 +
+ Util.h | 3 +++
+ 4 files changed, 8 insertions(+), 3 deletions(-)
+
+diff --git a/Energy.cpp b/Energy.cpp
+index 67659de..ae72679 100644
+--- a/Energy.cpp
++++ b/Energy.cpp
+@@ -2,9 +2,10 @@
+ Last changed Time-stamp: <2006-10-13 22:34:37 xtof>
+ $Id: Energy.cpp,v 1.12 2007/11/03 16:45:58 Kinwalker Exp $
+ */
++#include <cstdlib>
+ #include <iostream>
+ #include <string>
+-
++#include <cstring>
+ #include "Energy.h"
+
+
+diff --git a/MorganHiggs.h b/MorganHiggs.h
+index 76a15f3..f069429 100644
+--- a/MorganHiggs.h
++++ b/MorganHiggs.h
+@@ -133,9 +133,9 @@ public:
+
+ void AddInside(std::pair<int,int> bp,char first,char second);
+
+- void AddOutside(int first,int second,char first,char second);
++ void AddOutside(int first,int second,char cfirst,char csecond);
+
+- void AddInside(int first,int second,char first,char second);
++ void AddInside(int first,int second,char cfirst,char csecond);
+
+
+ static bool IsGCPair(char first,char second);
+diff --git a/Node.h b/Node.h
+index 3f99d23..43b2a3f 100644
+--- a/Node.h
++++ b/Node.h
+@@ -25,6 +25,7 @@
+ #include <iomanip>
+ #include <limits>
+ #include <string>
++#include <cstring>
+ #include <vector>
+
+
+diff --git a/Util.h b/Util.h
+index 5511ea0..a60f7c4 100644
+--- a/Util.h
++++ b/Util.h
+@@ -1,8 +1,11 @@
+ #include <string>
++#include <cstring>
+ #include <vector>
+ #include <sstream>
+ #include <cstdarg>
+ #include <iostream>
++#include <cstdlib>
++#include <algorithm>
+
+ void Cout(std::string s);
+
+--
+2.5.2
+
diff --git a/0005-remove-all-the-remaining-unnecessary-stuff.patch b/0005-remove-all-the-remaining-unnecessary-stuff.patch
new file mode 100644
index 000000000000..a1f478b6b92b
--- /dev/null
+++ b/0005-remove-all-the-remaining-unnecessary-stuff.patch
@@ -0,0 +1,86 @@
+From e54e50a1f35b5636d92baef536d78fd844267ca2 Mon Sep 17 00:00:00 2001
+From: Ronny Lorenz <ronny@tbi.univie.ac.at>
+Date: Tue, 28 Jan 2014 16:57:04 +0100
+Subject: [PATCH 5/8] remove all the remaining unnecessary stuff
+
+---
+ Node.cpp | 7 ++++---
+ Util.cpp | 27 +--------------------------
+ 2 files changed, 5 insertions(+), 29 deletions(-)
+
+diff --git a/Node.cpp b/Node.cpp
+index 3ddcb0f..3f33123 100644
+--- a/Node.cpp
++++ b/Node.cpp
+@@ -291,12 +291,13 @@ void Node::CalculateFoldingPath(Node* extremum,std::string integrated_structure)
+ int maxE_idx = -1;
+ int t = Node::transcribed;
+ std::vector<std::pair<double,std::string> > v;
+-
++ /* length of path always is the base pair distance + 1 */
++ p_len = bp_distance(const_cast<char*>(sequence.substr(0,t).c_str()),
++ const_cast<char*>(Node::front_structure.c_str())) + 1;
+ p = get_path(const_cast<char*>(sequence.substr(0,t).c_str()),
+ const_cast<char*>(Node::front_structure.c_str()),
+ const_cast<char*>(integrated_structure.substr(0,t).c_str()),
+- Node::OptS->maxkeep,
+- &p_len);
++ Node::OptS->maxkeep);
+ bool barrier_exceeded=false;
+ for (int i=0; i<p_len; i++) {
+ // memorize idx of structure with highest energy seen so far
+diff --git a/Util.cpp b/Util.cpp
+index d0a9ecb..592a303 100644
+--- a/Util.cpp
++++ b/Util.cpp
+@@ -57,16 +57,6 @@ std::string PrintPairTable(){
+ return s;
+ }
+
+-void
+-PrettyPrint(char *fmt, ...)
+-{
+- va_list args;
+-
+- va_start(args, fmt);
+- vfprintf(stdout, fmt, args);
+- fflush(stdout);
+- va_end(args);
+-}
+
+ std::string PrintBasePair(std::pair<int,int> bp){
+ return "("+Str(bp.first)+","+Str(bp.second)+")";
+@@ -283,21 +273,6 @@ ConformationToStacks(std::vector<std::vector<std::pair<int,int> > > & stacks, st
+ }
+ }
+
+-void *MG_space(unsigned size) {
+- void *pointer;
+-
+- if ( (pointer = (void *) calloc(1, (size_t) size)) == NULL) {
+-#ifdef EINVAL
+- if (errno==EINVAL) {
+- fprintf(stderr,"SPACE: requested size: %d\n", size);
+- printf("SPACE allocation failure -> EINVAL");
+- }
+- if (errno==ENOMEM)
+-#endif
+- printf("SPACE allocation failure -> no memory");
+- }
+- return pointer;
+-}
+
+ #ifdef WITH_DMALLOC
+ #define MG_space(S) calloc(1,(S))
+@@ -314,7 +289,7 @@ void *MG_space(unsigned size) {
+ // short *table;
+
+ length = (short) strlen(structure);
+- stack = (short *) MG_space(sizeof(short)*(length+1));
++ stack = (short *) space(sizeof(short)*(length+1));
+ //table = (short *) space(sizeof(short)*(length+2));
+ pair_table[0] = length;
+
+--
+2.5.2
+
diff --git a/0006-fix-bug-for-co-transcriptional-folding-with-dangles-.patch b/0006-fix-bug-for-co-transcriptional-folding-with-dangles-.patch
new file mode 100644
index 000000000000..b386599ea2e3
--- /dev/null
+++ b/0006-fix-bug-for-co-transcriptional-folding-with-dangles-.patch
@@ -0,0 +1,42 @@
+From 02ebdb357913d9c07021e156768e504ef5e27950 Mon Sep 17 00:00:00 2001
+From: Ronny Lorenz <ronny@tbi.univie.ac.at>
+Date: Tue, 28 Jan 2014 17:00:00 +0100
+Subject: [PATCH 6/8] fix bug for co-transcriptional folding with dangles != 0
+
+---
+ Node.cpp | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/Node.cpp b/Node.cpp
+index 3f33123..bdc092c 100644
+--- a/Node.cpp
++++ b/Node.cpp
+@@ -581,6 +581,7 @@ Node::FindLocalExtrema()
+ {
+ int *f5, *c, *fML, *fM1, *indx; char *ptype;
+ export_fold_arrays(&f5,&c,&fML,&fM1,&indx,&ptype);
++ if(verbose>=2) Cout("#extrema: "+Str((int)extrema.size())+"\n");
+ int n = matrix_size;
+ for (int i=1; i<=n-TURN-1; i++) {
+ for (int j=i+TURN+1; j<=n; j++) {
+@@ -598,8 +599,8 @@ Node::FindLocalExtrema()
+ // (1,n) is in general not a pair. You can't include it in the list
+ //Node node2=Node(1,n,energy);
+ extrema.push_back(new Node(1,n,energy));//& node2);
+- sort(extrema.begin(), extrema.end(), Node::LessThan);
+ if(verbose>=3) Cout("#extrema: "+Str((int)Node::extrema.size())+"\n");
++ stable_sort(extrema.begin(), extrema.end(), Node::LessThan);
+ }
+
+
+@@ -941,6 +942,7 @@ void Node::Transcribe(){
+ pair_table[0]=Node::transcribed;
+ Node::front_structure+=".";
+ MakePairTableFromFrontStructure();
++ Node::front_energy=Evaluate(Node::front_structure);
+ }
+
+ bool Node::IsTranscribed(){
+--
+2.5.2
+
diff --git a/0007-Do-not-fail-on-using-B-heuristic.patch b/0007-Do-not-fail-on-using-B-heuristic.patch
new file mode 100644
index 000000000000..a6e35db8a4f6
--- /dev/null
+++ b/0007-Do-not-fail-on-using-B-heuristic.patch
@@ -0,0 +1,329 @@
+From 5757202e85a95f7931dab6a0caaadd18aa4fa1c1 Mon Sep 17 00:00:00 2001
+From: Ronny Lorenz <ronny@tbi.univie.ac.at>
+Date: Fri, 19 Jun 2015 19:17:46 +0200
+Subject: [PATCH 7/8] Do not fail on using 'B' heuristic!
+
+The 'B' heuristic (a.k.a. findpath) NEVER actually worked but caused the
+program to terminate with segfaults. This has finally been fixed now!
+---
+ Node.cpp | 132 ++++++++++++++++++++++++++++++++-------------------------------
+ 1 file changed, 67 insertions(+), 65 deletions(-)
+
+diff --git a/Node.cpp b/Node.cpp
+index bdc092c..bc53207 100644
+--- a/Node.cpp
++++ b/Node.cpp
+@@ -182,10 +182,10 @@ void Node::GetMorganHiggsPath(std::string target){
+ int t=Node::transcribed;
+
+ Node::path = MorganHiggsEnergy(Node::sequence.substr(0,t),
+- Node::front_structure.substr(0,t),
+- target.substr(0,t),
+- Node::front_energy+Node::energy_barrier,
+- Node::lookahead,Node::grouping);//,Node::interrupt_trajectory);
++ Node::front_structure.substr(0,t),
++ target.substr(0,t),
++ Node::front_energy+Node::energy_barrier,
++ Node::lookahead,Node::grouping);//,Node::interrupt_trajectory);
+ }
+
+ void Node::GetMorganHiggsStudlaPath(std::string target){
+@@ -193,10 +193,10 @@ void Node::GetMorganHiggsStudlaPath(std::string target){
+ int t=Node::transcribed;
+
+ Node::path = MorganHiggsStudlaEnergy(Node::sequence.substr(0,t),
+- Node::front_structure.substr(0,t),
+- target.substr(0,t),
+- Node::front_energy+Node::energy_barrier,
+- Node::lookahead,Node::grouping);//,Node::interrupt_trajectory);
++ Node::front_structure.substr(0,t),
++ target.substr(0,t),
++ Node::front_energy+Node::energy_barrier,
++ Node::lookahead,Node::grouping);//,Node::interrupt_trajectory);
+ }
+
+ /**
+@@ -254,7 +254,7 @@ void Node::GetSaddleFromPath(std::pair<double,std::string> & saddle,std::pair<do
+ //if we have increased to the size of the path, it means there is no structure that is lower, in that case retrun the front structure,
+ //as this trajectory is worthless, even when the energy barrier is higher
+ if(last_idx_of_partial_path>path_size){
+- final_structure=std::make_pair(Node::front_energy,Node::front_structure);
++ final_structure=std::make_pair(Node::front_energy,Node::front_structure);
+ return;
+ }
+ }
+@@ -295,25 +295,27 @@ void Node::CalculateFoldingPath(Node* extremum,std::string integrated_structure)
+ p_len = bp_distance(const_cast<char*>(sequence.substr(0,t).c_str()),
+ const_cast<char*>(Node::front_structure.c_str())) + 1;
+ p = get_path(const_cast<char*>(sequence.substr(0,t).c_str()),
+- const_cast<char*>(Node::front_structure.c_str()),
+- const_cast<char*>(integrated_structure.substr(0,t).c_str()),
+- Node::OptS->maxkeep);
++ const_cast<char*>(Node::front_structure.c_str()),
++ const_cast<char*>(integrated_structure.substr(0,t).c_str()),
++ Node::OptS->maxkeep);
+ bool barrier_exceeded=false;
+- for (int i=0; i<p_len; i++) {
+- // memorize idx of structure with highest energy seen so far
+- if (!barrier_exceeded && p[i].en > maxE) {
+- maxE = p[i].en;
+- maxE_idx = i+1;
+- barrier_exceeded=true;
+- }
+- v.push_back(std::make_pair(p[i].en,p[i].s));
++ maxE_idx = 0;
++ for (int i=0; p[i].s != NULL; i++) {
++ // memorize idx of structure with highest energy seen so far
++ if (!barrier_exceeded && p[i].en > maxE) {
++ maxE = p[i].en;
++ maxE_idx = i+1;
++ //barrier_exceeded=true;
++ }
++ v.push_back(std::make_pair(p[i].en, p[i].s));
+ }
+ // add dummy entry with idx of structure with highest energy
+ v.push_back(std::make_pair(maxE_idx, ""));
+ /* clean up space of path */
+- for (int i=0; i<p_len; i++) free(p[i].s);
++ for (int i=0; p[i].s != NULL; i++) free(p[i].s);
+ free(p);
+ Node::path = v;
++
+ }
+
+ if(verbose>=3) {
+@@ -436,6 +438,7 @@ Node::FindExtremum(){
+ //only if everything is transcribed and we are moving towards the mfE
+ //done by the function CalculateFoldingPath
+ skip=false;
++
+ if(!Node::interrupt_trajectory){
+ if(node_substructure==Node::front_structure || Evaluate(node_substructure)>Node::front_energy) skip=true;
+ }
+@@ -452,17 +455,18 @@ Node::FindExtremum(){
+ barrier=barrier2;
+ combined_structure=final_structure.second;
+ if(debug) Cout("Have valid front extension with\n"+combined_structure+" "+Str(barrier));
+- }
++ }
+ }
+ }
+ if(debug) Cout("Current combined structure and barrier\n"+combined_structure+" "+Str(barrier));
+ if(verbose>=3) Cout("Actually obtained combination:\n"+combined_structure+"\n");
+ extension_cost.push_back(barrier);
++
+
+ if(verbose>=2) {
+ std::cout<<"Node "+Print(extrema[i])+" has extension cost "+Str(extension_cost.back())+" ("+Str(Node::energy_barrier)+" "+Str(Node::transcribed)+")\n";
+ }
+- if ( barrier <=Node::energy_barrier ) {
++ if ( barrier <= Node::energy_barrier ) {
+ //1.First structure if that is suitable.
+ //2.Otherwise seconds structure, if suitable, or we won't get here
+ extrema[i]->AddToFront(combined_structure,barrier);
+@@ -488,69 +492,68 @@ static int front_count=1;
+ void
+ Node::AddToFront(std::string new_front_structure,double barrier){
+ this->Reeligify(Node::front_structure,new_front_structure);
+-
+ double new_front_energy =Evaluate(new_front_structure);
+ if ( verbose >= 1 ) {
+- std::cout<<"Add Node ("+Print(this)+" "+Str(extension_cost.back())+" ("+Str(Node::energy_barrier)+" "+Str(Node::transcribed)+")\n";
++ std::cout<<"Add Node ("+Print(this)+" "+Str(extension_cost.back())+" ("+Str(Node::energy_barrier)+" "+Str(Node::transcribed)+")\n";
+ std::cout<<"src:"+Node::front_structure+" "+Str(Node::front_energy)+"\n";
+ std::cout<<"tgt:"+new_front_structure+" "+Str(new_front_energy)+"\n";
+ }
+
+ //add the extremum to the front
+- for (int i=this->i; i<=this->j; i++) {
+- for (int j=i; j<=this->j; j++) front[i][j] = true;
++ for (int i=this->i; i<=this->j; i++) {
++ for (int j=i; j<=this->j; j++) front[i][j] = true;
+ }
+ front_extrema.push_back(this);
+ Node::front_structure=new_front_structure;
+ Node::front_energy=new_front_energy;
+
+ if(barrier>0.0) Node::IncreaseTime(TimePassedFolding(barrier));
+- std::string trajectory_entry=std::string();
++ std::string trajectory_entry=std::string();
+ trajectory_entry+=Node::front_structure+" ";
+- trajectory_entry+=Str(Node::front_energy)+" ";
++ trajectory_entry+=Str(Node::front_energy)+" ";
+ trajectory_entry+=Str(Node::time)+" ";
+ trajectory_entry+=Str(barrier)+" ";
+ trajectory_entry+=Str(Node::energy_barrier)+" ";
+ trajectory_entry+=Str(Node::transcribed)+" ";
+- trajectory.push_back(trajectory_entry);
++ trajectory.push_back(trajectory_entry);
+
+ //and remove it and the extrema it dominates from the extrema vector
+- int count=0;
++ int count=0;
+ for(size_t i=0;i<extrema.size();i++){
+ if(!extrema[i]->is_included && extrema[i]->i>=this->i && extrema[i]->j<=this->j){
+ if(extrema[i]->IsMfE()) continue;
+ extrema[i]->SetIncluded(true);
+ extrema[i]->SetIneligible();
+- count++;
+- }
+- }
+-
++ count++;
++ }
++ }
++
+ //print new front
+ if ( verbose >= 1 ) {
+ std::cout<<"Path to new front:\n";
+ std::cout<<FoldingPathToString(this->path)<<std::endl;
+- Cout("New Front\n");
++ Cout("New Front\n");
+ std::cout<<front_structure+" "+Str(front_energy)<<std::endl;
+- }
++ }
+
+- if ( verbose >= 5 ) Cout(Node::PrintFront()+"\n");
++ if ( verbose >= 5 ) Cout(Node::PrintFront()+"\n");
+ //make all extrema eligible again.
+ if(Node::print_front_trajectory) {
+- std::vector<std::pair<int,int> > ext= std::vector<std::pair<int,int> >();
++ std::vector<std::pair<int,int> > ext= std::vector<std::pair<int,int> >();
+ for(size_t k=0;k<front_extrema.size();k++)ext.push_back(std::pair<int,int> (front_extrema[k]->i,front_extrema[k]->j));
+- Node::front_trajectory_ps+=PSFrontPlot(Node::sequence,ext);
++ Node::front_trajectory_ps+=PSFrontPlot(Node::sequence,ext);
+
+- // /*
++ // /*
+ Node::front_trajectory_ps=PSFrontPlot(Node::sequence,ext);
+ Node::front_trajectory_ps+="end \n";
+- std::string filename="front_trajectory"+Str(front_count)+".ps";
++ std::string filename="front_trajectory"+Str(front_count)+".ps";
+ std::ofstream outfile(filename.c_str());
+ outfile << Node::front_trajectory_ps;
+ outfile.close();
+- front_count++;
+- //*/
++ front_count++;
++ //*/
+
+- }
++ }
+ }
+
+
+@@ -574,7 +577,7 @@ Node::ExtendFront()
+
+ extern "C" {
+ void export_fold_arrays(int **f5_p, int **c_p, int **fML_p, int **fM1_p,
+- int **indx_p, char **ptype_p);
++ int **indx_p, char **ptype_p);
+ }
+ void
+ Node::FindLocalExtrema()
+@@ -588,8 +591,8 @@ Node::FindLocalExtrema()
+ double val = c[indx[j]+i];
+ //i and j pair AND no lonely pair
+ if(val < INF) {
+- //Node node=Node(i, j,val);
+- extrema.push_back(new Node(i, j,val));
++ //Node node=Node(i, j,val);
++ extrema.push_back(new Node(i, j,val));
+ if(verbose>=2) Cout(Print(extrema.back())+" "+Str(val)+"\n");
+ }
+ }
+@@ -807,11 +810,11 @@ void Node::BacktrackFront(std::pair<double,std::string> & ret,std::string node_s
+ //do nothing if the base pair is already part of basepairs
+ if(find(basepairs.begin(),basepairs.end(),bp_node[i])!=basepairs.end()) continue;
+ if(!Conflict(basepairs,bp_node[i])) {
+- //if (debug) {
++ //if (debug) {
+ if(debug_pt) Cout("added bp "+PrintBasePair(bp_node[i])+"\n");//}
+- basepairs.push_back(bp_node[i]);
++ basepairs.push_back(bp_node[i]);
+ int first=bp_node[i].first;
+- int second=bp_node[i].second;
++ int second=bp_node[i].second;
+ pair_table[first]=second;
+ pair_table[second]=first;
+ //manually change front_structure to circumvent a call to BasePairListToStructure1
+@@ -846,23 +849,23 @@ void Node::BacktrackFront(std::pair<double,std::string> & ret,std::string node_s
+ if(ConformationHasPair(basepairs,stack[j])) stack.erase(stack.begin()+j);
+ }
+
+- std::vector<std::pair<double,std::string> > front_resolutions= std::vector<std::pair<double,std::string> >();
++ std::vector<std::pair<double,std::string> > front_resolutions= std::vector<std::pair<double,std::string> >();
+ //std::vector<std::pair<double,std::vector<std::pair<int,int> > > > front_resolutions= std::vector<std::pair<double,std::vector<std::pair<int,int> > > >();
+
+ //front_resolutions.push_back(make_pair(front_energy,basepairs));
+ front_resolutions.push_back(make_pair(front_energy,front_structure));//basepairs));
+
+ //ensure that the base pair in front at first_idx_stack does not come from the node that stack is constructued from.
+- std::string resolved_structure=front_structure;
++ std::string resolved_structure=front_structure;
+ for(size_t j=0;j<stack.size();j++){
+- //last_insertion=j;
+- //double resolution_energy=
++ //last_insertion=j;
++ //double resolution_energy=
+ ConstructFrontResolution(resolved_structure,new_basepairs,stack[j]);
+ front_resolutions.push_back(make_pair(FastEvaluate(),resolved_structure));
+- //front_resolutions.push_back(make_pair(resolution_energy,BasePairListToStructure1(Node::transcribed,new_basepairs)));
+- }
++ //front_resolutions.push_back(make_pair(resolution_energy,BasePairListToStructure1(Node::transcribed,new_basepairs)));
++ }
+ //revert changes in pair_table: remove stack and add those elts of basepairs back that were removed because they conflicted with elements in stack
+- MakePairTable(const_cast<char*>(front_structure.substr(0,Node::transcribed).c_str()));
++ MakePairTable(const_cast<char*>(front_structure.substr(0,Node::transcribed).c_str()));
+ if(debug_pt) std::cout<<"Pairtable after reverting changes of outside in "+PrintPairTable();
+ //add stack back to front as much as possible
+ new_basepairs=basepairs;
+@@ -876,15 +879,15 @@ void Node::BacktrackFront(std::pair<double,std::string> & ret,std::string node_s
+ //now accept the best solution in front_resolutions and update structure, energy and bp
+ front_energy=INF;
+ front_structure=std::string(Node::transcribed,'.');
+- for(std::vector<std::pair<double,std::string> >::iterator it=front_resolutions.begin();it!=front_resolutions.end();it++){
++ for(std::vector<std::pair<double,std::string> >::iterator it=front_resolutions.begin();it!=front_resolutions.end();it++){
+ if(it->first<front_energy){
+ front_energy=it->first;
+- front_structure=it->second;
+- }
++ front_structure=it->second;
++ }
+ }
+ basepairs=MakeBasePairList1(front_structure);
+ //sync pair_table with latest front unless this was the last iteration or the latest front is already in pair_table
+- if(i<bp_node_conflict_stacks.size()-1){
++ if(i<bp_node_conflict_stacks.size()-1){
+ MakePairTable(const_cast<char*>(front_structure.substr(0,Node::transcribed).c_str()));
+ if(debug_pt) std::cout<<"Pairtable after syncing with front resolution "+PrintPairTable();
+ if(debug_pt) std::cout<<"Basepairs "+PrintBasePairList(basepairs);
+@@ -905,7 +908,7 @@ std::string Node::BacktrackNode(Node* n){
+ }
+ else {
+ char *s = backtrack_fold_from_pair(const_cast<char*>(Node::sequence.c_str()),
+- n->i, n->j);
++ n->i, n->j);
+ std::string ss(s);
+ free(s);
+ return (ss.substr(0,Node::transcribed));
+@@ -970,7 +973,7 @@ double Node::MinimalExtensionCost(){
+ void Node::RaiseEnergyBarrier(){
+ Node::energy_barrier += 1.0;
+ double minimial_extension_cost=MinimalExtensionCost();
+- if(Node::energy_barrier<minimial_extension_cost && minimial_extension_cost>=0.0) Node::energy_barrier = ceil(minimial_extension_cost);
++ if(Node::energy_barrier < minimial_extension_cost && minimial_extension_cost>=0.0) Node::energy_barrier = ceil(minimial_extension_cost);
+ Node * n;
+ int count=0;
+ for(size_t i=0;i<extrema.size();i++){
+@@ -1111,7 +1114,6 @@ void Node::Reeligify(std::string old_structure,std::string new_structure){
+ count++;
+ }
+ }
+- //Cout("Reeligified "+Str(count)+" extrema after adding "+Node::Print(this)+"\n");
+ }
+
+ void Node::SetIneligible(){
+--
+2.5.2
+
diff --git a/0008-Removed-findpath.h-and-cleaned-up-remnants-of-false-.patch b/0008-Removed-findpath.h-and-cleaned-up-remnants-of-false-.patch
new file mode 100644
index 000000000000..7139c931a318
--- /dev/null
+++ b/0008-Removed-findpath.h-and-cleaned-up-remnants-of-false-.patch
@@ -0,0 +1,91 @@
+From 9b30c38b2abfc7b6db04290aef96cee9a4c40aeb Mon Sep 17 00:00:00 2001
+From: Ronny Lorenz <ronny@tbi.univie.ac.at>
+Date: Fri, 19 Jun 2015 19:37:25 +0200
+Subject: [PATCH 8/8] Removed findpath.h and cleaned up remnants of false usage
+ of get_path()
+
+---
+ Node.cpp | 14 ++++++--------
+ findpath.h | 28 ----------------------------
+ 2 files changed, 6 insertions(+), 36 deletions(-)
+ delete mode 100644 findpath.h
+
+diff --git a/Node.cpp b/Node.cpp
+index bc53207..36d122d 100644
+--- a/Node.cpp
++++ b/Node.cpp
+@@ -11,6 +11,10 @@
+
+ #include "template_utils.c"
+
++extern "C" {
++#include "findpath.h"
++}
++
+ #define MS_PER_TIME_UNIT .0001
+ #define TIME_VS_DELTAG_DY_DX (8.0/11.0)
+ #define EPSILON .00000000001
+@@ -288,24 +292,18 @@ void Node::CalculateFoldingPath(Node* extremum,std::string integrated_structure)
+ path_t *p;
+ int p_len = 0;
+ double maxE = -INF;//std::numeric_limits<double>::max();
+- int maxE_idx = -1;
++ int maxE_idx = 0;
+ int t = Node::transcribed;
+ std::vector<std::pair<double,std::string> > v;
+- /* length of path always is the base pair distance + 1 */
+- p_len = bp_distance(const_cast<char*>(sequence.substr(0,t).c_str()),
+- const_cast<char*>(Node::front_structure.c_str())) + 1;
+ p = get_path(const_cast<char*>(sequence.substr(0,t).c_str()),
+ const_cast<char*>(Node::front_structure.c_str()),
+ const_cast<char*>(integrated_structure.substr(0,t).c_str()),
+ Node::OptS->maxkeep);
+- bool barrier_exceeded=false;
+- maxE_idx = 0;
+ for (int i=0; p[i].s != NULL; i++) {
+ // memorize idx of structure with highest energy seen so far
+- if (!barrier_exceeded && p[i].en > maxE) {
++ if(p[i].en > maxE){
+ maxE = p[i].en;
+ maxE_idx = i+1;
+- //barrier_exceeded=true;
+ }
+ v.push_back(std::make_pair(p[i].en, p[i].s));
+ }
+diff --git a/findpath.h b/findpath.h
+deleted file mode 100644
+index 2e27237..0000000
+--- a/findpath.h
++++ /dev/null
+@@ -1,28 +0,0 @@
+-/*
+-* file borrowed from ViennaRNA Package 2.0.4
+-* (this file may be removed completely since it is also present in the ViennaRNA includes
+-*/
+-#ifndef __VIENNA_RNA_PACKAGE_FIND_PATH_H__
+-#define __VIENNA_RNA_PACKAGE_FIND_PATH_H__
+-
+-#include "data_structures.h"
+-
+-/**
+- * \file findpath.h
+- * \brief Compute direct refolding paths between two secondary structures
+- */
+-
+-int find_saddle(char *seq,
+- char *struc1,
+- char *struc2,
+- int max);
+-
+-
+-path_t* get_path( char *seq,
+- char *s1,
+- char* s2,
+- int maxkeep);
+-
+-void free_path(path_t *path);
+-
+-#endif
+--
+2.5.2
+
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 000000000000..958559604596
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,59 @@
+# Maintainer: Ronny Lorenz <ronny at tbi dot univie dot ac dot at>
+
+pkgname=kinwalker
+pkgver=2.0
+pkgrel=1
+pkgdesc="Compute cotranscriptional folding trajectories of RNAs"
+arch=('x86_64' 'i686')
+license=('Custom')
+url="http://www.bioinf.uni-leipzig.de/Software/Kinwalker/"
+depends=('viennarna')
+optdepends=()
+makedepends=()
+provides=()
+source=(http://www.bioinf.uni-leipzig.de/Software/Kinwalker/kinwalker.tar.gz
+ 0001-corrected-Makefile-in-order-to-work-with-ViennaRNA-2.patch
+ 0002-remove-redefinition-of-INF-energies.patch
+ 0003-remove-unnecessary-and-deprecated-wrong-declarations.patch
+ 0004-make-kinwalker-comply-to-stricter-g.patch
+ 0005-remove-all-the-remaining-unnecessary-stuff.patch
+ 0006-fix-bug-for-co-transcriptional-folding-with-dangles-.patch
+ 0007-Do-not-fail-on-using-B-heuristic.patch
+ 0008-Removed-findpath.h-and-cleaned-up-remnants-of-false-.patch
+)
+md5sums=( '7723b173de294ef96b86d94f4f6cbeb9'
+ '2f92e91e58badff10d4fe697bca3abf0'
+ 'dba93e6fce292b6e9b9e7e0b667e6e6c'
+ '9ae628a2c89ac2654813b87a54605966'
+ '73489a3b0f68a5bbfd158b5ea06f422a'
+ '39bd8b46857edd134671c30260dcc93c'
+ 'a6bab92d415092d4e47e08564ae9c48e'
+ '285cfd82e05b9e0c69d0196089d82e3b'
+ '4afda6634ea89393975b953ca7788497'
+ )
+
+prepare() {
+ cd "${srcdir}/kinwalker"
+
+ patch -p1 < ../0001-corrected-Makefile-in-order-to-work-with-ViennaRNA-2.patch
+ patch -p1 < ../0002-remove-redefinition-of-INF-energies.patch
+ patch -p1 < ../0003-remove-unnecessary-and-deprecated-wrong-declarations.patch
+ patch -p1 < ../0004-make-kinwalker-comply-to-stricter-g.patch
+ patch -p1 < ../0005-remove-all-the-remaining-unnecessary-stuff.patch
+ patch -p1 < ../0006-fix-bug-for-co-transcriptional-folding-with-dangles-.patch
+ patch -p1 < ../0007-Do-not-fail-on-using-B-heuristic.patch
+ patch -p1 < ../0008-Removed-findpath.h-and-cleaned-up-remnants-of-false-.patch
+}
+
+build() {
+ cd "${srcdir}/kinwalker"
+ make || return 1
+}
+
+package() {
+ cd "${srcdir}/kinwalker"
+
+ install -Dm755 kinwalker "${pkgdir}/usr/bin/kinwalker"
+ install -Dm644 man/kinwalker.1 "${pkgdir}/usr/share/man/man1/kinwalker.1"
+}
+