#ifndef __FILE_EMMUSR_H_SEEN__
#define __FILE_EMMUSR_H_SEEN__

/*-----------------------------------------------------------------------------

Copyright (C) 2004, 2005, 2006, 2007.

A. Ronald Gallant
Post Office Box 659
Chapel Hill NC 27514-0659
USA   

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 2 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, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

-----------------------------------------------------------------------------*/

#include "libsnp.h"
#include "libsmm.h"
#include "emm_base.h"
#include "snp.h"

namespace emm {
    
  class snp_usrmod;

  typedef snp_usrmod usrmod_type;

  class snp_usrmod : public libsmm::usrmod_base {
  private:
    snp::trnfrm tr;
    snp::snpll ll;
    scl::realmat X;
    scl::realmat Y;
    INT_32BIT seed;
    INTEGER spin;
    INTEGER slen;
    INTEGER lrho;
    INTEGER lstats;
    bool snp_simulate(INT_32BIT& iseed, scl::realmat& sim);
  public:
    snp_usrmod
      (const scl::realmat& data, INTEGER len_mod_parm, INTEGER len_mod_func,
       const std::vector<std::string>& mod_pfvec,
       const std::vector<std::string>& mod_alvec, 
       std::ostream& detail);
    snp_usrmod();
    snp_usrmod(const snp_usrmod& obj);
    ~snp_usrmod() { }
    snp_usrmod&          operator=(const snp_usrmod& obj);
    INTEGER len_rho() {return lrho;}
    INTEGER len_stats() {return lstats;}
    bool gen_sim(scl::realmat& sim);       //Same seed every call
    bool gen_sim(scl::realmat& sim, scl::realmat& stats);
    bool gen_bootstrap(std::vector<scl::realmat>& bs);  
      //Different seed each call
    void get_rho(scl::realmat& rho);
    void set_rho(const scl::realmat& rho);
    bool support(const scl::realmat& rho);
    scl::den_val prior(const scl::realmat& rho, const scl::realmat& stats);
  };
  
}
#endif
