コード例 #1
0
ファイル: eapToHub.c プロジェクト: apmagalhaes/kentUtils
void writeFastqTab(struct sqlConnection *conn, struct eapGraph *eg, 
    struct fullExperiment *expList, char *assembly, char *outFile)
/* Write out a table in simple html based on eeList*/
{
FILE *f = mustOpen(outFile, "w");
struct fullExperiment *exp;
for (exp = expList; exp != NULL; exp = exp->next)
    {
    long long pooledPeakId = pooledBroadPeaksForExp(exp);
    if (pooledPeakId > 0)
	{
	struct slRef *ref, *refList = NULL;
	eapGraphAncestorsOfFormat(eg, pooledPeakId, "fastq", -1, &refList);
	for (ref = refList; ref != NULL; ref = ref->next)
	    {
	    struct eapInput *in = ref->val;
	    struct edwFile *file = edwFileFromId(conn, in->fileId);
	    fprintf(f, "%s\t%s\t%s\n", file->edwFileName, exp->name, exp->exp->biosample);
	    edwFileFree(&file);
	    }
	slFreeList(&refList);
	}
    }

carefulClose(&f);
}
コード例 #2
0
void edwCorrectFileTags(char *tabFileName)
/* edwCorrectFileTags - Use this to correct tags in the edwFile table and corresponding fields 
 * in the edwValidFile table without forcing a validateManifest rerun or a reupload.. */
{
struct sqlConnection *conn = edwConnectReadWrite();
char *requiredFields[] = {"accession",};
char *forbiddenFields[] = {"md5_sum", "size", "valid_key", "file_name"};
struct fieldedTable *table = fieldedTableFromTabFile(tabFileName, tabFileName,
	requiredFields, ArraySize(requiredFields));
checkForbiddenFields(table, forbiddenFields, ArraySize(forbiddenFields));
int accessionIx = stringArrayIx("accession", table->fields, table->fieldCount);

struct fieldedRow *fr;
for (fr = table->rowList; fr != NULL; fr = fr->next)
    {
    char *acc = fr->row[accessionIx];
    long long id = edwNeedFileIdForLicensePlate(conn, acc);
    struct edwFile *ef = edwFileFromId(conn, id);
    int i;
    char *tags = ef->tags;
    for (i=0; i<table->fieldCount; ++i)
        {
	if (i != accessionIx)
	    tags = cgiStringNewValForVar(tags, table->fields[i], fr->row[i]);
	}
    edwFileResetTags(conn, ef, tags);
    edwFileFree(&ef);
    }
}
コード例 #3
0
ファイル: edwLib.c プロジェクト: elmargb/kentUtils
struct edwFile *edwFileFromIdOrDie(struct sqlConnection *conn, long long fileId)
/* Return edwValidFile given fileId - aborts if not found. */
{
struct edwFile *ef = edwFileFromId(conn, fileId);
if (ef == NULL)
    errAbort("Couldn't find file for id %lld\n", fileId);
return ef;
}
コード例 #4
0
ファイル: edwChangeFormat.c プロジェクト: elmargb/kentUtils
void changeFormat(struct sqlConnection *conn, struct edwValidFile *vf, char *format)
/* Set up vf to change format. */
{
struct edwFile *ef = edwFileFromId(conn, vf->fileId);
char *newTags = cgiStringNewValForVar(ef->tags, tagToChange, format);
edwFileResetTags(conn, ef, newTags);
edwFileFree(&ef);
}
コード例 #5
0
ファイル: eapFixSortedBams.c プロジェクト: bowhan/kent
struct edwFile *getFilesFromIds(struct sqlConnection *conn, uint ids[], int idCount)
/* Get a list of files specified in an array of ids. */
{
struct edwFile *list = NULL, *el;
int i;
for (i=0; i<idCount; ++i)
    {
    el = edwFileFromId(conn, ids[i]);
    slAddHead(&list, el);
    }
slReverse(&list);
return list;
}
コード例 #6
0
ファイル: edwSubmit.c プロジェクト: apmagalhaes/kentUtils
static int handleOldFileTags(struct sqlConnection *conn, struct submitFileRow *sfrList,
    boolean update)
/* Check metadata on files mentioned in manifest that by MD5 sum we already have in
 * warehouse.   We may want to update metadata on these. This returns the number
 * of files with tags updated. */
{
struct submitFileRow *sfr;
int updateCount = 0;
for (sfr = sfrList; sfr != NULL; sfr = sfr->next)
    {
    struct edwFile *newFile = sfr->file;
    struct edwFile *oldFile = edwFileFromId(conn, sfr->md5MatchFileId);
    verbose(2, "looking at old file %s (%s)\n", oldFile->submitFileName, newFile->submitFileName);
    struct cgiDictionary *newTags = cgiDictionaryFromEncodedString(newFile->tags);
    struct cgiDictionary *oldTags = cgiDictionaryFromEncodedString(oldFile->tags);
    boolean updateName = !sameString(oldFile->submitFileName, newFile->submitFileName);
    boolean updateTags = !cgiDictionarySame(oldTags, newTags);
    if (updateName)
	{
	if (!update)
	    errAbort("%s already uploaded with name %s.  Please use the 'update' option if you "
	             "want to give it a new name.",  
		     newFile->submitFileName, oldFile->submitFileName);
        updateSubmitName(conn, oldFile->id,  newFile->submitFileName);
	}
    if (updateTags)
	{
	if (!update)
	    {
	    char *name="", *oldVal="", *newVal="";
	    cgiDictionaryFirstDiff(oldTags, newTags, &name, &oldVal, &newVal);
	    errAbort("%s is duplicate of %s in warehouse, but %s column went from %s to %s.\n"
	             "Please use the 'update' option if you are meaning to update the information\n"
		     "associated with this file and try again if this is intentional.",
		     newFile->submitFileName, oldFile->edwFileName,
		     name, oldVal, newVal);
	    }
	edwFileResetTags(conn, oldFile, newFile->tags, TRUE);
	}
    if (updateTags || updateName)
	++updateCount;
    cgiDictionaryFree(&oldTags);
    cgiDictionaryFree(&newTags);
    }
return updateCount;
}