示例#1
0
文件: gff.c 项目: JinfengChen/pblat
struct gffFile *gffRead(char *fileName)
/* Create a gffFile structure from a GFF file. */
{
struct gffFile *gff = gffFileNew(fileName);
gffFileAdd(gff, fileName, 0);
return gff;
}
示例#2
0
void gffIntoDatabase(char *database, char *fileName, char *table, int offset)
/* Load a gff file into database. */
{
struct gffFile *gff = gffFileNew("");
struct gffGroup *group;
struct genePred *gpList = NULL, *gp;
FILE *f;
char *tabName = "genePred.tab";

/* Load fixed gff and convert it to genePred. */
gffFileAdd(gff, fileName, 0);
gffGroupLines(gff);
for (group = gff->groupList; group != NULL; group = group->next)
    {
    gp = genePredFromGroupedGff(gff, group, group->name, "exon", 
                                genePredCdsStatFld|genePredExonFramesFld,
                                genePredGxfDefaults);
    if (gp != NULL)
	{
	slAddHead(&gpList, gp);
	genePredOffset(gp, offset);
	}
    }
slSort(&gpList, genePredCmp);

/* Create tab-delimited file. */
f = mustOpen(tabName, "w");
for (gp = gpList; gp != NULL; gp = gp->next)
    genePredTabOut(gp, f);
carefulClose(&f);

/* Load into database. */
loadIntoDatabase(database, createGenePred, "sanger22", tabName);
}