src/hg/ratStuff/mafsInRegion/mafsInRegion.c 1.7

1.7 2009/07/25 08:32:16 markd
added option to keep initial/training gaps in alignment'
Index: src/hg/ratStuff/mafsInRegion/mafsInRegion.c
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/hg/ratStuff/mafsInRegion/mafsInRegion.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -b -B -U 4 -r1.6 -r1.7
--- src/hg/ratStuff/mafsInRegion/mafsInRegion.c	22 Jul 2009 20:23:27 -0000	1.6
+++ src/hg/ratStuff/mafsInRegion/mafsInRegion.c	25 Jul 2009 08:32:16 -0000	1.7
@@ -18,17 +18,20 @@
   "usage:\n"
   "    mafsInRegion regions.bed out.maf|outDir in.maf(s)\n"
   "options:\n"
   "    -outDir - output separate files named by bed name field to outDir\n"
+  "    -keepInitialGaps - keep alignment columns at the beginning and of a block that are gapped in all species\n"
   );
 }
 
 static struct optionSpec options[] = {
     {"outDir", OPTION_BOOLEAN},
+    {"keepInitialGaps", OPTION_BOOLEAN},
     {NULL, 0},
 };
 
 boolean outDir = FALSE;
+boolean keepInitialGaps = FALSE;
 char *dir = NULL;
 char *scoring = NULL;
 
 struct hash *loadRegions(char *file)
@@ -137,9 +140,9 @@
         struct mafAli *full = maf;
         if (mafStart < bed->chromStart || mafEnd > bed->chromEnd)
             {
             full = maf;
-            maf = mafSubset(full, mc->src, bed->chromStart, bed->chromEnd);
+            maf = mafSubsetE(full, mc->src, bed->chromStart, bed->chromEnd, keepInitialGaps);
             mc = maf->components;
             }
         verbose(2, "   %s:%d-%d\n", chrom, mc->start+1, mc->start + mc->size);
         mafWrite(f, maf);
@@ -194,8 +197,9 @@
 /* Process command line. */
 {
 optionInit(&argc, argv, options);
 outDir = optionExists("outDir");
+keepInitialGaps = optionExists("keepInitialGaps");
 if (argc < 4)
     usage();
 mafsInRegion(argv[1], argv[2], argc-3, &argv[3]);
 return 0;