本文整理汇总了C#中System.IO.TextWriter.WriteDsvField方法的典型用法代码示例。如果您正苦于以下问题:C# TextWriter.WriteDsvField方法的具体用法?C# TextWriter.WriteDsvField怎么用?C# TextWriter.WriteDsvField使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.IO.TextWriter
的用法示例。
在下文中一共展示了TextWriter.WriteDsvField方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FormatCsvArray
private static void FormatCsvArray(TextWriter writer, IList<float> floatArray, CultureInfo cultureInfo)
{
char intensitySeparator = TextUtil.GetCsvSeparator(cultureInfo);
for (int i = 0; i < floatArray.Count; ++i)
{
if (i > 0)
writer.Write(intensitySeparator);
writer.WriteDsvField(System.Convert.ToString(floatArray[i], cultureInfo), intensitySeparator);
}
}
示例2: FormatHeader
private static void FormatHeader(TextWriter writer, IList<string> fieldNames)
{
for (int i = 0; i < fieldNames.Count; ++i)
{
if (i > 0)
writer.Write(MAIN_SEPARATOR);
writer.WriteDsvField(fieldNames[i], MAIN_SEPARATOR);
}
writer.WriteLine();
}
示例3: WriteTransition
protected override void WriteTransition(TextWriter writer,
XmlFastaSequence sequence,
XmlPeptide peptide,
XmlTransition transition)
{
char separator = TextUtil.GetCsvSeparator(_cultureInfo);
writer.Write(transition.PrecursorMz.ToString(_cultureInfo));
writer.Write(separator);
writer.Write(transition.ProductMz.ToString(_cultureInfo));
writer.Write(separator);
if (MethodType == ExportMethodType.Standard)
writer.Write(Math.Round(DwellTime, 2).ToString(_cultureInfo));
else
{
if (!peptide.PredictedRetentionTime.HasValue)
throw new InvalidOperationException(Resources.XmlThermoMassListExporter_WriteTransition_Attempt_to_write_scheduling_parameters_failed);
writer.Write(peptide.PredictedRetentionTime.Value.ToString(_cultureInfo));
}
writer.Write(separator);
// Write special ID for ABI software
var fastaSequence = new FastaSequence(sequence.Name, sequence.Description, null, peptide.Sequence);
var newPeptide = new Peptide(fastaSequence, peptide.Sequence, 0, peptide.Sequence.Length, peptide.MissedCleavages);
var nodePep = new PeptideDocNode(newPeptide);
string modifiedPepSequence = AbiMassListExporter.GetSequenceWithModsString(nodePep, _document.Settings); // Not L10N;
string extPeptideId = string.Format("{0}.{1}.{2}.{3}", // Not L10N
sequence.Name,
modifiedPepSequence,
GetTransitionName(transition),
"light"); // Not L10N : file format
writer.WriteDsvField(extPeptideId, separator);
writer.Write(separator);
writer.Write(Math.Round(transition.DeclusteringPotential ?? 0, 1).ToString(_cultureInfo));
writer.Write(separator);
writer.Write(Math.Round(transition.CollisionEnergy, 1).ToString(_cultureInfo));
writer.WriteLine();
}
示例4: FormatChromLine
private static void FormatChromLine(TextWriter writer,
IEnumerable<string> fieldArray,
IList<float> times,
IList<float> intensities,
CultureInfo cultureInfo)
{
foreach (string field in fieldArray)
{
writer.WriteDsvField(field, MAIN_SEPARATOR);
writer.Write(MAIN_SEPARATOR);
}
FormatCsvArray(writer, times, cultureInfo);
writer.Write(MAIN_SEPARATOR);
FormatCsvArray(writer, intensities, cultureInfo);
writer.WriteLine();
}
示例5: WriteHeader
private static void WriteHeader(TextWriter writer)
{
const char separator = TextUtil.SEPARATOR_TSV;
// ReSharper disable NonLocalizedString
var namesArray = new List<string>
{
"FileName",
"PeptideModifiedSequence",
"Apex",
"annotation_Score",
"annotation_QValue",
"decoy"
};
// ReSharper restore NonLocalizedString
bool first = true;
foreach (var name in namesArray)
{
if (first)
first = false;
else
writer.Write(separator);
writer.WriteDsvField(name, separator);
}
writer.WriteLine();
}
示例6: WriteLine
private static void WriteLine(TextWriter writer,
CultureInfo cultureInfo,
string file,
string modifiedSequence,
double rt,
double score,
double qValue,
bool decoy)
{
const char separator = TextUtil.SEPARATOR_TSV;
var fieldsArray = new List<string>
{
file,
modifiedSequence,
Convert.ToString(rt, cultureInfo),
Convert.ToString(score, cultureInfo),
Convert.ToString(qValue, cultureInfo),
Convert.ToString(decoy, cultureInfo)
};
bool first = true;
foreach (var name in fieldsArray)
{
if (first)
first = false;
else
writer.Write(separator);
writer.WriteDsvField(name, separator);
}
writer.WriteLine();
}
示例7: WriteLine
public void WriteLine(TextWriter writer,
string dataset,
string toolName,
double peptides01,
double peptides05,
double peptidesAll,
double qValue01,
double qValue05)
{
const char separator = TextUtil.SEPARATOR_TSV;
var fieldsArray = new List<string>
{
dataset,
toolName,
Convert.ToString(peptides01, CultureInfo.InvariantCulture),
Convert.ToString(peptides05, CultureInfo.InvariantCulture),
Convert.ToString(peptidesAll, CultureInfo.InvariantCulture),
Convert.ToString(qValue01, CultureInfo.InvariantCulture),
Convert.ToString(qValue05, CultureInfo.InvariantCulture),
};
bool first = true;
foreach (var name in fieldsArray)
{
if (first)
first = false;
else
writer.Write(separator);
writer.WriteDsvField(name, separator);
}
writer.WriteLine();
}
示例8: WriteHeader
public void WriteHeader(TextWriter writer)
{
const char separator = TextUtil.SEPARATOR_TSV;
// ReSharper disable NonLocalizedString
var namesArray = new List<string>
{
"DataSet",
"ToolName",
"Peptides01",
"Peptides05",
"PeptdesAll",
"QValue01",
"QValue05"
};
// ReSharper restore NonLocalizedString
bool first = true;
foreach (var name in namesArray)
{
if (first)
first = false;
else
writer.Write(separator);
writer.WriteDsvField(name, separator);
}
writer.WriteLine();
}
示例9: WriteRow
private static void WriteRow(TextWriter writer,
PeakTransitionGroupFeatures features,
PeakGroupFeatures peakGroupFeatures,
CultureInfo cultureInfo,
double mProphetScore,
double pValue,
double qValue)
{
char separator = TextUtil.GetCsvSeparator(cultureInfo);
string fileName = SampleHelp.GetFileName(features.Id.FilePath);
var fieldsArray = new List<string>
{
Convert.ToString(features.Id, cultureInfo),
Convert.ToString(features.Id.Run, cultureInfo),
fileName,
Convert.ToString(peakGroupFeatures.RetentionTime, cultureInfo),
Convert.ToString(peakGroupFeatures.StartTime, cultureInfo),
Convert.ToString(peakGroupFeatures.EndTime, cultureInfo),
features.Id.NodePep.RawUnmodifiedTextId, // Unmodified sequence, or custom ion name
features.Id.NodePep.RawTextId, // Modified sequence, or custom ion name
features.Id.NodePepGroup.Name,
Convert.ToString(features.Id.NodePep.IsDecoy ? 1 : 0, cultureInfo),
ToFieldString((float) mProphetScore, cultureInfo),
ToFieldString((float) pValue, cultureInfo),
ToFieldString((float) qValue, cultureInfo)
};
if (IsFilterTestData)
{
fieldsArray.Add(peakGroupFeatures.GetFilterPairsText(cultureInfo));
}
foreach (var name in fieldsArray)
{
writer.WriteDsvField(name, separator);
writer.Write(separator);
}
bool first = true;
foreach (float featureColumn in peakGroupFeatures.Features)
{
if (!first)
writer.Write(separator);
writer.WriteDsvField(ToFieldString(featureColumn, cultureInfo), separator);
first = false;
}
writer.WriteLine();
}
示例10: WriteHeaderRow
private static void WriteHeaderRow(TextWriter writer, IEnumerable<IPeakFeatureCalculator> calcs, CultureInfo cultureInfo)
{
char separator = TextUtil.GetCsvSeparator(cultureInfo);
// ReSharper disable NonLocalizedString
var namesArray = new List<string>
{
"transition_group_id",
"run_id",
"FileName",
"RT",
"MinStartTime",
"MaxEndTime",
"Sequence",
"PeptideModifiedSequence",
"ProteinName",
"PrecursorIsDecoy",
"mProphetScore",
"pValue",
"qValue"
};
if (IsFilterTestData)
{
namesArray.Add("FoundIonFilters");
}
// ReSharper restore NonLocalizedString
foreach (var name in namesArray)
{
writer.WriteDsvField(name, separator);
writer.Write(separator);
}
bool first = true;
foreach (var peakFeatureCalculator in calcs)
{
if (!first)
writer.Write(separator);
writer.Write(first ? "main_var_{0}" : "var_{0}", peakFeatureCalculator.HeaderName.Replace(" ", "_")); // Not L10N
first = false;
}
writer.WriteLine();
}
示例11: WriteReportHelper
public static void WriteReportHelper(ResultSet results, char separator, TextWriter writer, CultureInfo ci)
{
for (int i = 0; i < results.ColumnInfos.Count; i++)
{
var columnInfo = results.ColumnInfos[i];
if (columnInfo.IsHidden)
continue;
if (i > 0)
writer.Write(separator);
writer.WriteDsvField(columnInfo.Caption, separator);
}
writer.WriteLine();
for (int iRow = 0; iRow < results.RowCount; iRow++)
{
for (int iColumn = 0; iColumn < results.ColumnInfos.Count; iColumn++)
{
var columnInfo = results.ColumnInfos[iColumn];
if (columnInfo.IsHidden)
continue;
if (iColumn > 0)
writer.Write(separator);
string value = results.FormatValue(iRow, iColumn, ci);
writer.WriteDsvField(value, separator);
}
writer.WriteLine();
}
}