Exemplo n.º 1
0
        /// <summary>
        /// Displays details of the components the file was broken into.
        /// </summary>
        public void DisplayComponentDetais()
        {
            foreach (String dir in fqMap.getFileComponentDirectories())
            {
                FqFile_Component_Details componentDetails = fqMap.GetFqFileComponentDetailsMap()[dir];

                textBox.SelectionFont = new Font(textBox.Font.ToString(), 8, FontStyle.Bold);
                textBox.AppendText("\t[" + componentDetails.getGraphName() + " CONTENTS]\n\n");

                textBox.SelectionFont = new Font(textBox.Font.ToString(), 8, FontStyle.Regular);
                textBox.AppendText("\tTotal Sequences: ");
                textBox.SelectionFont = new Font(textBox.Font.ToString(), 8, FontStyle.Regular);
                textBox.AppendText(componentDetails.TotalSequences.ToString());

                textBox.SelectionFont = new Font(textBox.Font.ToString(), 8, FontStyle.Regular);
                textBox.AppendText("\t\tTotal Nucleotides: ");
                textBox.SelectionFont = new Font(textBox.Font.ToString(), 8, FontStyle.Regular);
                textBox.AppendText(componentDetails.TotalNucs.ToString() + "\n\n");

                textBox.SelectionFont = new Font(textBox.Font.ToString(), 8, FontStyle.Regular);
                textBox.AppendText("\tCytosine Count: ");
                textBox.SelectionFont = new Font(textBox.Font.ToString(), 8, FontStyle.Regular);
                textBox.AppendText(componentDetails.CCount.ToString());
                textBox.AppendText("\t" + Math.Round(componentDetails.CPercent, 2).ToString() + "(%) \n");

                textBox.SelectionFont = new Font(textBox.Font.ToString(), 8, FontStyle.Regular);
                textBox.AppendText("\tGuanine Count: ");
                textBox.SelectionFont = new Font(textBox.Font.ToString(), 8, FontStyle.Regular);
                textBox.AppendText(componentDetails.GCount.ToString());
                textBox.AppendText("\t" + Math.Round(componentDetails.GPercent, 2).ToString() + "(%) \n");

                textBox.SelectionFont = new Font(textBox.Font.ToString(), 8, FontStyle.Regular);
                textBox.AppendText("\tFailed Read Count: ");
                textBox.SelectionFont = new Font(textBox.Font.ToString(), 8, FontStyle.Regular);
                textBox.AppendText(componentDetails.NCount.ToString());
                textBox.AppendText("\t" + Math.Round(componentDetails.NPercent, 4).ToString() + "(%) \n\n");

                textBox.SelectionFont = new Font(textBox.Font.ToString(), 8, FontStyle.Regular);
                textBox.AppendText("\tSmallest Sequence Length: ");
                textBox.SelectionFont = new Font(textBox.Font.ToString(), 8, FontStyle.Regular);
                textBox.AppendText(componentDetails.MinSeqSize.ToString());

                textBox.SelectionFont = new Font(textBox.Font.ToString(), 8, FontStyle.Regular);
                textBox.AppendText("\tLargest Sequence Length: ");
                textBox.SelectionFont = new Font(textBox.Font.ToString(), 8, FontStyle.Regular);
                textBox.AppendText(componentDetails.MaxSeqSize.ToString() + "\n\n");

                textBox.SelectionFont = new Font(textBox.Font.ToString(), 8, FontStyle.Regular);
                textBox.AppendText("\tNucleotides Cleaned: ");
                textBox.SelectionFont = new Font(textBox.Font.ToString(), 8, FontStyle.Regular);
                textBox.AppendText(componentDetails.NucleotidesCleaned.ToString());

                textBox.SelectionFont = new Font(textBox.Font.ToString(), 8, FontStyle.Regular);
                textBox.AppendText("\t\tSequences Removed: ");
                textBox.SelectionFont = new Font(textBox.Font.ToString(), 8, FontStyle.Regular);
                textBox.AppendText(componentDetails.SequencesRemoved.ToString() + "\n\n");
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Changes the chart type via this combo box
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Charts_Combo_Selector_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (FastqController.CONTROLLER_STATE == FastqController.FastqControllerState.STATE_READY)
            {
                FqFileMap map = FastqController.getInstance().GetFqFileMap();

                if (map != null)
                {
                    SetGraphicTrackBarDataSourceSize();
                    List <String> componentDetails = map.getFileComponentDirectories();
                    Dictionary <string, FqFile_Component_Details> componentMap = map.GetFqFileComponentDetailsMap();
                    if (componentDetails != null && componentMap != null)
                    {
                        int index = graphicsTrackBar.Value;
                        FqFile_Component_Details details;
                        String chartType = Charts_Combo_Selector.SelectedValue.ToString();

                        if (chartType.Equals(FastqGUI_Charts.FastqChartTypes.PerBaseSequenceStatistics.ToString()))
                        {
                            details = componentMap[componentDetails[index]];
                            drawChart(details, chartType);
                        }
                        else
                        {
                            if (index == 0)
                            {
                                details = FastqController.getInstance().GetFqFileMap().GlobalDetails;
                                drawChart(details, chartType);
                            }
                            else if (index > 0)
                            {
                                details = componentMap[componentDetails[index - 1]];
                                drawChart(details, chartType);
                            }
                        }
                    }
                }
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// The key method in the controller class, where fastqFile_components are serialized and deserialized in and out of
        /// the classes queues for processing.  The tasks are constructed through an interface - ITaskStrategy - which
        /// is designated through the task abstract factory class (TaskDiscriminator.cs).  After processing, files are deserialized and a details class
        /// for each component is populated, as are the global scores.  The use of Abstract/interface classes here allows multiple components
        /// to be processed with multiple task types within this basic code structure.
        /// </summary>
        /// <param name="worker">The backgroundworker thread</param>
        /// <param name="input">Generic inputs, including taskname and any further details necessary to complete a task such as nucleotide scores etc.</param>
        public void PerformAction(BackgroundWorker worker, GenericFastqInputs input)
        {
            BackgroundWorker loadWorker = worker;

            if (fqFileMap != null && (CONTROLLER_STATE == FastqControllerState.STATE_READY || CONTROLLER_STATE == FastqControllerState.PARSING))
            {
                sw = new Stopwatch();
                sw.Start();
                try
                {
                    toDeserialize = new Queue <String>(fqFileMap.getFileComponentDirectories());
                    PrimeFqFileComponentQueue();
                    protobufSerialization = new ProtocolBuffersSerialization();

                    ITaskStrategy task = TaskDiscrimination.getTask(input.TaskAction);
                    Console.WriteLine("Performing {0}", task.getStatement());

                    int count = 0;
                    while (toPerform.Count != 0)
                    {
                        Double progressPercent = (Double)(count / (Double)fqFileMap.getFileComponentDirectories().Count);
                        loadWorker.ReportProgress((int)(progressPercent * 100), task.getReportStatement());

                        FqFile_Component activeComponent = toPerform.Dequeue();
                        activeComponent.setFqHashMap(fqFileMap.FqReadMap);

                        if (toDeserialize.Count != 0)
                        {
                            int threadId;
                            ProtocolBuffersSerialization.ProbufDeserializeFqFile_AsyncMethodCaller caller
                                = new ProtocolBuffersSerialization.ProbufDeserializeFqFile_AsyncMethodCaller(protobufSerialization.ProtobufDerializeFqFile);
                            String       componentFileName = toDeserialize.Dequeue();
                            IAsyncResult result            = caller.BeginInvoke(componentFileName, out threadId, null, null);

                            Console.WriteLine("\n*** Processing: {0} ***\n", activeComponent.getFileName());
                            input.FastqFile = activeComponent;
                            input           = task.perform(input);
                            activeComponent = (FqFile_Component)input.FastqFile;
                            BuildFqFileMap(activeComponent);

                            FqFile_Component returnValue = caller.EndInvoke(out threadId, result);
                            toPerform.Enqueue(returnValue);
                        }
                        else if (toDeserialize.Count == 0)
                        {
                            Console.WriteLine("\n*** Processing: {0} ***\n", activeComponent.getFileName());
                            input.FastqFile = activeComponent;
                            input           = task.perform(input);
                            activeComponent = (FqFile_Component)input.FastqFile;
                            BuildFqFileMap(activeComponent);
                        }
                        toSerialize.Enqueue(activeComponent);
                        SerializeFqComponentToMemory();
                        count++;
                    }

                    SerializeRemainingFqComponents();
                    task.confirmTaskEnd();
                    Console.WriteLine("\n*********\n");
                    fqFileMap.CalculateGlobalFileScores();
                    fqFileMap.GlobalDetails.OutputToConsole();
                    loadWorker.ReportProgress(100, task.getReportStatement());

                    sw.Stop();
                    Console.WriteLine("Task: {0} Completed in Time: {1}", task.getStatement(), sw.Elapsed);

                    fqFileMap.LastTask  = input.TaskAction;
                    fqFileMap.TimeTaken = sw.Elapsed.ToString();
                    observer.UpdateGUIThread(input);
                }
                catch (IOException exception)
                {
                    ControllerStateFailureResponse(exception.ToString(), "Error");
                }
                catch (InsufficientMemoryException exception)
                {
                    ControllerStateFailureResponse(exception.ToString(), "Error");
                }
                catch (OutOfMemoryException exception)
                {
                    ControllerStateFailureResponse(exception.ToString(), "Error");
                }
                catch (ArithmeticException exception)
                {
                    ControllerStateFailureResponse(exception.ToString(), "Error");
                }
                sw.Stop();
            }
        }