public SegmentGenome ( string outPath, SegmentationMethod method, bool isGermline ) : void | ||
outPath | string | |
method | SegmentationMethod | |
isGermline | bool | |
return | void |
static int Main(string[] args) { CanvasCommon.Utilities.LogCommandLine(args); string inFile = null; string outFile = null; bool needHelp = false; bool isGermline = false; string bedPath = null; double alpha = Segmentation.DefaultAlpha; SegmentSplitUndo undoMethod = SegmentSplitUndo.None; SegmentationMethod partitionMethod = SegmentationMethod.Wavelets; int maxInterBinDistInSegment = 1000000; OptionSet p = new OptionSet() { { "i|infile=", "input file - usually generated by CanvasClean", v => inFile = v }, { "o|outfile=", "text file to output", v => outFile = v }, { "h|help", "show this message and exit", v => needHelp = v != null }, { "a|alpha=", "alpha parameter to CBS. Default: " + alpha, v => alpha = float.Parse(v) }, { "m|method=", "segmentation method (Wavelets/CBS). Default: " + partitionMethod, v => partitionMethod = (SegmentationMethod)Enum.Parse(typeof(SegmentationMethod), v) }, { "s|split=", "CBS split method (None/Prune/SDUndo). Default: " + undoMethod, v => undoMethod = (SegmentSplitUndo)Enum.Parse(typeof(SegmentSplitUndo), v) }, { "b|bedfile=", "bed file to exclude (don't span these intervals)", v => bedPath = v }, { "g|germline", "flag indicating that input file represents germline genome", v => isGermline = v != null }, { "d|maxInterBinDistInSegment=", "the maximum distance between adjacent bins in a segment (negative numbers turn off splitting segments after segmentation). Default: " + maxInterBinDistInSegment, v => maxInterBinDistInSegment = int.Parse(v) }, }; List <string> extraArgs = p.Parse(args); if (needHelp) { ShowHelp(p); return(0); } if (inFile == null || outFile == null) { ShowHelp(p); return(0); } if (!File.Exists(inFile)) { Console.WriteLine("CanvasPartition.exe: File {0} does not exist! Exiting.", inFile); return(1); } if (!string.IsNullOrEmpty(bedPath) && !File.Exists(bedPath)) { Console.WriteLine("CanvasPartition.exe: File {0} does not exist! Exiting.", bedPath); return(1); } // no command line parameter for segmentation method Segmentation SegmentationEngine = new Segmentation(inFile, bedPath, maxInterBinDistInSegment: maxInterBinDistInSegment); SegmentationEngine.Alpha = alpha; SegmentationEngine.UndoMethod = undoMethod; SegmentationEngine.SegmentGenome(outFile, partitionMethod, isGermline); return(0); }
static int Main(string[] args) { CanvasCommon.Utilities.LogCommandLine(args); string inFile = null; string outFile = null; bool needHelp = false; bool isGermline = false; string bedPath = null; double alpha = Segmentation.DefaultAlpha; SegmentSplitUndo undoMethod = SegmentSplitUndo.None; SegmentationMethod partitionMethod = SegmentationMethod.Wavelets; int maxInterBinDistInSegment = 1000000; OptionSet p = new OptionSet() { { "i|infile=", "input file - usually generated by CanvasClean", v => inFile = v }, { "o|outfile=", "text file to output", v => outFile = v }, { "h|help", "show this message and exit", v => needHelp = v != null }, { "a|alpha=", "alpha parameter to CBS. Default: " + alpha, v => alpha = float.Parse(v) }, { "m|method=", "segmentation method (Wavelets/CBS). Default: " + partitionMethod, v => partitionMethod = (SegmentationMethod)Enum.Parse(typeof(SegmentationMethod), v) }, { "s|split=", "CBS split method (None/Prune/SDUndo). Default: " + undoMethod, v => undoMethod = (SegmentSplitUndo)Enum.Parse(typeof(SegmentSplitUndo), v) }, { "b|bedfile=", "bed file to exclude (don't span these intervals)", v => bedPath = v }, { "g|germline", "flag indicating that input file represents germline genome", v => isGermline = v != null }, { "d|maxInterBinDistInSegment=", "the maximum distance between adjacent bins in a segment (negative numbers turn off splitting segments after segmentation). Default: " + maxInterBinDistInSegment, v => maxInterBinDistInSegment = int.Parse(v) }, }; List<string> extraArgs = p.Parse(args); if (needHelp) { ShowHelp(p); return 0; } if (inFile == null || outFile == null) { ShowHelp(p); return 0; } if (!File.Exists(inFile)) { Console.WriteLine("CanvasPartition.exe: File {0} does not exist! Exiting.", inFile); return 1; } if (!string.IsNullOrEmpty(bedPath) && !File.Exists(bedPath)) { Console.WriteLine("CanvasPartition.exe: File {0} does not exist! Exiting.", bedPath); return 1; } // no command line parameter for segmentation method Segmentation SegmentationEngine = new Segmentation(inFile, bedPath, maxInterBinDistInSegment: maxInterBinDistInSegment); SegmentationEngine.Alpha = alpha; SegmentationEngine.UndoMethod = undoMethod; SegmentationEngine.SegmentGenome(outFile, partitionMethod, isGermline); return 0; }