00001
00002 #include "common.h"
00003 #include "axt.h"
00004 #include "maf.h"
00005
00006 static char const rcsid[] = "$Id: mafFromAxt.c,v 1.4 2003/05/17 23:47:15 kent Exp $";
00007
00008 void mafFromAxtTemp(struct axt *axt, int tSize, int qSize,
00009 struct mafAli *temp)
00010
00011
00012
00013
00014
00015 {
00016 static struct mafComp qComp, tComp;
00017 ZeroVar(temp);
00018 ZeroVar(&qComp);
00019 ZeroVar(&tComp);
00020 temp->score = axt->score;
00021 temp->textSize = axt->symCount;
00022 qComp.src = axt->qName;
00023 qComp.srcSize = qSize;
00024 qComp.strand = axt->qStrand;
00025 qComp.start = axt->qStart;
00026 qComp.size = axt->qEnd - axt->qStart;
00027 qComp.text = axt->qSym;
00028 slAddHead(&temp->components, &qComp);
00029 tComp.src = axt->tName;
00030 tComp.srcSize = tSize;
00031 tComp.strand = axt->tStrand;
00032 tComp.start = axt->tStart;
00033 tComp.size = axt->tEnd - axt->tStart;
00034 tComp.text = axt->tSym;
00035 slAddHead(&temp->components, &tComp);
00036 }
00037
00038 struct mafAli *mafFromAxt(struct axt *axt, int tSize,
00039 char *tPrefix, int qSize, char *qPrefix)
00040
00041
00042 {
00043 struct mafAli *maf;
00044 struct mafComp *mc;
00045 char name[256];
00046 AllocVar(maf);
00047 maf->score = axt->score;
00048 maf->textSize = axt->symCount;
00049 AllocVar(mc);
00050 if (qPrefix == NULL)
00051 mc->src = cloneString(axt->qName);
00052 else
00053 {
00054 safef(name, sizeof(name), "%s.%s", qPrefix, axt->qName);
00055 mc->src = cloneString(name);
00056 }
00057 mc->srcSize = qSize;
00058 mc->strand = axt->qStrand;
00059 mc->start = axt->qStart;
00060 mc->size = axt->qEnd - axt->qStart;
00061 mc->text = cloneStringZ(axt->qSym, axt->symCount);
00062 slAddHead(&maf->components, mc);
00063 AllocVar(mc);
00064 if (tPrefix == NULL)
00065 mc->src = cloneString(axt->tName);
00066 else
00067 {
00068 safef(name, sizeof(name), "%s.%s", tPrefix, axt->tName);
00069 mc->src = cloneString(name);
00070 }
00071 mc->srcSize = tSize;
00072 mc->strand = axt->tStrand;
00073 mc->start = axt->tStart;
00074 mc->size = axt->tEnd - axt->tStart;
00075 mc->text = cloneStringZ(axt->tSym, axt->symCount);
00076 slAddHead(&maf->components, mc);
00077 return maf;
00078 }