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); }
private void SaveFastqAction(IFqFile fq, String fileName) { StreamWriter writer; try { writer = new StreamWriter(@fileName); saveWorker.ReportProgress(40, "[CREATING FASTQ FORMAT]"); for (int i = 0; i < fqFile.getFastqArraySize(); i++) { writer.Write(fqFile.getFastqSequenceByPosition(i).createFastqBlock(fqFile.getMap())); } saveWorker.ReportProgress(100, "[FASTQ FORMAT CREATED]"); writer.Flush(); writer.Close(); } catch (IOException exception) { Console.WriteLine(exception.ToString()); UserResponse.ErrorResponse(exception.ToString()); } }
/* * end point */ private void end(int endPoint) { int i = endPoint; stopwatch.Stop(); fastqFile.setSequencerType(sequencerType); if (fastqFile is FqFile_Component) { fastqFile.setFqHashMap(FastqController.getInstance().GetFqFileMap().ConstructSequencerSpecificReadMap(sequencerType)); Console.WriteLine("Calculating and setting sequencer specific file map to component"); } Console.WriteLine("Time To Determine ISequencer: " + stopwatch.Elapsed); Console.WriteLine("ISequencer Name: " + sequencerType); Console.WriteLine("File contains {0} sequences", fastqFile.getFastqArraySize()); }
public override GenericFastqInputs perform(GenericFastqInputs inputs) { StreamWriter writer; String extension = Path.GetExtension(inputs.SaveFileName); String fileName = Path.GetFileNameWithoutExtension(inputs.SaveFileName); String[] part = Path.GetFileNameWithoutExtension(inputs.FastqFile.getFileName()).Split('_'); String directory = Path.GetDirectoryName(inputs.SaveFileName); String number = part[part.Length - 1]; String FullName = String.Format(@"{0}{1}{2}_{3}{4}", directory, Path.DirectorySeparatorChar, fileName, number, extension); string COMMA_DELIMITER = ","; string[] output; IFqFile fqFile = inputs.FastqFile; writer = new StreamWriter(FullName); output = new string[] { "Sequence Index", "Header", "Total Nucleotides", "G Count", "C Count", "Misread Count", "Lower Threshold", "First Quartile", "Median", "Mean", "Third Quartile", "Upper Threshold" }; writer.WriteLine(string.Join(COMMA_DELIMITER, output)); for (int i = 0; i < fqFile.getFastqArraySize(); i++) { FqSequence fqSeq = fqFile.getFastqSequenceByPosition(i); output = new string[] { fqSeq.getSeqIndex().ToString(), fqSeq.getSequenceHeader(), fqSeq.getFastqSeqSize().ToString(), fqSeq.getGCount().ToString(), fqSeq.getCCount().ToString(), fqSeq.getNCount().ToString(), fqSeq.getLowerThreshold().ToString(), fqSeq.getFirstQuartile().ToString(), fqSeq.getMedian().ToString(), fqSeq.getMean().ToString(), fqSeq.getThirdQuartile().ToString(), fqSeq.getUpperThreshold().ToString(), fqSeq.createSequenceString(fqFile.getMap()) }; writer.WriteLine(string.Join(COMMA_DELIMITER, output)); } Console.WriteLine("Saving CSV TO: {0}", FullName); writer.Flush(); writer.Close(); return(inputs); }
public void ContructComponentDetails(IFqFile component) { this.ComponentName = component.getFileName(); this.FileName = component.getFileName(); this.sequencerType = component.getSequencerType(); this.ComponentNumber = component.getComponentNumber(); this.TotalNucs = component.getTotalNucleotides(); this.TotalSequences = component.getFastqArraySize(); this.NucleotidesCleaned = component.getNucleotidesCleaned(); this.Distribution = component.getDistribution(); this.SequenceLengthDistribution = component.getSequenceLengthDistribution(); this.NCount = component.getNCount(); this.CCount = component.getCCount(); this.GCount = component.getGCount(); this.MaxSeqSize = component.getMaxSeqSize(); this.MinSeqSize = component.getMinSeqSize(); this.NPercent = component.nContents(); this.CPercent = component.cContents(); this.GPercent = component.gContents(); this.SequencesRemoved = component.getSequencesRemoved(); this.RemovedAdapters = component.getRemovedAdapters(); this.perBaseStatistics = component.GetPerBaseStatisticsArray(); }
private void sequencer(IFqFile fastqFile) { String sequencer = null; Boolean completed = false; Boolean sangerLowerBoundary = false, sangerUpperBoundary = false, solexaLowerBoundary = false, sharedUpperBoundary = false, illuminaThreeLowerBoundary = false, illuminaFiveLowerBoundary = false, illuminaEightLowerBoundary = false, illuminaNineLowerBoundary = false, illuminaEightNineUpperBoundary = false; // char variables for the upper and lower boundaries of the sequencer types char sangerLower = '!'; char sangerUpper = 'I'; char solexaLower = ';'; char solilmixedUpper = 'h'; char illuminathreeLower = '@'; char illuminafiveLower = 'B'; char illuminaeightLower = '!'; char illuminanineLower = '#'; char illuminamixedUpper = 'J'; Stopwatch stopwatch = new Stopwatch(); stopwatch.Start(); while (completed != true) { for (int i = 0; i < fastqFile.getFastqArraySize();i++) { FqSequence fqSeq = fastqFile.getFastqSequenceByPosition(i); for (int j = 0; j < fqSeq.getFastqSeqSize(); j++) { char qualityValue = map[fqSeq.getFastqSeqAtPosition(j)].getQualityRead(); if (qualityValue == sangerLower) sangerLowerBoundary = true; else if (qualityValue == sangerUpper) sangerUpperBoundary = true; else if (qualityValue == solexaLower) solexaLowerBoundary = true; else if (qualityValue == solilmixedUpper) sharedUpperBoundary = true; else if (qualityValue == illuminathreeLower)illuminaThreeLowerBoundary = true; else if (qualityValue == illuminafiveLower) illuminaFiveLowerBoundary = true; else if (qualityValue == illuminaeightLower)illuminaEightLowerBoundary = true; else if (qualityValue == illuminanineLower) illuminaNineLowerBoundary = true; else if (qualityValue == illuminamixedUpper)illuminaEightNineUpperBoundary = true; } } if (sangerLowerBoundary != false && sangerUpperBoundary != false && illuminaEightNineUpperBoundary != true) { sequencer = "Sanger"; completed = true; } else if (solexaLowerBoundary != false && sharedUpperBoundary != false) { sequencer = "Solexa"; completed = true; } else if (illuminaThreeLowerBoundary != false && sharedUpperBoundary != false && solexaLowerBoundary != true) { sequencer = "Illumina 1.3"; completed = true; } else if (illuminaFiveLowerBoundary != false && sharedUpperBoundary != false && illuminaThreeLowerBoundary != true) { sequencer = "Illumina 1.5"; completed = true; } else if (illuminaEightLowerBoundary != false && illuminaEightNineUpperBoundary != false) { sequencer = "Illumina 1.8"; completed = true; } else if (illuminaNineLowerBoundary != false && illuminaEightNineUpperBoundary != false && illuminaEightLowerBoundary != true) { sequencer = "Illumina 1.9"; completed = true; } else if (completed != true) { sequencer = "Default"; completed = true; } else if ((sequencer == null)) { sequencer = "Default"; completed = true; } } this.sequencerType = sequencer; fastqFile.setSequencerType(sequencerType); if (fastqFile is FqFile_Component) { fastqFile.setFqHashMap(FastqController.getInstance().GetFqFileMap().ConstructSequencerSpecificReadMap(sequencerType)); Console.WriteLine("Calculating and setting sequencer specific file map to component"); } stopwatch.Stop(); Console.WriteLine("Time To Determine ISequencer: " + stopwatch.Elapsed); Console.WriteLine("ISequencer Name: " + sequencer); Console.WriteLine("File contains {0} sequences", fastqFile.getFastqArraySize()); }
private void sequencer(IFqFile fastqFile) { String sequencer = null; Boolean completed = false; Boolean sangerLowerBoundary = false, sangerUpperBoundary = false, solexaLowerBoundary = false, sharedUpperBoundary = false, illuminaThreeLowerBoundary = false, illuminaFiveLowerBoundary = false, illuminaEightLowerBoundary = false, illuminaNineLowerBoundary = false, illuminaEightNineUpperBoundary = false; // char variables for the upper and lower boundaries of the sequencer types char sangerLower = '!'; char sangerUpper = 'I'; char solexaLower = ';'; char solilmixedUpper = 'h'; char illuminathreeLower = '@'; char illuminafiveLower = 'B'; char illuminaeightLower = '!'; char illuminanineLower = '#'; char illuminamixedUpper = 'J'; Stopwatch stopwatch = new Stopwatch(); stopwatch.Start(); while (completed != true) { for (int i = 0; i < fastqFile.getFastqArraySize(); i++) { FqSequence fqSeq = fastqFile.getFastqSequenceByPosition(i); for (int j = 0; j < fqSeq.getFastqSeqSize(); j++) { char qualityValue = map[fqSeq.getFastqSeqAtPosition(j)].getQualityRead(); if (qualityValue == sangerLower) { sangerLowerBoundary = true; } else if (qualityValue == sangerUpper) { sangerUpperBoundary = true; } else if (qualityValue == solexaLower) { solexaLowerBoundary = true; } else if (qualityValue == solilmixedUpper) { sharedUpperBoundary = true; } else if (qualityValue == illuminathreeLower) { illuminaThreeLowerBoundary = true; } else if (qualityValue == illuminafiveLower) { illuminaFiveLowerBoundary = true; } else if (qualityValue == illuminaeightLower) { illuminaEightLowerBoundary = true; } else if (qualityValue == illuminanineLower) { illuminaNineLowerBoundary = true; } else if (qualityValue == illuminamixedUpper) { illuminaEightNineUpperBoundary = true; } } } if (sangerLowerBoundary != false && sangerUpperBoundary != false && illuminaEightNineUpperBoundary != true) { sequencer = "Sanger"; completed = true; } else if (solexaLowerBoundary != false && sharedUpperBoundary != false) { sequencer = "Solexa"; completed = true; } else if (illuminaThreeLowerBoundary != false && sharedUpperBoundary != false && solexaLowerBoundary != true) { sequencer = "Illumina 1.3"; completed = true; } else if (illuminaFiveLowerBoundary != false && sharedUpperBoundary != false && illuminaThreeLowerBoundary != true) { sequencer = "Illumina 1.5"; completed = true; } else if (illuminaEightLowerBoundary != false && illuminaEightNineUpperBoundary != false) { sequencer = "Illumina 1.8"; completed = true; } else if (illuminaNineLowerBoundary != false && illuminaEightNineUpperBoundary != false && illuminaEightLowerBoundary != true) { sequencer = "Illumina 1.9"; completed = true; } else if (completed != true) { sequencer = "Default"; completed = true; } else if ((sequencer == null)) { sequencer = "Default"; completed = true; } } this.sequencerType = sequencer; fastqFile.setSequencerType(sequencerType); if (fastqFile is FqFile_Component) { fastqFile.setFqHashMap(FastqController.getInstance().GetFqFileMap().ConstructSequencerSpecificReadMap(sequencerType)); Console.WriteLine("Calculating and setting sequencer specific file map to component"); } stopwatch.Stop(); Console.WriteLine("Time To Determine ISequencer: " + stopwatch.Elapsed); Console.WriteLine("ISequencer Name: " + sequencer); Console.WriteLine("File contains {0} sequences", fastqFile.getFastqArraySize()); }