Пример #1
0
void doReplicatePair(struct sqlConnection *conn, struct edwAssembly *assembly,
    struct edwFile *elderEf, struct edwValidFile *elderVf,
    struct edwFile *youngerEf, struct edwValidFile *youngerVf)
/* Do processing on a pair of replicates. */
{
verbose(1, "processing pair %lld %s  %lld %s\n", (long long)elderEf->id, 
    elderEf->submitFileName, (long long)youngerEf->id, youngerEf->submitFileName);
char *format = elderVf->format;
if (sameString(format, "fastq") || sameString(format, "bam") || sameString(format, "gff")
    || sameString(format, "gtf"))
    {
    doSampleReplicate(conn, format, assembly, elderEf, elderVf, youngerEf, youngerVf);
    }
else if (edwIsSupportedBigBedFormat(format))
    {
    doBigBedReplicate(conn, format, assembly, elderEf, elderVf, youngerEf, youngerVf);
    }
else if (sameString(format, "bigWig"))
    {
    doBigWigReplicate(conn, assembly, elderEf, elderVf, youngerEf, youngerVf);
    }
else if (sameString(format, "unknown"))
    {
    // Nothing we can do
    }
else
    errAbort("Unrecognized format %s in doReplicatePair", format);
}
Пример #2
0
boolean isSupportedFormat(char *format)
/* Return TRUE if this is one of our supported formats */
{
/* First deal with non bigBed */
static char *otherSupportedFormats[] = {"unknown", "fastq", "bam", "bed", "gtf", 
    "bigWig", "bigBed", 
    "bedLogR", "bedRrbs", "bedMethyl", "broadPeak", "narrowPeak", 
    "bed_bedLogR", "bed_bedRrbs", "bed_bedMethyl", "bed_broadPeak", "bed_narrowPeak",
    "bedRnaElements", "openChromCombinedPeaks", "peptideMapping", "shortFrags", 
    "rcc", "idat", "fasta", "customTrack",
    };
static int otherSupportedFormatsCount = ArraySize(otherSupportedFormats);
if (stringArrayIx(format, otherSupportedFormats, otherSupportedFormatsCount) >= 0)
    return TRUE;

/* If starts with bed_ then skip over prefix.  It will be caught by bigBed */
if (startsWith("bed_", format))
    format += 4;
return edwIsSupportedBigBedFormat(format);
}
Пример #3
0
char *printFormatSpecificViewInfo(FILE *f, char *indent, struct view *view, 
    struct composite *comp, struct taggedFile *tfList)
/* Print out part of a view trackDb stanza that are format specific. */
{
char *format = view->format;
if (sameString(format, "bigWig"))
    {
    return printBigWigViewInfo(f, indent, view, comp, tfList);
    }
else if (sameString(format, "bam"))
    {
    return printBamViewInfo(f, indent, view, comp, tfList);
    }
else if (edwIsSupportedBigBedFormat(format))
    {
    return printBigBedViewInfo(f, indent, view, comp, tfList);
    }
else
    {
    errAbort("Unrecognized format in printFormatSpecificViewInfo");
    return NULL;
    }
}
Пример #4
0
boolean viewableFormat(char *format)
/* Return TRUE if it's a format we can visualize. */
{
return sameString(format, "bigWig") || sameString(format, "bam") 
       || edwIsSupportedBigBedFormat(format);
}
Пример #5
0
void doEnrichments(struct sqlConnection *conn, struct edwFile *ef, char *path, 
    struct hash *assemblyToTarget)
/* Calculate enrichments on for all targets file. The targetList and the
 * grtList are in the same order. */
{
/* Get validFile from database. */
struct edwValidFile *vf = edwValidFileFromFileId(conn, ef->id);
if (vf == NULL)
    return;	/* We can only work if have validFile table entry */

if (!isEmpty(vf->enrichedIn))
    {
    /* Get our assembly */
    char *format = vf->format;
    char *ucscDb = vf->ucscDb;
    struct edwAssembly *assembly = edwAssemblyForUcscDb(conn, ucscDb);

    struct target *targetList = hashFindVal(assemblyToTarget, assembly->name);
    if (targetList == NULL)
	{
	targetList = targetsForAssembly(conn, assembly);
	if (targetList == NULL)
	    errAbort("No targets for assembly %s", assembly->name);
	hashAdd(assemblyToTarget, assembly->name, targetList);
	}

    /* Loop through targetList zeroing out existing ovelaps. */
    struct target *target;
    boolean allSkip = TRUE;
    for (target = targetList; target != NULL; target = target->next)
	{
	target->overlapBases = target->uniqOverlapBases = 0;
	target->skip = enrichmentExists(conn, ef, target->target);
	if (!target->skip)
	    allSkip = FALSE;
	}

    /* Do a big dispatch based on format. */
    if (!allSkip)
	{
	if (sameString(format, "fastq"))
	    doEnrichmentsFromSampleBed(conn, ef, vf, assembly, targetList);
	else if (sameString(format, "bigWig"))
	    doEnrichmentsFromBigWig(conn, ef, vf, assembly, targetList);
	else if (edwIsSupportedBigBedFormat(format))
	    doEnrichmentsFromBigBed(conn, ef, vf, assembly, targetList);
	else if (sameString(format, "gtf"))
	    doEnrichmentsFromSampleBed(conn, ef, vf, assembly, targetList);
	else if (sameString(format, "gff"))
	    doEnrichmentsFromSampleBed(conn, ef, vf, assembly, targetList);
	else if (sameString(format, "bam"))
	    doEnrichmentsFromSampleBed(conn, ef, vf, assembly, targetList);
	else if (sameString(format, "unknown"))
	    verbose(2, "Unknown format in doEnrichments(%s), that's chill.", ef->edwFileName);
	else
	    errAbort("Unrecognized format %s in doEnrichments(%s)", format, path);
	}

    /* Clean up and go home. */
    edwAssemblyFree(&assembly);
    }
edwValidFileFree(&vf);
}