/// <summary> /// Perform both distribution and nucleotide tests on fqfile component /// </summary> public override void performJointTests() { Stopwatch stopwatch = new Stopwatch(); stopwatch.Start(); totalNucleotides(); resetCounts(); fillDistributionList(); int subZeroOffset = SequencerDiscriminator.getSequencerSpecifier(sequencerType).getSubZeroQualities(); Parallel.For(0, index, new ParallelOptions { MaxDegreeOfParallelism = (Preferences.getInstance().getCoresToUse()) }, // Initialize the local states () => new FqSequence_IO(sequencerType, "Sequence Tests", this), // Accumulate the thread-local computations in the loop body (i, loop, syncLists) => { for (int j = 0; j < fastqSeq[i].getFastqSeqSize(); j++) { char nucleotide = Fq_FILE_MAP[fastqSeq[i].getFastqSeqAtPosition(j)].getNucleotide(); if (nucleotide == 'N') { Interlocked.Increment(ref nCount); } else if (nucleotide == 'C') { Interlocked.Increment(ref cCount); } else if (nucleotide == 'G') { Interlocked.Increment(ref gCount); } int qualityScore = Fq_FILE_MAP[fastqSeq[i].getFastqSeqAtPosition(j)].getQualityScore(); int currentPop = syncLists.distributes[(qualityScore + subZeroOffset)]; syncLists.distributes[(qualityScore + subZeroOffset)] = (currentPop + 1); } return(syncLists); }, syncLists => { Object locker = new object(); lock (locker) { this.CombineDistributionLists(syncLists.distributes); } } ); nPercent = (((double)nCount / totalNucs) * 100); cPercent = (((double)cCount / totalNucs) * 100); gPercent = (((double)gCount / totalNucs) * 100); stopwatch.Stop(); Console.Write("Joint tests completed: " + stopwatch.Elapsed + "\n"); }
/// <summary> /// Performs a distribution test on the quality reads of the fastq file component /// </summary> /// <returns>A list that outlines the distribution of qualities within this file component</returns> public override List <int> performDistributionTest() { fillDistributionList(); int subZeroOffset = SequencerDiscriminator.getSequencerSpecifier(sequencerType).getSubZeroQualities(); Parallel.For(0, index, new ParallelOptions { MaxDegreeOfParallelism = (Preferences.getInstance().getCoresToUse()) }, // Initialize the local states () => new FqSequence_IO(sequencerType, "Sequence Tests", this), // Accumulate the thread-local computations in the loop body (i, loop, syncLists) => { for (int j = 0; i < fastqSeq[i].getFastqSeqSize(); j++) { int qualityScore = Fq_FILE_MAP[fastqSeq[i].getFastqSeqAtPosition(j)].getQualityScore(); int currentPop = syncLists.distributes[(qualityScore + subZeroOffset)]; syncLists.distributes[(qualityScore + subZeroOffset)] = (currentPop + 1); } return(syncLists); }, syncLists => { Object locker = new object(); lock (locker) { this.CombineDistributionLists(syncLists.distributes); } }); return(distribution); }
/// <summary> /// Cleans adapter sequences from seqeuences /// </summary> public override void cleanAdapters() { Stopwatch stopwatch = new Stopwatch(); stopwatch.Start(); Adapters.getInstance(); removedAdapters = new Dictionary <int, string>(); Parallel.For(0, index, new ParallelOptions { MaxDegreeOfParallelism = Preferences.getInstance().getCoresToUse() }, // Initialize the local states () => new FqSequence_IO(sequencerType, "Adapter Removal", this), // Accumulate the thread-local computations in the loop body (i, loop, adapters) => { adapters.removedAdapters = fastqSeq[i].cleanAdapters(adapters.adapters, Fq_FILE_MAP); return(adapters); }, adapters => { Object locker = new object(); lock (locker) { if (adapters.removedAdapters != null) { removedAdapters.Add(adapters.removedAdapters.SequenceIndex, adapters.removedAdapters.AdapterName); } } }); stopwatch.Stop(); Console.WriteLine("Statistics Performed in " + stopwatch.Elapsed); }
public SequencerDecisionTree(IFqFile aFastqFile) { ASSUMPTION_POINT = Preferences.getInstance().getAssumptionPref(); fastqFile = aFastqFile; index = fastqFile.getFastqArraySize(); map = fastqFile.getMap(); Console.WriteLine("Starting to search for sequencer"); DecisionTree(fastqFile); }
/// <summary> /// Prefered combined method for testing file, combines nucleotide, distribution and per base sequence statistics /// tests into one multi /// </summary> public override void Tests() { Stopwatch stopwatch = new Stopwatch(); stopwatch.Start(); object locker = new object(); totalNucleotides(); resetCounts(); fillDistributionList(); fillSequenceLengthDistributionList(); BuildPerSequenceStatisticsList(); Parallel.For(0, index, new ParallelOptions { MaxDegreeOfParallelism = (Preferences.getInstance().getCoresToUse()) }, // Initialize the local states () => new FqSequence_IO(sequencerType, "Sequence Tests", this), // Accumulate the thread-local computations in the loop body (i, loop, syncLists) => { syncLists = fastqSeq[i].Tests(Fq_FILE_MAP, syncLists); Interlocked.Add(ref cCount, syncLists.cCount); Interlocked.Add(ref gCount, syncLists.gCount); Interlocked.Add(ref nCount, syncLists.nCount); lock (locker) this.CombinePerBaseStatisticsLists(syncLists.perSeqQuals, syncLists.sequenceLength); return(syncLists); }, syncLists => { lock (locker) this.CombineDistributionLists(syncLists.distributes); } ); int count = 0; for (int i = (maxSeqSize - 1); i >= 0; i--) { int numAtLength = perBaseStatistics[i].GetPerBaseCount(); sequenceLengthDistribution[i] += (numAtLength - count); count += (numAtLength - count); perBaseStatistics[i].reconcileBaseSatistics(); } nPercent = (((double)nCount / totalNucs) * 100); cPercent = (((double)cCount / totalNucs) * 100); gPercent = (((double)gCount / totalNucs) * 100); stopwatch.Stop(); Console.Write("TESTS completed: " + stopwatch.Elapsed + "\n"); }
public override GenericFastqInputs perform(GenericFastqInputs inputs) { if (Preferences.getInstance().getSeqDecisionMethod()) { SequencerDetermination seqDetermine = new SequencerDetermination(inputs.FastqFile); } else if (!Preferences.getInstance().getSeqDecisionMethod()) { SequencerDecisionTree decTree = new SequencerDecisionTree(inputs.FastqFile); } return(inputs); }
/// <summary> /// Performs tests on the nucleotides contained within this file component /// </summary> public override void performNucleotideTests() { Stopwatch stopwatch = new Stopwatch(); stopwatch.Start(); totalNucleotides(); resetCounts(); Parallel.For(0, index, new ParallelOptions { MaxDegreeOfParallelism = (Preferences.getInstance().getCoresToUse()) }, // Initialize the local states () => new System.Collections.Concurrent.BlockingCollection <int>(), // Accumulate the thread-local computations in the loop body (i, loop, misRead) => { for (int j = 0; j < fastqSeq[i].getFastqSeqSize(); j++) { char nucleotide = Fq_FILE_MAP[fastqSeq[i].getFastqSeqAtPosition(j)].getNucleotide(); if (nucleotide == 'N') { Interlocked.Increment(ref nCount); } else if (nucleotide == 'C') { Interlocked.Increment(ref cCount); } else if (nucleotide == 'G') { Interlocked.Increment(ref gCount); } } return(misRead); }, misRead => { Object locker = new object(); lock (locker) { } } ); nPercent = (((double)nCount / totalNucs) * 100); cPercent = (((double)cCount / totalNucs) * 100); gPercent = (((double)gCount / totalNucs) * 100); stopwatch.Stop(); Console.Write("Nucleotide tests completed: " + stopwatch.Elapsed + "\n"); }
public PreferencesGUI() { InitializeComponent(); current_Preferences = Preferences.getInstance(); }
/// <summary> /// Changes the preferences item for the Single Core processing method /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Multi_Core_Radio_CheckedChanged(object sender, EventArgs e) { Preferences.getInstance().setMultiCoreProcessing(); }
/// <summary> /// Changes the preferences item for the Decision Tree sequencer determination method /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Decision_Tree_Radio_CheckedChanged(object sender, EventArgs e) { Preferences.getInstance().setSeqDecisionMethod(false); }
/// <summary> /// Changes the preferences item for the Clean Sweep sequencer determination method /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Clean_Sweep_Radio_CheckedChanged(object sender, EventArgs e) { Preferences.getInstance().setSeqDecisionMethod(true); }