/*
 * predExpLevel.h
 * This file is part of isoLasso library; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation; version 2.1 of the License.
 *
 *  Created on: 2011-10-14
 *      Author: daniel
 */
#ifndef PREDEXPLEVEL_H_
#define PREDEXPLEVEL_H_

#include "NewInstance.h"
using namespace std;
struct STAT{
	int negw, nw, ncandidate;
	double tau, adjust;
};
void getExonExpLv(NewInstance &ins, vector<double> &explv);
void getExonJunctionExpLv(NewInstance &ins, vector<double> &explv, vector<double> &rightexplv, vector<double> &leftexplv);
void getExonWeight(vector<long> &exonlength, long &readlength, vector<double> &exonweight);
STAT predExpLevel(NewInstance &ins, double &lambda, vector<string> &varargin);
void getAllPossibleIsoform(NewInstance &ins, vector<string> varargin, vector<vector<long> >&isf, vector<long> &isambigious, vector<long> &fullysupport, long &isreachmax, vector<long> &subinst);
void getlastoffirstexon(vector<long> &candidate,vector<vector<long> > &bound, long &nsegs, long &segid, long &lastsegid);
void stackiso(vector<vector<long > > &rcount, long &index, long &minjunccount, long &nmaxiso, vector<double> &exonexp, double &minexpfrac, bool &countsonly, vector<long> &isintronretention, double &intronretentionfrac, vector<vector<long> > &refinfo, vector<vector<long> >&alliso, long &reachmax, vector<vector<long> >&imap);
void filterImpossilbeCandidates(vector<vector<long> > &tap, NewInstance &oneins, vector<vector<long> > &filtered, vector<long> &orvalid, vector<long> &validf);
bool checkcompatible(vector<long> &candidate, vector<long> &juncpat);
bool checkcompatibleofisoforms(vector<long> &ref, vector<long> &candidate, vector<vector<long> > &segboundary);
void getbound(vector<long> &iso, vector<vector<long> > &segboundary, vector<vector<long> > &bound);
void predsubisoform(vector<vector<long> >&tap, NewInstance &ins, double &lambda, vector<string> inputarg, vector<vector<long> > &pred, vector<double> &predexplv, STAT &stat);
void selectw(vector<vector<long> >&tap, vector<double> &w, double smallpositive, double maxwfraction, bool requirejunccvg, bool requireexoncvg, NewInstance &ins, vector<long> &wsel);
void checkCoverage(vector<vector<long> > &pred, NewInstance &ins, double &isjunccov, double &isexoncov);

#endif /* PREDEXPLEVEL_H_ */
