コード例 #1
0
ファイル: seqData.c プロジェクト: davidhoover/kent
static void processSeq(struct gbSelect* select, struct gbFa* inFa)
/* process the next sequence from an update fasta file, possibly outputing
 * the sequence */
{
char acc[GB_ACC_BUFSZ], hdrBuf[GB_ACC_BUFSZ], *hdr = NULL;
short version = gbSplitAccVer(inFa->id, acc);

/* will return NULL on ignored sequences */
struct gbEntry* entry = gbReleaseFindEntry(select->release, acc);

if ((entry != NULL) && (version == entry->selectVer) && !entry->clientFlags)
    {
    /* selected, output if it appears valid */
    if (isValidMrnaSeq(inFa))
        {
        if (!gInclVersion)
            {
            /* put version in comment */
            safef(hdrBuf, sizeof(hdrBuf), "%s %d", acc, version);
            hdr = hdrBuf;
            }
        gbFaWriteFromFa(gOutFa, inFa, hdr);
        entry->clientFlags = TRUE; /* flag so only gotten once */
        }
    else
        {
        fprintf(stderr, "warning: %s does not appear to be a valid mRNA sequence, skipped: %s:%d\n",
                inFa->id, inFa->fileName, inFa->recLineNum);
        }
    }
/* trace if enabled */
if (gbVerbose >= 3)
    {
    if (entry == NULL)
        gbVerbPr(3, "no entry: %s.%d", acc, version);
    else if (entry->selectVer <= 0)
        gbVerbPr(3, "not selected: %s.%d", acc, version);
    else if (version != entry->selectVer)
        gbVerbPr(3, "not version: %s.%d != %d", acc, version, entry->selectVer);
    else
        gbVerbPr(3, "save: %s.%d", acc, version);
    }
}
コード例 #2
0
void outFaWrite(struct outFa* outFa, struct gbFa* inFa)
/* write a record to the output fasta, open or switch to a new file
 * if needed. */
{
if ((maxFaSize > 0) && (outFa->fa != NULL) && (outFa->fa->off > maxFaSize))
    outFaClose(outFa);
if (outFa->fa == NULL)
    outFaOpen(outFa);
gbFaWriteFromFa(outFa->fa, inFa, NULL);
outFa->numSeqs++;
outFa->numBases += inFa->seqLen;

if (outFa->polyAFh != NULL)
    {
    /* note, this modifies the fasta sequence, but we don't care any more */
    fprintf(outFa->polyAFh, "%s\t%d\t%d\t%d\n", inFa->id, inFa->seqLen,
            maskTailPolyA(inFa->seq, inFa->seqLen),
            maskHeadPolyT(inFa->seq, inFa->seqLen));
    }
}