src/hg/txGene/txGeneExplainUpdate2/txGeneExplainUpdate2.c 1.2
1.2 2009/10/03 02:15:22 kent
Adding -unmapped and -oldAsm options.
Index: src/hg/txGene/txGeneExplainUpdate2/txGeneExplainUpdate2.c
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/hg/txGene/txGeneExplainUpdate2/txGeneExplainUpdate2.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -b -B -U 4 -r1.1 -r1.2
--- src/hg/txGene/txGeneExplainUpdate2/txGeneExplainUpdate2.c 25 Aug 2008 18:18:22 -0000 1.1
+++ src/hg/txGene/txGeneExplainUpdate2/txGeneExplainUpdate2.c 3 Oct 2009 02:15:22 -0000 1.2
@@ -8,21 +8,27 @@
static char const rcsid[] = "$Id$";
+char *unmapped = NULL;
+char *oldAsm = NULL;
+
void usage()
/* Explain usage and exit. */
{
errAbort(
"txGeneExplainUpdate2 - Make table explaining correspondence between versions of UCSC genes.\n"
"usage:\n"
" txGeneExplainUpdate2 oldKg.bed newKg.bed out.tab\n"
"options:\n"
- " -xxx=XXX\n"
+ " -unmapped=unmapped.bed - file containing beds from previous assembly that didn't map well\n"
+ " -oldAsm=hg18 - name of old database where unmapped ones used to live.\n"
);
}
static struct optionSpec options[] = {
+ {"unmapped", OPTION_STRING},
+ {"oldAsm", OPTION_STRING},
{NULL, 0},
};
struct bed *findExact(struct bed *oldBed, struct hash *newKeeperHash)
@@ -177,13 +183,16 @@
void txGeneExplainUpdate2(char *oldKgFile, char *newKgFile, char *outFile)
/* txGeneExplainUpdate2 - Make table explaining correspondence between versions of UCSC genes. */
{
+struct bed *unmappedList = NULL;
struct bed *oldBed, *oldList = bedLoadNAll(oldKgFile, 12);
struct bed *bed, *newList = bedLoadNAll(newKgFile, 12);
struct hash *newAccHash = makeAccHash(newList);
struct hash *newAccVerHash = hashBedList(newList);
struct hash *newKeeperHash = bedsIntoKeeperHash(newList);
+if (unmapped)
+ unmappedList = bedLoadNAll(unmapped, 12);
FILE *f = mustOpen(outFile, "w");
for (oldBed = oldList; oldBed != NULL; oldBed = oldBed->next)
{
@@ -197,8 +206,13 @@
explainOverlap(oldBed, bed, "overlap", f);
else
explainMissing(oldBed, "none", f);
}
+for (oldBed = unmappedList; oldBed != NULL; oldBed = oldBed->next)
+ {
+ fprintf(f, "%s\t%s\t%d\t%d\t%s\tunmapped\tunmapped from %s\n", oldBed->name, oldBed->chrom,
+ oldBed->chromStart, oldBed->chromEnd, "", oldAsm);
+ }
carefulClose(&f);
}
int main(int argc, char *argv[])
@@ -206,7 +220,14 @@
{
optionInit(&argc, argv, options);
if (argc != 4)
usage();
+unmapped = optionVal("unmapped", NULL);
+oldAsm = optionVal("oldAsm", NULL);
+if (unmapped != NULL)
+ {
+ if (oldAsm == NULL)
+ errAbort("You have to specify oldAsm option to say what database unmapped come from.");
+ }
txGeneExplainUpdate2(argv[1], argv[2], argv[3]);
return 0;
}