public string GetMpileupChromosomes() { if (ChromosomeNames != null && ChromosomeNames.Count > 0) { return(ChromosomeNames.Merge(",")); } return(null); }
public override void PrintParameter(TextWriter tw) { tw.WriteLine("#type={0}", this.From); if (this.From == DataSourceType.BAM) { tw.WriteLine("#normal={0}", this.NormalBam); tw.WriteLine("#tumor={0}", this.TumorBam); base.PrintParameter(tw); } else { if (this.From == DataSourceType.Mpileup) { tw.WriteLine("#mpileup={0}", this.TumorBam); } tw.WriteLine("#base_quality={0}", MinimumBaseQuality); tw.WriteLine("#min_read_depth={0}", MinimumReadDepth); tw.WriteLine("#max_read_depth={0}", MaximumReadDepth); } if (ChromosomeNames != null && ChromosomeNames.Count() > 0) { tw.WriteLine("#chromosomes={0}", this.ChromosomeNames.Merge(",")); } tw.WriteLine("#fisher_pvalue={0}", this.FisherPvalue); tw.WriteLine("#max_normal_percentage={0}", this.MaximumPercentageOfMinorAlleleInNormal); tw.WriteLine("#min_tumor_percentage={0}", this.MinimumPercentageOfMinorAlleleInTumor); tw.WriteLine("#min_tumor_read={0}", this.MinimumReadsOfMinorAlleleInTumor); tw.WriteLine("#thread_count={0}", this.ThreadCount); tw.WriteLine("#output={0}", this.OutputSuffix); if (File.Exists(this.ExcludeBedFile)) { tw.WriteLine("#exclude_bed={0}", this.ExcludeBedFile); } tw.WriteLine("#use_zero_minor_allele_strategy={0}", this.UseZeroMinorAlleleStrategy); tw.WriteLine("#zero_minor_allele_strategy_fisher_pvalue={0}", this.ZeroMinorAlleleStrategyFisherPvalue); }
public override bool PrepareOptions() { if (!PrepareOutputDirectory()) { return(false); } if (!string.IsNullOrWhiteSpace(ExcludeBedFile) && !File.Exists(ExcludeBedFile)) { ParsingErrors.Add("Exclude file not exists:" + ExcludeBedFile); return(false); } switch (From) { case DataSourceType.Mpileup: if (null == MpileupFile) { ParsingErrors.Add("Mpileup file not defined."); return(false); } if (!File.Exists(MpileupFile)) { ParsingErrors.Add(string.Format("Mpileup file not exists {0}.", MpileupFile)); return(false); } Console.WriteLine("#mpileup file: " + MpileupFile); break; case DataSourceType.BAM: if (null == NormalBam) { ParsingErrors.Add("Bam file for normal sample not defined."); } else if (!File.Exists(NormalBam)) { ParsingErrors.Add(string.Format("Bam file for normal sample not exists {0}", NormalBam)); } if (null == TumorBam) { ParsingErrors.Add("Bam file for tumor sample not defined."); } else if (!File.Exists(TumorBam)) { ParsingErrors.Add(string.Format("Bam file for tumor sample is not exists {0}", TumorBam)); } if (ThreadCount >= 2) { Console.WriteLine("Checking chromosome names for thread mode ..."); if (ChromosomeNames == null || ChromosomeNames.Count == 0 && File.Exists(GenomeFastaFile)) { var fai = GenomeFastaFile + ".fai"; if (File.Exists(fai)) { var lines = File.ReadAllLines(fai); ChromosomeNames = lines.ToList().ConvertAll(m => { var pos = m.IndexOfAny(new[] { '\t', ' ' }); if (pos == -1) { return(m); } return(m.Substring(0, pos)); }); } else { Console.WriteLine("Reading chromosome names from fasta file ..."); ChromosomeNames = SequenceUtils.ReadFastaNames(GenomeFastaFile); if (ChromosomeNames.Count == 0) { ParsingErrors.Add(string.Format("Genome fasta file doesn't contain chromosome names, {0}.", GenomeFastaFile)); return(false); } } foreach (var chr in ChromosomeNames) { Console.WriteLine(chr); } } } else { if (ChromosomeNames != null && ChromosomeNames.Count > 0) { Console.WriteLine("#mpileup chromosome names: " + ChromosomeNames.Merge(",")); } } break; case DataSourceType.Console: Console.WriteLine("#mpileup from console."); break; } return(true); }