src/lib/maf.c 1.41
1.41 2009/11/19 05:31:21 markd
added option to filter mafs by species prefix
Index: src/lib/maf.c
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/lib/maf.c,v
retrieving revision 1.40
retrieving revision 1.41
diff -b -B -U 4 -r1.40 -r1.41
--- src/lib/maf.c 22 Jul 2009 18:00:27 -0000 1.40
+++ src/lib/maf.c 19 Nov 2009 05:31:21 -0000 1.41
@@ -547,9 +547,9 @@
return mc;
}
struct mafComp *mafMayFindComponentInHash(struct mafAli *maf, struct hash *cHash)
-/* Find component of given source that starts matches any string in the cHash.
+/* Find arbitrary component of given source that matches any string in the cHash.
Return NULL if not found. */
{
struct mafComp *mc;
@@ -560,8 +560,28 @@
}
return NULL;
}
+struct mafComp *mafMayFindSpeciesInHash(struct mafAli *maf, struct hash *cHash, char sepChar)
+/* Find arbitrary component of given who's source prefix (ended by sep)
+ matches matches any string in the cHash. Return NULL if not found. */
+{
+struct mafComp *mc;
+
+for (mc = maf->components; mc != NULL; mc = mc->next)
+ {
+ char *sep = strchr(mc->src, sepChar);
+ if (sep != NULL)
+ *sep = '\0';
+ boolean hit = hashFindVal(cHash, mc->src) != NULL;
+ if (sep != NULL)
+ *sep = sepChar;
+ if (hit)
+ return mc;
+ }
+return NULL;
+}
+
boolean mafMayFindAllComponents(struct mafAli *maf, struct hash *cHash)
/* Find component of given source that starts matches any string in the cHash.
Return NULL if not found. */
{