本文整理汇总了C#中ConsoleLogger.?.StartTask方法的典型用法代码示例。如果您正苦于以下问题:C# ConsoleLogger.?.StartTask方法的具体用法?C# ConsoleLogger.?.StartTask怎么用?C# ConsoleLogger.?.StartTask使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ConsoleLogger
的用法示例。
在下文中一共展示了ConsoleLogger.?.StartTask方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AnalyseVcfFile
public void AnalyseVcfFile(string variantPath, VariantFileType fileType, string snpPath = null,
ConsoleLogger logger = null)
{
ProgressReporter pr = null;
logger?.LogInfo(LogName, "Analysing variants");
//Do we need to load snps?
if (snpPath != null)
{
pr = null;
if (logger != null)
{
pr = new ProgressReporter(logger, 1);
}
logger?.StartTask(1, "Load SNP file");
LoadUcscSnps(snpPath, true, pr);
logger?.EndTask(1);
logger?.LogInfo(LogName, "Loaded " + Snps.Count + " SNPs");
}
//Init
_splitter = null;
var variantCount = 0;
var unmatchedCount = 0;
//Var vcf
var calledForwardOnPlus = 0;
var calledForwardOnNeg = 0;
//Var final report
var matchedFwdStrand = 0;
var unMatchedFwdStrand = 0;
//Logging
pr = null;
if (logger != null)
{
pr = new ProgressReporter(logger, 1);
}
logger?.StartTask(1, "Processing variants");
//Read file
using (var reader = _fileReaderFactory.GetFileReader(variantPath))
{
foreach (var line in reader)
{
//Load variants
var variants = LoadVariant(fileType, line);
//Continue if not a real variants
if (variants == null)
{
continue;
}
for (var i = 0; i < variants.Length; i++)
{
//Get current variant
var variant = variants[i];
//Try and match to snp's loads
Snp matchSnp;
Snps.TryGetValue(variant.Id, out matchSnp);
//Check we have a match
if (matchSnp != null)
{
if (fileType == VariantFileType.Vcf)
{
if (matchSnp.Strand == "+" && matchSnp.SnpRef == variant.VcfRef)
{
calledForwardOnPlus++;
}
else if (matchSnp.Strand == "-" && matchSnp.SnpRef == variant.VcfRef)
{
calledForwardOnNeg++;
}
}
else if (fileType == VariantFileType.IlluminiaFinalReport)
{
if (variant.AlleleA != "-" && variant.AlleleB != "-")
{
if ((variant.AlleleA == matchSnp.SnpRef || variant.AlleleA == matchSnp.SnpAlt) &&
(variant.AlleleB == matchSnp.SnpRef || variant.AlleleB == matchSnp.SnpAlt))
{
matchedFwdStrand++;
}
else
{
if (matchSnp.Observed.Length <= 3)
{
unMatchedFwdStrand++;
}
}
}
}
else if (fileType == VariantFileType.IlluminaMatrix)
{
if (variant.AlleleA != "-" && variant.AlleleB != "-")
//.........这里部分代码省略.........