src/hg/ratStuff/mafFrags/mafFrags.c 1.10

1.10 2009/06/23 16:40:19 hiram
The meFirst stuff was broken when the input maf does not have the separator
Index: src/hg/ratStuff/mafFrags/mafFrags.c
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/hg/ratStuff/mafFrags/mafFrags.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -b -B -U 4 -r1.9 -r1.10
--- src/hg/ratStuff/mafFrags/mafFrags.c	31 Oct 2008 00:38:35 -0000	1.9
+++ src/hg/ratStuff/mafFrags/mafFrags.c	23 Jun 2009 16:40:19 -0000	1.10
@@ -12,9 +12,9 @@
 
 
 static char const rcsid[] = "$Id$";
 
-void usage()
+static void usage()
 /* Explain usage and exit. */
 {
 errAbort(
   "mafFrags - Collect MAFs from regions specified in a 6 column bed file\n"
@@ -38,15 +38,15 @@
    {"txStarts", OPTION_BOOLEAN},
    {NULL, 0},
 };
 
-boolean bed12 = FALSE;
-boolean thickOnly = FALSE;
-boolean meFirst = FALSE;
-boolean txStarts = FALSE;
+static boolean bed12 = FALSE;
+static boolean thickOnly = FALSE;
+static boolean meFirst = FALSE;
+static boolean txStarts = FALSE;
 
-struct mafAli *mafFromBed12(char *database, char *track, struct bed *bed, 
-	struct slName *orgList)
+static struct mafAli *mafFromBed12(char *database, char *track,
+    struct bed *bed, struct slName *orgList)
 /* Construct a maf out of exons in bed. */
 {
 /* Loop through all block in bed, collecting a list of mafs, one
  * for each block.  While we're at make a hash of all species seen. */
@@ -144,12 +144,14 @@
 mafAliFreeList(&mafList);
 return bigMaf;
 }
 
-void moveMeToFirst(struct mafAli *maf, char *myName)
+static void moveMeToFirst(struct mafAli *maf, char *myName)
 /* Find component matching myName, and move it to first. */
 {
-struct mafComp *comp = mafFindCompPrefix(maf, myName, ".");
+struct mafComp *comp = mafMayFindCompPrefix(maf, myName, ".");
+if (NULL == comp)
+    comp = mafFindCompPrefix(maf, myName, NULL);
 slRemoveEl(&maf->components, comp);
 slAddHead(&maf->components, comp);
 }
 
@@ -180,9 +182,9 @@
 mafWrite(f, maf);
 mafAliFree(&maf);
 } 
 
-void mafFrags(char *database, char *track, char *bedFile, char *mafFile)
+static void mafFrags(char *database, char *track, char *bedFile, char *mafFile)
 /* mafFrags - Collect MAFs from regions specified in a 6 column bed file. */
 {
 struct slName *orgList = NULL;
 struct lineFile *lf = lineFileOpen(bedFile, TRUE);