f02bb3ce9489bb2c922188ebf94f52a0e80dd757
braney
  Mon Jul 5 10:45:34 2021 -0700
change system() calls to pipeline() calls.

diff --git src/hg/lib/gtexBoxplot.c src/hg/lib/gtexBoxplot.c
index 2f6909f..3813f93 100644
--- src/hg/lib/gtexBoxplot.c
+++ src/hg/lib/gtexBoxplot.c
@@ -1,27 +1,28 @@
 /* Create a PNG file with boxplot of gene expression 
  *      for GTEx (Genotype Tissue Expression) data. */
 
 /* Copyright (C) 2016 The Regents of the University of California 
  * See README in this or parent directory for licensing information. */
 
 #include "common.h"
 #include "hash.h"
 #include "trashDir.h"
 #include "gtexInfo.h"
 #include "gtexTissue.h"
 #include "gtexSampleData.h"
+#include "pipeline.h"
 
 struct tissueSampleVals
 /* RPKM expression values for multiple samples */
 /* (Data structure shared by different implementations of boxplot (e.g. C, JS),
  * later abandoned) */
     {
     struct tissueSampleVals *next;
     char *name;         /* GTEx tissue name */
     char *description;  /* GTEx tissue description */
     int color;          /* GTEx tissue color */
     int count;          /* number of samples */
     double *vals;       /* RPKM values */
     double min, max;    /* minimum, maximum value */
     double q1, median, q3;      /* quartiles */
     struct slDouble *valList;   /* used to create val array */
@@ -120,39 +121,39 @@
 int i;
 for (tsv = tsvList; tsv != NULL; tsv = tsv->next)
     {
     int count = tsv->count;
     // remove trailing parenthesized phrases as not worth label length
     chopSuffixAt(tsv->description, '(');
     for (i=0; i<count; i++)
         fprintf(f, "%d\t%s\t%0.3f\n", sampleId++, tsv->description, tsv->vals[i]);
     }
 fclose(f);
 
 // Plot to PNG file
 if (!pngTn)
     return FALSE;
 trashDirFile(pngTn, "hgc", "gtexGene", ".png");
-char cmd[256];
 
 /* Exec R in quiet mode, without reading/saving environment or workspace */
-safef(cmd, sizeof(cmd), "Rscript --vanilla --slave hgcData/gtexBoxplot.R %s %s %s %s %s %s",  
+char *pipeCmd[] = {"Rscript","--vanilla","--slave","hgcData/gtexBoxplot.R", 
     geneName, dfTn.forCgi, pngTn->forHtml, 
-                                doLogTransform ? "log=TRUE" : "log=FALSE", "order=alpha", version);
+    doLogTransform ? "log=TRUE" : "log=FALSE", "order=alpha", version, NULL};
+struct pipeline *pl = pipelineOpen1(pipeCmd, pipelineWrite | pipelineNoAbort, "/dev/null", NULL);
+int ret = pipelineWait(pl);
 //NOTE: use "order=score" to order bargraph by median RPKM, descending
 
-int ret = system(cmd);
 if (ret == 0)
     return TRUE;
 return FALSE;
 }
 
 boolean gtexGeneBoxplot(char *geneId, char *geneName, char *version, 
                                 boolean doLogTransform, struct tempName *pngTn)
 /* Create a png temp file with boxplot of GTEx expression values for this gene. 
  * GeneId is the Ensembl gene ID.  GeneName is the HUGO name, used for graph title;
  * If NULL, label with the Ensembl gene ID */
 {
 struct tissueSampleVals *tsvs;
 tsvs  = getTissueSampleVals(geneId, doLogTransform, version, NULL);
 char *label = geneName ? geneName : geneId;
 return drawGtexRBoxplot(label, tsvs, doLogTransform, version, pngTn);