src/hg/near/hgMapToGene/hgMapToGene.c 1.16
1.16 2009/11/23 23:39:44 kent
Adding ignoreStrand option.
Index: src/hg/near/hgMapToGene/hgMapToGene.c
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/hg/near/hgMapToGene/hgMapToGene.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -b -B -U 4 -r1.15 -r1.16
--- src/hg/near/hgMapToGene/hgMapToGene.c 3 Sep 2008 19:20:41 -0000 1.15
+++ src/hg/near/hgMapToGene/hgMapToGene.c 23 Nov 2009 23:39:44 -0000 1.16
@@ -40,8 +40,9 @@
" -cds - Only consider coding portions of gene.\n"
" -noLoad - Don't load database, just create mapTable.tab file\n"
" -verbose=N - Print intermediate status info if N > 0\n"
" -intronsToo - Include introns\n"
+ " -ignoreStrand - ignore strand when determining overlaps\n"
" -createOnly - Just create mapTable, don't populate it\n"
" -tempDb - Database to look for genes track and where to put result\n"
" -lookup=lookup.txt - Lookup.txt is a 2 column file\n"
" <trackId><lookupId>\n"
@@ -49,8 +50,9 @@
);
}
boolean cdsOnly = FALSE;
+boolean ignoreStrand = FALSE;
boolean intronsToo = FALSE;
boolean createOnly = FALSE;
char *prefix = NULL;
char *trackDb = NULL;
@@ -60,8 +62,9 @@
{"all", OPTION_BOOLEAN},
{"prefix", OPTION_STRING},
{"cds", OPTION_BOOLEAN},
{"intronsToo", OPTION_BOOLEAN},
+ {"ignoreStrand", OPTION_BOOLEAN},
{"noLoad", OPTION_BOOLEAN},
{"createOnly", OPTION_BOOLEAN},
{"lookup", OPTION_STRING},
{"geneTableType", OPTION_STRING},
@@ -193,9 +196,9 @@
if (startsWith("bed", otherType))
{
char *numString = otherType + 3;
bedNum = atoi(numString);
- if (bedNum < 6) /* Just one strand in bed. */
+ if (bedNum < 6 || ignoreStrand) /* Just one strand in bed. */
{
if (strand == '-')
{
binKeeperFree(&bk);
@@ -221,10 +224,13 @@
else if (startsWith("genePred", otherType))
{
struct genePred *gp;
bedNum = 12;
+ if (!ignoreStrand)
+ {
safef(extraBuf, sizeof(extraBuf), "strand = '%c'", strand);
extra = extraBuf;
+ }
sr = hChromQuery(conn, otherTable, chrom, extra, &rowOffset);
while ((row = sqlNextRow(sr)) != NULL)
{
gp = genePredLoad(row + rowOffset);
@@ -240,10 +246,13 @@
else if (startsWith("psl", otherType))
{
struct psl *psl;
bedNum = 12;
+ if (!ignoreStrand)
+ {
safef(extraBuf, sizeof(extraBuf), "strand = '%c'", strand);
extra = extraBuf;
+ }
sr = hChromQuery(conn, otherTable, chrom, extra, &rowOffset);
while ((row = sqlNextRow(sr)) != NULL)
{
psl = pslLoad(row + rowOffset);
@@ -425,8 +435,9 @@
{
optionInit(&argc, argv, options);
cdsOnly = optionExists("cds");
intronsToo = optionExists("intronsToo");
+ignoreStrand = optionExists("ignoreStrand");
createOnly = optionExists("createOnly");
prefix = optionVal("prefix", NULL);
trackDb = cfgOption("db.trackDb");
if(trackDb == NULL)