コード例 #1
0
        public static void Main(string[] args)
        {
            Splash();
            parsedArgs = ProcessCommandLineArguments(args);
            VennDiagramData vdd = new VennDiagramData(parsedArgs.regionArray);

            if (parsedArgs.polar)
            {
                vdd.WritePolarVennDiagramData();
            }
            else
            {
                vdd.WriteVennDiagramData();
            }
            if (parsedArgs.xl.Length > 0)
            {
                // produce an XL file with the 'right stuff'
                // Make sure we pass a complete filename path too.
                string filename = Path.GetFullPath(parsedArgs.xl);
                Console.WriteLine("Produce Excel VennDiagram file: {0}", filename);
                VennToNodeXL.CreateVennDiagramNodeXLFile(filename, vdd);
            }
        }
コード例 #2
0
        public static int Main(string[] args)
        {
            try
            {
                Splash();
                arguments = ProcessCommandLineArguments(args);

                if (arguments.inputFiles.Count() == 2)
                {
                    // now read the 2 BED files and do the operation to isolate each set
                    SequenceRangeGrouping srg1 = ReadBedFile(arguments.inputFiles[0]);
                    SequenceRangeGrouping srg2 = ReadBedFile(arguments.inputFiles[1]);

                    SequenceRangeGrouping srgOnly_A, srgOnly_B, srgOnly_AB;

                    VennToNodeXL.CreateSequenceRangeGroupingsForVennDiagram(
                        srg1,
                        srg2,
                        out srgOnly_A,
                        out srgOnly_B,
                        out srgOnly_AB);

                    var srgmOnly_A  = new SequenceRangeGroupingMetrics(srgOnly_A);
                    var srgmOnly_B  = new SequenceRangeGroupingMetrics(srgOnly_B);
                    var srgmOnly_AB = new SequenceRangeGroupingMetrics(srgOnly_AB);

                    if (createVennToolInputFile)
                    {
                        Console.Error.Write("\nWriting file [{0}]", vennToolInputFileFullPath);
                        var VennOutput = new StreamWriter(vennToolInputFileFullPath);
                        VennOutput.WriteLine("{0} {1} {2}", srgmOnly_A.bases, srgmOnly_B.bases, srgmOnly_AB.bases);
                        VennOutput.Close();
                        Console.Error.Write(" ... Done.");
                    }

                    if (createExcelWorkbook)
                    {
                        // create the Excel workbook with a NodeXL Venn diagram
                        Console.Error.Write("\nWriting file [{0}]", excelWorkbookFullPath);
                        var vdd = new VennDiagramData(srgmOnly_A.bases, srgmOnly_B.bases, srgmOnly_AB.bases);
                        try
                        {
                            VennToNodeXL.CreateVennDiagramNodeXLFile(excelWorkbookFullPath, vdd);
                            Console.Error.Write(" ... Done.\n");
                        }
                        catch (Exception e)
                        {
                            Console.Error.Write("Error:  Unable to create Excel workbook.");
                            DisplayException(e);
                            Environment.Exit(-1);
                        }
                    }
                    if (verbose)
                    {
                        Console.Error.Write("\nDump Sequence Groupings from two files\n");
                        SequenceRangeGroupingToString(srgOnly_A, "srgOnly_A");
                        SequenceRangeGroupingToString(srgOnly_B, "srgOnly_B");
                        SequenceRangeGroupingToString(srgOnly_AB, "srgOnly_AB");
                        Console.Error.Write("\nEnd Sequence group from twoe files\n");
                    }

                    Console.Write("\nOutput basepair count for each set");
                    Console.Write("\nGroupA,GroupB,GroupAB");
                    Console.Write("\n{0},{1},{2}\n", srgmOnly_A.bases, srgmOnly_B.bases, srgmOnly_AB.bases);
                }
                else if (arguments.inputFiles.Count() == 3)
                {
                    // TODO:  Reduce memory usage by re-using the SRGs after debugging is complete
                    //
                    // now read the 3 BED files and do the operation to isolate each set
                    SequenceRangeGrouping srg1 = ReadBedFile(arguments.inputFiles[0]);
                    SequenceRangeGrouping srg2 = ReadBedFile(arguments.inputFiles[1]);
                    SequenceRangeGrouping srg3 = ReadBedFile(arguments.inputFiles[2]);

                    SequenceRangeGrouping srgOnly_A,
                                          srgOnly_B,
                                          srgOnly_C,
                                          srgOnly_AB,
                                          srgOnly_AC,
                                          srgOnly_BC,
                                          srgOnly_ABC;

                    VennToNodeXL.CreateSequenceRangeGroupingsForVennDiagram(
                        srg1,
                        srg2,
                        srg3,
                        out srgOnly_A,
                        out srgOnly_B,
                        out srgOnly_C,
                        out srgOnly_AB,
                        out srgOnly_AC,
                        out srgOnly_BC,
                        out srgOnly_ABC);

                    /*
                     * We have the set information data for the three files.
                     * Now what?
                     */
                    // generate the intersection Venn metrics
                    var srgmOnly_A   = new SequenceRangeGroupingMetrics(srgOnly_A);
                    var srgmOnly_B   = new SequenceRangeGroupingMetrics(srgOnly_B);
                    var srgmOnly_C   = new SequenceRangeGroupingMetrics(srgOnly_C);
                    var srgmOnly_AB  = new SequenceRangeGroupingMetrics(srgOnly_AB);
                    var srgmOnly_AC  = new SequenceRangeGroupingMetrics(srgOnly_AC);
                    var srgmOnly_BC  = new SequenceRangeGroupingMetrics(srgOnly_BC);
                    var srgmOnly_ABC = new SequenceRangeGroupingMetrics(srgOnly_ABC);

                    if (createVennToolInputFile)
                    {
                        Console.Error.Write("\nWriting file [{0}]", vennToolInputFileFullPath);
                        var VennOutput = new StreamWriter(vennToolInputFileFullPath);
                        VennOutput.WriteLine(
                            "{0} {1} {2} {3} {4} {5} {6}",
                            srgmOnly_A.bases,
                            srgmOnly_B.bases,
                            srgmOnly_C.bases,
                            srgmOnly_AB.bases,
                            srgmOnly_AC.bases,
                            srgmOnly_BC.bases,
                            srgmOnly_ABC.bases);
                        VennOutput.Close();
                        Console.Error.Write(" ... Done.");
                    }

                    if (createExcelWorkbook)
                    {
                        // create the NodeXL Venn diagram filefile
                        var vdd = new VennDiagramData(
                            srgmOnly_A.bases,
                            srgmOnly_B.bases,
                            srgmOnly_C.bases,
                            srgmOnly_AB.bases,
                            srgmOnly_AC.bases,
                            srgmOnly_BC.bases,
                            srgmOnly_ABC.bases);
                        // create the Excel workbook with a NodeXL Venn diagram
                        Console.Error.Write("\nWriting file [{0}]", excelWorkbookFullPath);
                        try
                        {
                            VennToNodeXL.CreateVennDiagramNodeXLFile(excelWorkbookFullPath, vdd);
                            Console.Error.Write(" ... Done.\n");
                        }
                        catch (Exception e)
                        {
                            Console.Error.Write("\nError:  Unable to create Excel workbook.");
                            DisplayException(e);
                            Environment.Exit(-1);
                        }
                    }
                    if (verbose)
                    {
                        Console.Error.Write("\nDump Sequence Groupings from three files\n");
                        SequenceRangeGroupingToString(srgOnly_A, "srgOnly_A");
                        SequenceRangeGroupingToString(srgOnly_B, "srgOnly_B");
                        SequenceRangeGroupingToString(srgOnly_C, "srgOnly_C");
                        SequenceRangeGroupingToString(srgOnly_AB, "srgOnly_AB");
                        SequenceRangeGroupingToString(srgOnly_AC, "srgOnly_AC");
                        SequenceRangeGroupingToString(srgOnly_BC, "srgOnly_BC");
                        SequenceRangeGroupingToString(srgOnly_ABC, "srgOnly_ABC");
                        Console.Error.Write("\nEnd Sequence group from three files\n");
                    }

                    Console.Write("\nOutput basepair count for each set");
                    Console.Write("\nGroupA,GroupB,GroupC,GroupAB,GroupAC,GroupBC,GroupABC");
                    Console.Write(
                        "\n{0},{1},{2},{3},{4},{5},{6}\n",
                        srgmOnly_A.bases,
                        srgmOnly_B.bases,
                        srgmOnly_C.bases,
                        srgmOnly_AB.bases,
                        srgmOnly_AC.bases,
                        srgmOnly_BC.bases,
                        srgmOnly_ABC.bases);
                }
            }
            catch (Exception ex)
            {
                DisplayException(ex);
            }
            return(0);
        }
コード例 #3
0
        public static void Main(string[] args)
        {
            Splash();

            parsedArgs = ProcessCommandLineArguments(args);

            if (parsedArgs.inputFiles.Count() == 2)
            {
                // now read the 2 BED files and do the operation to isolate each set
                SequenceRangeGrouping srg1 = ReadBedFile(parsedArgs.inputFiles[0]);
                SequenceRangeGrouping srg2 = ReadBedFile(parsedArgs.inputFiles[1]);

                SequenceRangeGrouping srgOnly_A, srgOnly_B, srgOnly_AB;

                VennToNodeXL.CreateSequenceRangeGroupingsForVennDiagram(srg1, srg2, out srgOnly_A, out srgOnly_B, out srgOnly_AB);

                if (fCreateVennToolInputFile || fCreateExcelWorkbook)
                {
                    SequenceRangeGroupingMetrics srgmOnly_A  = new SequenceRangeGroupingMetrics(srgOnly_A);
                    SequenceRangeGroupingMetrics srgmOnly_B  = new SequenceRangeGroupingMetrics(srgOnly_B);
                    SequenceRangeGroupingMetrics srgmOnly_AB = new SequenceRangeGroupingMetrics(srgOnly_AB);

                    if (fCreateVennToolInputFile)
                    {
                        //SequenceRangeGroupingMetrics srgm = new SequenceRangeGroupingMetrics(srgOnly_A);
                        StreamWriter VennOutput = new StreamWriter(VennToolInputFileFullPath);
                        VennOutput.WriteLine("{0} {1} {2}"
                                             , srgmOnly_A.cBases
                                             , srgmOnly_B.cBases
                                             , srgmOnly_AB.cBases);
                        VennOutput.Close();
                    }

                    if (fCreateExcelWorkbook)
                    {
                        // create the Excel workbook with a NodeXL Venn diagram
                        VennDiagramData vdd = new VennDiagramData(srgmOnly_A.cBases
                                                                  , srgmOnly_B.cBases
                                                                  , srgmOnly_AB.cBases);
                        VennToNodeXL.CreateVennDiagramNodeXLFile(ExcelWorkbookFullPath, vdd);
                    }
                    if (fVerbose)
                    {
                        SequenceRangeGroupingToString(srgOnly_A, "srgOnly_A");
                        SequenceRangeGroupingToString(srgOnly_B, "srgOnly_B");
                        SequenceRangeGroupingToString(srgOnly_AB, "srgOnly_AB");
                        Console.WriteLine("end two file dump");
                    }
                }
            }
            if (parsedArgs.inputFiles.Count() == 3)
            {
                // TODO:  Reduce memory usage by re-using the SRGs after debugging is complete
                //
                // now read the 3 BED files and do the operation to isolate each set
                SequenceRangeGrouping srg1 = ReadBedFile(parsedArgs.inputFiles[0]);
                SequenceRangeGrouping srg2 = ReadBedFile(parsedArgs.inputFiles[1]);
                SequenceRangeGrouping srg3 = ReadBedFile(parsedArgs.inputFiles[2]);

                SequenceRangeGrouping srgOnly_A, srgOnly_B, srgOnly_C, srgOnly_AB, srgOnly_AC, srgOnly_BC, srgOnly_ABC;

                VennToNodeXL.CreateSequenceRangeGroupingsForVennDiagram(srg1, srg2, srg3,
                                                                        out srgOnly_A,
                                                                        out srgOnly_B,
                                                                        out srgOnly_C,
                                                                        out srgOnly_AB,
                                                                        out srgOnly_AC,
                                                                        out srgOnly_BC,
                                                                        out srgOnly_ABC);

                /*
                 * We have the set information data for the three files.
                 * Now what?
                 */
                if (fCreateVennToolInputFile || fCreateExcelWorkbook)
                {
                    // generate the intersection Venn metrics
                    SequenceRangeGroupingMetrics srgmOnly_A   = new SequenceRangeGroupingMetrics(srgOnly_A);
                    SequenceRangeGroupingMetrics srgmOnly_B   = new SequenceRangeGroupingMetrics(srgOnly_B);
                    SequenceRangeGroupingMetrics srgmOnly_C   = new SequenceRangeGroupingMetrics(srgOnly_C);
                    SequenceRangeGroupingMetrics srgmOnly_AB  = new SequenceRangeGroupingMetrics(srgOnly_AB);
                    SequenceRangeGroupingMetrics srgmOnly_AC  = new SequenceRangeGroupingMetrics(srgOnly_AC);
                    SequenceRangeGroupingMetrics srgmOnly_BC  = new SequenceRangeGroupingMetrics(srgOnly_BC);
                    SequenceRangeGroupingMetrics srgmOnly_ABC = new SequenceRangeGroupingMetrics(srgOnly_ABC);

                    if (fCreateVennToolInputFile)
                    {
                        StreamWriter VennOutput = new StreamWriter(VennToolInputFileFullPath);
                        VennOutput.WriteLine("{0} {1} {2} {3} {4} {5} {6}"
                                             , srgmOnly_A.cBases
                                             , srgmOnly_B.cBases
                                             , srgmOnly_C.cBases
                                             , srgmOnly_AB.cBases
                                             , srgmOnly_AC.cBases
                                             , srgmOnly_BC.cBases
                                             , srgmOnly_ABC.cBases);
                        VennOutput.Close();
                    }

                    if (fCreateExcelWorkbook)
                    {
                        // create the NodeXL Venn diagram filefile
                        VennDiagramData vdd = new VennDiagramData(srgmOnly_A.cBases
                                                                  , srgmOnly_B.cBases
                                                                  , srgmOnly_C.cBases
                                                                  , srgmOnly_AB.cBases
                                                                  , srgmOnly_AC.cBases
                                                                  , srgmOnly_BC.cBases
                                                                  , srgmOnly_ABC.cBases);
                        VennToNodeXL.CreateVennDiagramNodeXLFile(ExcelWorkbookFullPath, vdd);
                    }
                    if (fVerbose)
                    {
                        SequenceRangeGroupingToString(srgOnly_A, "srgOnly_A");
                        SequenceRangeGroupingToString(srgOnly_B, "srgOnly_B");
                        SequenceRangeGroupingToString(srgOnly_C, "srgOnly_C");
                        SequenceRangeGroupingToString(srgOnly_AB, "srgOnly_AB");
                        SequenceRangeGroupingToString(srgOnly_AC, "srgOnly_AC");
                        SequenceRangeGroupingToString(srgOnly_BC, "srgOnly_BC");
                        SequenceRangeGroupingToString(srgOnly_ABC, "srgOnly_ABC");
                        Console.Error.WriteLine("end three file dump");
                    }
                }
            }
        }