f02bb3ce9489bb2c922188ebf94f52a0e80dd757 braney Mon Jul 5 10:45:34 2021 -0700 change system() calls to pipeline() calls. diff --git src/hg/hgc/hgc.c src/hg/hgc/hgc.c index 4423b45..eb2a210 100644 --- src/hg/hgc/hgc.c +++ src/hg/hgc/hgc.c @@ -251,30 +251,31 @@ #include "bigBed.h" #include "bigPsl.h" #include "bedTabix.h" #include "longRange.h" #include "hmmstats.h" #include "aveStats.h" #include "trix.h" #include "bPlusTree.h" #include "customFactory.h" #include "iupac.h" #include "clinvarSubLolly.h" #include "jsHelper.h" #include "errCatch.h" #include "htslib/bgzf.h" #include "htslib/kstring.h" +#include "pipeline.h" static char *rootDir = "hgcData"; #define LINESIZE 70 /* size of lines in comp seq feature */ struct cart *cart; /* User's settings. */ char *seqName; /* Name of sequence we're working on. */ int winStart, winEnd; /* Bounds of sequence. */ char *database; /* Name of mySQL database. */ char *organism; /* Colloquial name of organism. */ char *genome; /* common name, e.g. Mouse, Human */ char *scientificName; /* Scientific name of organism. */ /* for earlyBotCheck() function at the beginning of main() */ #define delayFraction 0.5 /* standard penalty is 1.0 for most CGIs */ @@ -25787,51 +25788,59 @@ static char *replaceSuffix(char *input, char *newSuffix) /* Given a filename with a suffix, replace existing suffix with a new suffix. */ { char buffer[4096]; safecpy(buffer, sizeof buffer, input); char *dot = strrchr(buffer, '.'); safecpy(dot+1, sizeof buffer - 1 - (dot - buffer), newSuffix); return cloneString(buffer); } static void makeBigPsl(char *pslName, char *faName, char *db, char *outputBigBed) /* Make a bigPsl with the blat results. */ { char *bigPslFile = replaceSuffix(outputBigBed, "bigPsl"); -char cmdBuffer[4096]; -safef(cmdBuffer, sizeof(cmdBuffer), "loader/pslToBigPsl %s -fa=%s stdout | sort -k1,1 -k2,2n > %s", pslName, faName, bigPslFile); -system(cmdBuffer); +char faNameBuffer[strlen("-fa=") + strlen(faName) + 1]; +safef(faNameBuffer, sizeof faNameBuffer, "-fa=%s", faName); +char *cmd11[] = {"loader/pslToBigPsl", pslName, faNameBuffer, "stdout", NULL}; +char *cmd12[] = {"sort","-k1,1","-k2,2n", NULL}; +char **cmds1[] = { cmd11, cmd12, NULL}; +struct pipeline *pl = pipelineOpen(cmds1, pipelineWrite, bigPslFile, NULL); +pipelineWait(pl); + char buf[4096]; char *twoBitDir; if (trackHubDatabase(db)) { struct trackHubGenome *genome = trackHubGetGenome(db); twoBitDir = genome->twoBitPath; } else { safef(buf, sizeof(buf), "/gbdb/%s", db); twoBitDir = hReplaceGbdbSeqDir(buf, db); safef(buf, sizeof(buf), "%s%s.2bit", twoBitDir, db); twoBitDir = buf; } -safef(cmdBuffer, sizeof(cmdBuffer), "loader/bedToBigBed -verbose=0 -udcDir=%s -extraIndex=name -sizesIs2Bit -tab -as=loader/bigPsl.as -type=bed12+13 %s %s %s", - udcDefaultDir(), bigPslFile, twoBitDir, outputBigBed); -system(cmdBuffer); +char udcDir[strlen(udcDefaultDir()) + strlen("-udcDir=") + 1]; +safef(udcDir, sizeof udcDir, "-udcDir=%s", udcDefaultDir()); +char *cmd2[] = {"loader/bedToBigBed","-verbose=0",udcDir,"-extraIndex=name","-sizesIs2Bit", "-tab", "-as=loader/bigPsl.as","-type=bed12+13", bigPslFile, twoBitDir, outputBigBed, NULL}; +pl = pipelineOpen1(cmd2, pipelineRead, NULL, NULL); +pipelineWait(pl); + unlink(bigPslFile); } static void buildBigPsl(char *fileNames) /* Build a custom track with a bigPsl file out of blat results. * Bring up the bigPsl detail page with all the alignments. */ { char *trackName = cartString(cart, "trackName"); char *trackDescription = cartString(cart, "trackDescription"); char *pslName, *faName, *qName; parseSs(fileNames, &pslName, &faName, &qName); struct tempName bigBedTn; trashDirDateFile(&bigBedTn, "hgBlat", "bp", ".bb"); char *bigBedFile = bigBedTn.forCgi;