/* output the sequence for one gene for every species to 
 * the file stream 
 */
void outGenePred(FILE *f, struct genePred *pred, char *dbName, 
    char *mafTable, char *geneTable, struct slName *speciesNameList)
{
unsigned options = 0;

if (inExons)
    options |= MAFGENE_EXONS;
if (noTrans)
    options |= MAFGENE_NOTRANS;
if (!noDash)
    options |= MAFGENE_OUTBLANK;

mafGeneOutPred(f, pred, dbName, mafTable, speciesNameList, options, 0);
}
Esempio n. 2
0
int palOutPredList(struct sqlConnection *conn, struct cart *cart,
    struct genePred *list)
/* output a list of genePreds in pal format */
{
if (list == NULL)
    return 0;

char *mafTable = cartString(cart, hgtaCGIGeneMafTable);
char *database = sqlGetDatabase(conn);
struct trackDb *maftdb = hTrackDbForTrack(database, mafTable);
struct wigMafSpecies *wmSpecies;
int groupCnt;

/* get maf parent (if any) */
maftdb->parent = hCompositeTrackDbForSubtrack(database,maftdb);

/* this queries the state of the getSpecies dialog */
wigMafGetSpecies(cart, maftdb, maftdb->track, database, &wmSpecies, &groupCnt);

/* since the species selection dialog doesn't list
 * the reference species, we just automatically include
 * it */
struct slName *includeList = slNameNew(database);

/* now make a list of all species that are on */
for(; wmSpecies; wmSpecies = wmSpecies->next)
    {
    if (wmSpecies->on)
	{
	struct slName *newName = slNameNew(wmSpecies->name);
	slAddHead(&includeList, newName);
	}
    }
slReverse(&includeList);

boolean inExons = cartUsualBoolean(cart, hgtaCGIGeneExons , FALSE);
boolean noTrans = cartUsualBoolean(cart, hgtaCGIGeneNoTrans, FALSE);
boolean outBlank = cartUsualBoolean(cart, hgtaCGIGeneOutBlank, FALSE);
boolean outTable = cartUsualBoolean(cart, hgtaCGIOutTable, FALSE);
boolean truncHeader = cartUsualBoolean(cart, hgtaCGITruncHeader, FALSE);
int numCols = cartUsualInt(cart, hgtaCGINumColumns, 20);
unsigned options = 0;

if (inExons)  options |= MAFGENE_EXONS;
if (noTrans)  options |= MAFGENE_NOTRANS;
if (outBlank) options |= MAFGENE_OUTBLANK;
if (outTable) options |= MAFGENE_OUTTABLE;

if (!truncHeader)
    numCols = -1;

/* send out the alignments */
int outCount = 0;
for( ; list ; list = list->next)
    {
    if (list->cdsStart != list->cdsEnd)
	{
	outCount++;
	mafGeneOutPred(stdout, list, database, mafTable,
	    includeList, options, numCols);
	}
    }

slNameFreeList(&includeList);
return outCount;
}