Browse code

clang was failing in mac

ramon diaz-uriarte (at Phelsuma) authored on 27/11/2017 10:04:35
Showing3 changed files

... ...
@@ -1,8 +1,8 @@
1 1
 Package: OncoSimulR
2 2
 Type: Package
3 3
 Title: Forward Genetic Simulation of Cancer Progression with Epistasis 
4
-Version: 2.9.2
5
-Date: 2017-11-24
4
+Version: 2.9.3
5
+Date: 2017-11-27
6 6
 Authors@R: c(person("Ramon", "Diaz-Uriarte", role = c("aut", "cre"),
7 7
 		     email = "rdiaz02@gmail.com"),
8 8
 	      person("Mark", "Taylor", role = "ctb", email = "ningkiling@gmail.com"))
... ...
@@ -1,3 +1,6 @@
1
+Changes in version 2.9.3 (2017-11-27):
2
+	- Make clang happy (do not use flandscape as DataFrame)
3
+	
1 4
 Changes in version 2.9.2 (2017-11-24):
2 5
 	- LOD: using only the strict Szendro et al. meaning.
3 6
 	- POM: computed in C++.
... ...
@@ -407,8 +407,11 @@ std::vector<int> GeneToModule(const std::vector<int>& Drv,
407 407
 }
408 408
 
409 409
 
410
+// fitnessLandscape_struct convertFitnessLandscape(Rcpp::List flg,
411
+// 						Rcpp::DataFrame fl_df) {
410 412
 fitnessLandscape_struct convertFitnessLandscape(Rcpp::List flg,
411
-						Rcpp::DataFrame fl_df) {
413
+						Rcpp::List fl_df) {
414
+
412 415
   fitnessLandscape_struct flS;
413 416
   flS.names = Rcpp::as<std::vector<std::string> >(flg["Gene"]);
414 417
   flS.NumID = Rcpp::as<std::vector<int> >(flg["GeneNumID"]);
... ...
@@ -419,7 +422,8 @@ fitnessLandscape_struct convertFitnessLandscape(Rcpp::List flg,
419 422
   Rcpp::NumericVector fitness = fl_df["Fitness"];
420 423
   
421 424
   // Fill up the map genotypes(as string) to fitness
422
-  for(size_t i = 0; i != fl_df.nrows(); ++i) {
425
+  //for(size_t i = 0; i != fl_df.nrows(); ++i) {
426
+  for(size_t i = 0; i != genotNames.size(); ++i) {
423 427
     flS.flmap.insert({genotNames[i], fitness[i]});
424 428
   }
425 429
 
... ...
@@ -505,7 +509,10 @@ fitnessEffectsAll convertFitnessEffects(Rcpp::List rFE) {
505 509
   Rcpp::IntegerVector drv = rFE["drv"];
506 510
 
507 511
   Rcpp::List flg = rFE["fitnessLandscape_gene_id"];
508
-  Rcpp::DataFrame fl_df = rFE["fitnessLandscape_df"];
512
+  // clang does not like this
513
+  // Rcpp::DataFrame fl_df = rFE["fitnessLandscape_df"];
514
+  Rcpp::List fl_df = rFE["fitnessLandscape_df"];
515
+  
509 516
   
510 517
  
511 518
 
... ...
@@ -514,7 +521,8 @@ fitnessEffectsAll convertFitnessEffects(Rcpp::List rFE) {
514 521
   // of noInt. So we can use noInt with shift being those in fitnessLandscape.
515 522
   // BEWARE: will need to modify also createNewGenotype.
516 523
   
517
-  if(fl_df.nrows()) {
524
+  // if(fl_df.nrows()) {
525
+  if(fl_df.size()) {
518 526
     fe.fitnessLandscape = convertFitnessLandscape(flg, fl_df);
519 527
   }
520 528
   
... ...
@@ -534,13 +542,16 @@ fitnessEffectsAll convertFitnessEffects(Rcpp::List rFE) {
534 542
   }
535 543
   // If this is null, use the nullFitnessEffects function; never
536 544
   // end up here.
537
-  if( (rrt.size() + re.size() + ro.size() + rgi.size() + fl_df.nrows()) == 0) {
545
+  
546
+  //   if( (rrt.size() + re.size() + ro.size() + rgi.size() + fl_df.nrows()) == 0) {
547
+  if( (rrt.size() + re.size() + ro.size() + rgi.size() + fl_df.size()) == 0) {
538 548
       throw std::logic_error("\n Nothing inside this fitnessEffects; why are you here?"
539 549
 			     "  Bug in R code.");
540 550
   }
541 551
   
542 552
   // At least for now, if fitness landscape nothing else allowed
543
-  if(fl_df.nrows() && ((rrt.size() + re.size() + ro.size() + rgi.size()) > 0)) {
553
+  // if(fl_df.nrows() && ((rrt.size() + re.size() + ro.size() + rgi.size()) > 0)) {
554
+  if(fl_df.size() && ((rrt.size() + re.size() + ro.size() + rgi.size()) > 0)) {
544 555
     throw std::logic_error("\n Fitness landscape specification."
545 556
 			   " There should be no other terms. "
546 557
 			   " Bug in R code");