public string GetTabSeparatedHeader() { var sb = new StringBuilder(); sb.Append("Protein Accession" + '\t'); sb.Append("Gene" + '\t'); sb.Append("Organism" + '\t'); sb.Append("Protein Full Name" + '\t'); sb.Append("Protein Unmodified Mass" + '\t'); sb.Append("Number of Proteins in Group" + '\t'); sb.Append("Unique Peptides" + '\t'); sb.Append("Shared Peptides" + '\t'); sb.Append("Number of Peptides" + '\t'); sb.Append("Number of Unique Peptides" + '\t'); sb.Append("Sequence Coverage Fraction" + '\t'); sb.Append("Sequence Coverage" + '\t'); sb.Append("Sequence Coverage with Mods" + '\t'); sb.Append("Modification Info List" + "\t"); if (FilesForQuantification != null) { bool unfractionated = FilesForQuantification.Select(p => p.Fraction).Distinct().Count() == 1; bool conditionsUndefined = FilesForQuantification.All(p => string.IsNullOrEmpty(p.Condition)); // this is a hacky way to test for SILAC-labeled data... // Currently SILAC will report 1 column of intensities per label per spectra file, and is NOT summarized // into biorep-level intensity values. the SILAC code uses the "condition" field to organize this info, // even if the experimental design is not defined by the user. So the following bool is a way to distinguish // between experimental design being used in SILAC automatically vs. being defined by the user bool silacExperimentalDesign = FilesForQuantification.Any(p => !File.Exists(p.FullFilePathWithExtension)); foreach (var sampleGroup in FilesForQuantification.GroupBy(p => p.Condition)) { foreach (var sample in sampleGroup.GroupBy(p => p.BiologicalReplicate).OrderBy(p => p.Key)) { if ((conditionsUndefined && unfractionated) || silacExperimentalDesign) { // if the data is unfractionated and the conditions haven't been defined, just use the file name as the intensity header sb.Append("Intensity_" + sample.First().FilenameWithoutExtension + "\t"); } else { // if the data is fractionated and/or the conditions have been defined, label the header w/ the condition and biorep number sb.Append("Intensity_" + sample.First().Condition + "_" + (sample.First().BiologicalReplicate + 1) + "\t"); } } } } sb.Append("Number of PSMs" + '\t'); sb.Append("Protein Decoy/Contaminant/Target" + '\t'); sb.Append("Protein Cumulative Target" + '\t'); sb.Append("Protein Cumulative Decoy" + '\t'); sb.Append("Protein QValue" + '\t'); sb.Append("Best Peptide Score" + '\t'); sb.Append("Best Peptide Notch QValue"); return(sb.ToString()); }
public string GetTabSeparatedHeader() { var sb = new StringBuilder(); sb.Append("Protein Accession" + '\t'); sb.Append("Gene" + '\t'); sb.Append("Organism" + '\t'); sb.Append("Protein Full Name" + '\t'); sb.Append("Protein Unmodified Mass" + '\t'); sb.Append("Number of Proteins in Group" + '\t'); sb.Append("Unique Peptides" + '\t'); sb.Append("Shared Peptides" + '\t'); sb.Append("Number of Peptides" + '\t'); sb.Append("Number of Unique Peptides" + '\t'); sb.Append("Sequence Coverage Fraction" + '\t'); sb.Append("Sequence Coverage" + '\t'); sb.Append("Sequence Coverage with Mods" + '\t'); sb.Append("Modification Info List" + "\t"); if (FilesForQuantification != null) { bool unfractionated = FilesForQuantification.Select(p => p.Fraction).Distinct().Count() == 1; bool conditionsDefined = FilesForQuantification.All(p => p.Condition == "Default") || FilesForQuantification.All(p => string.IsNullOrWhiteSpace(p.Condition)); foreach (var sampleGroup in FilesForQuantification.GroupBy(p => p.Condition)) { foreach (var sample in sampleGroup.GroupBy(p => p.BiologicalReplicate).OrderBy(p => p.Key)) { if (!conditionsDefined && unfractionated) { // if the data is unfractionated and the conditions haven't been defined, just use the file name as the intensity header sb.Append("Intensity_" + sample.First().FilenameWithoutExtension + "\t"); } else { // if the data is fractionated and/or the conditions have been defined, label the header w/ the condition and biorep number sb.Append("Intensity_" + sample.First().Condition + "_" + (sample.First().BiologicalReplicate + 1) + "\t"); } } } } sb.Append("Number of PSMs" + '\t'); sb.Append("Protein Decoy/Contaminant/Target" + '\t'); sb.Append("Protein Cumulative Target" + '\t'); sb.Append("Protein Cumulative Decoy" + '\t'); sb.Append("Protein QValue" + '\t'); sb.Append("Best Peptide Score" + '\t'); sb.Append("Best Peptide Notch QValue"); return(sb.ToString()); }