Beispiel #1
0
void writeCell(QXmlStreamWriter &stream, const QVariantList &v)
{
    stream.writeStartElement("cell");
    stream.writeAttribute("name", v[1].toString());

    for (int i = 2; i < v.size(); i++)
    {
        QVariant v2 = v[i];
        if (v2.type() == QVariant::List)
        {
            QVariantList l2 = v2.toList();
            if (l2.size() > 0)
            {
                QString tag = l2.first().toString();
                if (tag == "cellType")
                {
                    //stream.writeAttribute("type", l2[1].toString());
                }
                else if (tag == "view")
                {
                    writeView(stream, l2);
                }
                else
                {
                    qWarning("Unexpected tag '%s' in 'cell' tag", qPrintable(tag));
                }
            }
        }
    }

    stream.writeEndElement();
}
bool GaussianBeamWindow::writeFile(const QString& fileName)
{
	QFile file(fileName);
	if (!file.open(QFile::WriteOnly | QFile::Text))
	{
		QMessageBox::warning(this, tr("Saving file"), tr("Cannot write file %1:\n%2.").arg(fileName).arg(file.errorString()));
		return false;
	}

	QXmlStreamWriter xmlWriter(&file);
	xmlWriter.setAutoFormatting(true);
	xmlWriter.writeStartDocument("1.0");
	xmlWriter.writeDTD("<!DOCTYPE gaussianBeam>");
	xmlWriter.writeStartElement("gaussianBeam");
	xmlWriter.writeAttribute("version", "1.1");
		xmlWriter.writeStartElement("bench");
		xmlWriter.writeAttribute("id", "0");
			writeBench(xmlWriter);
		xmlWriter.writeEndElement();
		xmlWriter.writeStartElement("view");
		xmlWriter.writeAttribute("id", "0");
		xmlWriter.writeAttribute("bench", "0");
			writeView(xmlWriter);
		xmlWriter.writeEndElement();
	xmlWriter.writeEndElement();
	xmlWriter.writeEndDocument();

	file.close();
	return true;
}
Beispiel #3
0
void writeTrackDb(struct sqlConnection *conn, struct eapGraph *eg, struct fullExperiment *expList, 
    struct slName *bioList, char *outRa)
/* Write out trackDb info */
{
FILE *f = mustOpen(outRa, "w");
struct hash *otHash = hashNew(0);
struct outputType *ot, *otList = outputTypesForExpList(expList, otHash);
verbose(1, "%d outputTypes\n", slCount(otList));

/* Write out a bunch of easy fields in top level stanza */
char *rootName = "dnase3";
fprintf(f, "track %s\n", rootName);
fprintf(f, "compositeTrack on\n");
fprintf(f, "shortLabel EAP DNase\n");
fprintf(f, "longLabel EAP DNase on hg19 using Hotspot5 and BWA 0.7.0\n");
fprintf(f, "group regulation\n");

/* Group 1 - the views */
fprintf(f, "subGroup1 view Views");
for (ot = otList; ot != NULL; ot = ot->next)
    {
    if (viewableOutput(ot->name) && anyMatchOutputType(expList, ot->name))
	fprintf(f, " %s=%s", ot->name, ot->name);
    }
fprintf(f, "\n");

/* Group 2 the cellTypes */
fprintf(f, "subGroup2 biosample Biosamples");
struct slName *bio;
for (bio = bioList; bio != NULL; bio = bio->next)
    {
    fprintf(f, " %s=%s", symbolify(bio->name), bio->name);
    }
fprintf(f, "\n");

/* Group 3, the replicates */
fprintf(f, "subGroup3 replicate Replicates");
struct slName *rep, *repList = getReplicateNames(expList);
for (rep = repList; rep != NULL; rep = rep->next)
     fprintf(f, " %s=%s", symbolify(rep->name), rep->name);
fprintf(f, "\n");

/* Some more scalar fields in first stanza */
fprintf(f, "sortOrder biosamples=+ replicates=+ view=+\n");
fprintf(f, "dimensions dimensionY=biosample dimensionX=replicate\n");
fprintf(f, "dragAndDrop subTracks\n");
fprintf(f, "noInherit on\n");
fprintf(f, "configurable on\n");
fprintf(f, "type bigBed\n");  // Need something, seems like even if ignored
fprintf(f, "\n");

/* Now move on to views */
for (ot = otList; ot != NULL; ot = ot->next)
    {
    writeView(conn, rootName, ot->name, expList, f);
    }

carefulClose(&f);
}
Beispiel #4
0
 virtual void write(const PointViewPtr view) final
 {
     if (m_hashPos != std::string::npos)
         readyFile(generateFilename());
     writeView(view);
     if (m_hashPos != std::string::npos)
         doneFile();
 }
void TView::writeChar(short x, short y, char c, uchar color, short count) {
   ushort b[maxViewWidth];
   ushort myChar= (((ushort)mapColor(color))<<8) + (unsigned char) c;
   short count2=count;
   if (x<0) x=0;
   if (x+count>maxViewWidth) return;
   ushort *p = b;
   while (count--) *p++ = myChar;
   writeView(x, x+count2, y, b);
}
void TView::writeStr(short x, short y, const char *str, uchar color) {
   if (!str) return;
   ushort l= strlen(str);
   if (l==0) return;
   if (l > maxViewWidth) l = maxViewWidth;
   ushort l2=l;
   ushort myColor=((ushort)mapColor(color)) << 8;
   ushort b[maxViewWidth];
   ushort *p = b;
   while (*p++ = myColor+(*(const unsigned char *)str++), --l);
   writeView(x, x+l2, y, b);
}
void TView::writeLine(short x, short y, short w, short h, const void *buf) {
   if (h==0) return;
   for (int i=0; i<h; i++) {
      writeView(x, x+w, y+i, buf);
   }
}
void TView::writeBuf(short x, short y, short w, short h, const void *buf) {
   for (int i=0; i<h; i++) {
      writeView(x,x+w,y+i,(short *) buf + w*i);
   } /* endfor */
}