src/hg/ratStuff/mafFrags/mafFrags.c 1.11
1.11 2009/07/11 17:30:44 markd
added option to preserve reference coordinates
Index: src/hg/ratStuff/mafFrags/mafFrags.c
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/hg/ratStuff/mafFrags/mafFrags.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -b -B -U 4 -r1.10 -r1.11
--- src/hg/ratStuff/mafFrags/mafFrags.c 23 Jun 2009 16:40:19 -0000 1.10
+++ src/hg/ratStuff/mafFrags/mafFrags.c 11 Jul 2009 17:30:44 -0000 1.11
@@ -26,8 +26,9 @@
" -thickOnly - Only extract subset between thickStart/thickEnd\n"
" -meFirst - Put native sequence first in maf\n"
" -txStarts - Add MAF txstart region definitions ('r' lines) using BED name\n"
" and output actual reference genome coordinates in MAF.\n"
+ " -refCoords - output actual reference genome coordinates in MAF.\n"
);
}
static struct optionSpec options[] = {
@@ -35,15 +36,17 @@
{"bed12", OPTION_BOOLEAN},
{"thickOnly", OPTION_BOOLEAN},
{"meFirst", OPTION_BOOLEAN},
{"txStarts", OPTION_BOOLEAN},
+ {"refCoords", OPTION_BOOLEAN},
{NULL, 0},
};
static boolean bed12 = FALSE;
static boolean thickOnly = FALSE;
static boolean meFirst = FALSE;
static boolean txStarts = FALSE;
+static boolean refCoords = FALSE;
static struct mafAli *mafFromBed12(char *database, char *track,
struct bed *bed, struct slName *orgList)
/* Construct a maf out of exons in bed. */
@@ -159,13 +162,14 @@
struct slName *orgList)
/* generate MAF alignment for a bed6 */
{
struct mafAli *maf;
+char *useName = refCoords ? NULL : bed->name;
if (txStarts)
{
maf = hgMafFrag(database, track,
bed->chrom, bed->chromStart, bed->chromEnd, bed->strand[0],
- NULL, orgList);
+ useName, orgList);
maf->regDef = mafRegDefNew(mafRegDefTxUpstream,
bed->chromEnd-bed->chromStart,
bed->name);
if (meFirst)
@@ -174,9 +178,9 @@
else
{
maf = hgMafFrag(database, track,
bed->chrom, bed->chromStart, bed->chromEnd, bed->strand[0],
- bed->name, orgList);
+ useName, orgList);
if (meFirst)
moveMeToFirst(maf, bed->name);
}
mafWrite(f, maf);
@@ -246,7 +250,10 @@
bed12 = optionExists("bed12");
thickOnly = optionExists("thickOnly");
meFirst = optionExists("meFirst");
txStarts = optionExists("txStarts");
+refCoords = optionExists("refCoords") || txStarts;
+if (refCoords && bed12)
+ errAbort("can't specify -txStart or -refCoords with -bed12");
mafFrags(argv[1], argv[2], argv[3], argv[4]);
return 0;
}