Пример #1
0
 public void deepCopyFoundIons(FusionCandidate original)
 {
     this.foundIons = new bool[original.foundIons.Length];
     for (int index = 0; index < this.foundIons.Length; index++)
     {
         this.foundIons[index] = original.foundIons[index];
     }
 }
Пример #2
0
        public static void ExportCandidates(List <NeoPsm> psms, Ms2ScanWithSpecificMass[] spectra, string path, CommonParameters commonParameters)
        {
            using (StreamWriter file = new StreamWriter(path + folder + @"\" + folder + "ExportedFusionCandidatesAll.txt"))
            {
                file.WriteLine("Scan" + '\t' + "ExperimentalMass" + '\t' + "OriginalNSequence" + '\t' + "OriginalNScore" + '\t' + "OriginalCSequence" + '\t' + "OriginalCScore" + '\t' + "SampleSequence" + '\t' + "Ambiguity" + '\t' + "ProbableType" + '\t' + "MostProbableSequenceJunctions" + '\t' + "MostProbableSequence(s)" + '\t' + "MostProbableParents" + '\t' + "AllPossibleSequenceJunctions" + '\t' + "AllPossibleSequence(s)" + '\t' + "AllPossibleParent(s)" + '\t' + "NumberOfPossibleSequences" + '\t' + "PotentialFalsePositives" + '\t' + "TotalScore");

                //double progress = 0;
                Parallel.ForEach(psms, new ParallelOptions {
                    MaxDegreeOfParallelism = commonParameters.MaxThreadsToUsePerFile
                }, (psm) =>
                {
                    Ms2ScanWithSpecificMass spectrum = spectra[psm.scanNumber];
                    //printout the scan, the mass, the sequences with and without junctions, the number of potential sequences
                    string allPossibleSequences             = "";
                    string mostProbableSequences            = "";
                    int indexOfFirstProbableSequence        = -1;
                    string mostProbableParents              = "";
                    string allPossibleParents               = "";
                    FusionCandidate.FusionType probableType = psm.fusionType;
                    for (int fc = 0; fc < psm.candidates.Count(); fc++)
                    {
                        FusionCandidate fusionCandidate = psm.candidates[fc]; //need fc for indexOfFirstProbableSequence
                        char[] tempArray = fusionCandidate.seq.ToCharArray();
                        //if most probable, add to all and most
                        if (fusionCandidate.fusionType.Equals(probableType))
                        {
                            //record sequences
                            if (indexOfFirstProbableSequence < 0)
                            {
                                indexOfFirstProbableSequence = fc;
                            }
                            for (int i = 0; i < tempArray.Count(); i++)
                            {
                                mostProbableSequences += tempArray[i];
                                allPossibleSequences  += tempArray[i];
                                foreach (int junction in fusionCandidate.junctionIndexes)
                                {
                                    if (junction == i)
                                    {
                                        mostProbableSequences += "-";
                                        allPossibleSequences  += "-";
                                    }
                                }
                            }
                            mostProbableSequences += "|";
                            allPossibleSequences  += "|";

                            //record parents
                            string tempParents = "";
                            //switch (probableType)
                            //{
                            //    case FusionCandidate.FusionType.TL:
                            //        if (fusionCandidate.translatedParents.Count == 0)
                            //            throw new Exception();
                            //        tempParents += GenerateParentOutput(fusionCandidate.translatedParents, new List<CisParent>(), new List<TransParent>());
                            //        break;

                            //    case FusionCandidate.FusionType.NC:
                            //    case FusionCandidate.FusionType.RC:
                            //        if (fusionCandidate.cisParents.Count == 0)
                            //            throw new Exception();
                            //        tempParents += GenerateParentOutput(new List<TranslatedParent>(), fusionCandidate.cisParents, new List<TransParent>());
                            //        break;

                            //    default: //if trans
                            //        if (fusionCandidate.transParents.Count == 0)
                            //            throw new Exception();
                            //        tempParents += GenerateParentOutput(new List<TranslatedParent>(), new List<CisParent>(), fusionCandidate.transParents);
                            //        break;
                            //}
                            mostProbableParents += tempParents;
                            allPossibleParents  += tempParents;
                        }
                        else //not most probable, only add it to allPossibleSequences
                        {
                            //record sequences
                            for (int i = 0; i < tempArray.Count(); i++)
                            {
                                allPossibleSequences += tempArray[i];
                                if (fusionCandidate.junctionIndexes.Contains(i))
                                {
                                    allPossibleSequences += "-";
                                }
                            }
                            allPossibleSequences += "|";
                            //record parents
                            //UNCOMMENT   allPossibleParents += GenerateParentOutput(fusionCandidate.translatedParents, fusionCandidate.cisParents, fusionCandidate.transParents);
                        }

                        /*        foreach(ParentInfo PI in fusionCandidate.parentInfo)
                         *      {
                         *          parents += PI.accession + "_" + PI.parentType.ToString() + "_" + PI.seqFound + "|";
                         *      }*/
                    }

                    allPossibleSequences  = allPossibleSequences.Substring(0, allPossibleSequences.Length - 1);   //remove last "|"
                    mostProbableSequences = mostProbableSequences.Substring(0, mostProbableSequences.Length - 1); //remove last "|"

                    string ambiguity = "";
                    NeoFindAmbiguity.FindIons(psm.candidates[indexOfFirstProbableSequence], psm, spectrum); //this should be carried over, but it's not...
                                                                                                            //      mutableError_message += e;
                    bool[] foundIons = psm.candidates[indexOfFirstProbableSequence].foundIons;
                    char[] firstSeq  = psm.candidates[indexOfFirstProbableSequence].seq.ToCharArray();
                    //   if(foundIons.Count()==firstSeq.Count()) //prevent crashing if something went wrong
                    // {
                    bool ambiguous = false;
                    for (int i = 1; i < foundIons.Length; i++)
                    {
                        if (foundIons[i])                 //if found
                        {
                            ambiguity += firstSeq[i - 1]; //add aa
                            if (ambiguous)                //if it is part of an ambiguous sequence
                            {
                                ambiguity += ")";
                                ambiguous  = false; //no longer ambiguous
                            }
                        }
                        else
                        {
                            if (!ambiguous)
                            {
                                ambiguous  = true;
                                ambiguity += "(";
                            }
                            ambiguity += firstSeq[i - 1];
                        }
                    }
                    ambiguity += firstSeq[foundIons.Length - 1];
                    if (ambiguous)
                    {
                        ambiguity += ")";
                    }
                    string potentialFalsePositives = "";
                    //foreach (Variant v in psm.variants)
                    //{
                    //    potentialFalsePositives += v.id + "_" + v.start + "-" + (v.start + v.peptideLength - 1) + "(" + v.pepSeq + ")" + v.varType + "|";
                    //}
                    if (potentialFalsePositives.Length > 0)
                    {
                        potentialFalsePositives = potentialFalsePositives.Substring(0, potentialFalsePositives.Length - 1); //remove last |
                        if (potentialFalsePositives.Length > 30000)
                        {
                            potentialFalsePositives = potentialFalsePositives.Substring(0, 30000);
                        }
                    }
                    //workarounds for excel. Actual limit is 32767, but that doesn't seem to work
                    if (mostProbableParents.Length > 30000)
                    {
                        mostProbableParents = mostProbableParents.Substring(0, 30000);
                    }
                    if (allPossibleParents.Length > 30000)
                    {
                        allPossibleParents = allPossibleParents.Substring(0, 30000);
                    }
                    int score = 0;
                    foreach (bool b in psm.candidates[indexOfFirstProbableSequence].foundIons)
                    {
                        if (b)
                        {
                            score++;
                        }
                    }
                    lock (file)
                    {
                        file.WriteLine(psm.scanNumber.ToString() + '\t' + psm.expMass.ToString() + '\t' + psm.nInfo.seq + '\t' + psm.nInfo.score + '\t' + psm.cInfo.seq + '\t' + psm.cInfo.score + '\t' + psm.candidates[indexOfFirstProbableSequence].seq + '\t' + ambiguity + '\t' + psm.fusionType.ToString() + '\t' + mostProbableSequences + '\t' + mostProbableSequences.Replace("-", "") + '\t' + mostProbableParents + '\t' + allPossibleSequences + '\t' + allPossibleSequences.Replace("-", "") + '\t' + allPossibleParents + '\t' + psm.candidates.Count().ToString() + '\t' + potentialFalsePositives + '\t' + score);
                        //progress++;
                        //this.worker.ReportProgress((int)(progress / psms.Count() * 100));
                    }
                });
            }

            using (StreamWriter file = new StreamWriter(path + folder + @"\" + folder + "ExportedFusionCandidatesTL.txt"))
            {
                file.WriteLine("Scan" + '\t' + "ExperimentalMass" + '\t' + "OriginalNSequence" + '\t' + "OriginalNScore" + '\t' + "OriginalCSequence" + '\t' + "OriginalCScore" + '\t' + "SampleSequence" + '\t' + "Ambiguity" + '\t' + "ProbableType" + '\t' + "MostProbableSequenceJunctions" + '\t' + "MostProbableSequence(s)" + '\t' + "MostProbableParents" + '\t' + "AllPossibleSequenceJunctions" + '\t' + "AllPossibleSequence(s)" + '\t' + "AllPossibleParent(s)" + '\t' + "NumberOfPossibleSequences" + '\t' + "PotentialFalsePositives" + '\t' + "TotalScore");

                Parallel.ForEach(psms, new ParallelOptions {
                    MaxDegreeOfParallelism = commonParameters.MaxThreadsToUsePerFile
                }, (psm) =>
                {
                    if (psm.candidates.Any(x => x.fusionType == FusionCandidate.FusionType.TL))
                    {
                        Ms2ScanWithSpecificMass spectrum = spectra[psm.scanNumber];
                        //printout the scan, the mass, the sequences with and without junctions, the number of potential sequences
                        string allPossibleSequences             = "";
                        string mostProbableSequences            = "";
                        int indexOfFirstProbableSequence        = -1;
                        string mostProbableParents              = "";
                        string allPossibleParents               = "";
                        FusionCandidate.FusionType probableType = psm.fusionType;
                        for (int fc = 0; fc < psm.candidates.Count(); fc++)
                        {
                            FusionCandidate fusionCandidate = psm.candidates[fc]; //need fc for indexOfFirstProbableSequence
                            if (fusionCandidate.fusionType != FusionCandidate.FusionType.TL)
                            {
                                continue;
                            }
                            char[] tempArray = fusionCandidate.seq.ToCharArray();
                            //if most probable, add to all and most

                            //record sequences
                            if (indexOfFirstProbableSequence < 0)
                            {
                                indexOfFirstProbableSequence = fc;
                            }
                            for (int i = 0; i < tempArray.Count(); i++)
                            {
                                mostProbableSequences += tempArray[i];
                                allPossibleSequences  += tempArray[i];
                                foreach (int junction in fusionCandidate.junctionIndexes)
                                {
                                    if (junction == i)
                                    {
                                        mostProbableSequences += "-";
                                        allPossibleSequences  += "-";
                                    }
                                }
                            }
                            mostProbableSequences += "|";
                            allPossibleSequences  += "|";

                            //record parents
                            string tempParents = "";

                            mostProbableParents += tempParents;
                            allPossibleParents  += tempParents;
                        }

                        allPossibleSequences  = allPossibleSequences.Substring(0, allPossibleSequences.Length - 1);   //remove last "|"
                        mostProbableSequences = mostProbableSequences.Substring(0, mostProbableSequences.Length - 1); //remove last "|"

                        string ambiguity = "";
                        NeoFindAmbiguity.FindIons(psm.candidates[indexOfFirstProbableSequence], psm, spectrum); //this should be carried over, but it's not...
                                                                                                                //      mutableError_message += e;
                        bool[] foundIons = psm.candidates[indexOfFirstProbableSequence].foundIons;
                        char[] firstSeq  = psm.candidates[indexOfFirstProbableSequence].seq.ToCharArray();

                        bool ambiguous = false;
                        for (int i = 1; i < foundIons.Length; i++)
                        {
                            if (foundIons[i])                 //if found
                            {
                                ambiguity += firstSeq[i - 1]; //add aa
                                if (ambiguous)                //if it is part of an ambiguous sequence
                                {
                                    ambiguity += ")";
                                    ambiguous  = false; //no longer ambiguous
                                }
                            }
                            else
                            {
                                if (!ambiguous)
                                {
                                    ambiguous  = true;
                                    ambiguity += "(";
                                }
                                ambiguity += firstSeq[i - 1];
                            }
                        }
                        ambiguity += firstSeq[foundIons.Length - 1];
                        if (ambiguous)
                        {
                            ambiguity += ")";
                        }
                        string potentialFalsePositives = "";

                        if (potentialFalsePositives.Length > 0)
                        {
                            potentialFalsePositives = potentialFalsePositives.Substring(0, potentialFalsePositives.Length - 1); //remove last |
                            if (potentialFalsePositives.Length > 30000)
                            {
                                potentialFalsePositives = potentialFalsePositives.Substring(0, 30000);
                            }
                        }
                        //workarounds for excel. Actual limit is 32767, but that doesn't seem to work
                        if (mostProbableParents.Length > 30000)
                        {
                            mostProbableParents = mostProbableParents.Substring(0, 30000);
                        }
                        if (allPossibleParents.Length > 30000)
                        {
                            allPossibleParents = allPossibleParents.Substring(0, 30000);
                        }
                        int score = 0;
                        foreach (bool b in psm.candidates[indexOfFirstProbableSequence].foundIons)
                        {
                            if (b)
                            {
                                score++;
                            }
                        }
                        lock (file)
                        {
                            file.WriteLine(psm.scanNumber.ToString() + '\t' + psm.expMass.ToString() + '\t' + psm.nInfo.seq + '\t' + psm.nInfo.score + '\t' + psm.cInfo.seq + '\t' + psm.cInfo.score + '\t' + psm.candidates[indexOfFirstProbableSequence].seq + '\t' + ambiguity + '\t' + psm.fusionType.ToString() + '\t' + mostProbableSequences + '\t' + mostProbableSequences.Replace("-", "") + '\t' + mostProbableParents + '\t' + allPossibleSequences + '\t' + allPossibleSequences.Replace("-", "") + '\t' + allPossibleParents + '\t' + psm.candidates.Count().ToString() + '\t' + potentialFalsePositives + '\t' + score);
                            //progress++;
                            //this.worker.ReportProgress((int)(progress / psms.Count() * 100));
                        }
                    }
                });
            }

            using (StreamWriter file = new StreamWriter(path + folder + @"\" + folder + "ExportedFusionCandidatesNC.txt"))
            {
                file.WriteLine("Scan" + '\t' + "ExperimentalMass" + '\t' + "OriginalNSequence" + '\t' + "OriginalNScore" + '\t' + "OriginalCSequence" + '\t' + "OriginalCScore" + '\t' + "SampleSequence" + '\t' + "Ambiguity" + '\t' + "ProbableType" + '\t' + "MostProbableSequenceJunctions" + '\t' + "MostProbableSequence(s)" + '\t' + "MostProbableParents" + '\t' + "AllPossibleSequenceJunctions" + '\t' + "AllPossibleSequence(s)" + '\t' + "AllPossibleParent(s)" + '\t' + "NumberOfPossibleSequences" + '\t' + "PotentialFalsePositives" + '\t' + "TotalScore");

                Parallel.ForEach(psms, new ParallelOptions {
                    MaxDegreeOfParallelism = commonParameters.MaxThreadsToUsePerFile
                }, (psm) =>
                {
                    if (psm.candidates.Any(x => x.fusionType == FusionCandidate.FusionType.NC))
                    {
                        Ms2ScanWithSpecificMass spectrum = spectra[psm.scanNumber];
                        //printout the scan, the mass, the sequences with and without junctions, the number of potential sequences
                        string allPossibleSequences             = "";
                        string mostProbableSequences            = "";
                        int indexOfFirstProbableSequence        = -1;
                        string mostProbableParents              = "";
                        string allPossibleParents               = "";
                        FusionCandidate.FusionType probableType = psm.fusionType;
                        for (int fc = 0; fc < psm.candidates.Count(); fc++)
                        {
                            FusionCandidate fusionCandidate = psm.candidates[fc]; //need fc for indexOfFirstProbableSequence
                            if (fusionCandidate.fusionType != FusionCandidate.FusionType.NC)
                            {
                                continue;
                            }
                            char[] tempArray = fusionCandidate.seq.ToCharArray();
                            //if most probable, add to all and most

                            //record sequences
                            if (indexOfFirstProbableSequence < 0)
                            {
                                indexOfFirstProbableSequence = fc;
                            }
                            for (int i = 0; i < tempArray.Count(); i++)
                            {
                                mostProbableSequences += tempArray[i];
                                allPossibleSequences  += tempArray[i];
                                foreach (int junction in fusionCandidate.junctionIndexes)
                                {
                                    if (junction == i)
                                    {
                                        mostProbableSequences += "-";
                                        allPossibleSequences  += "-";
                                    }
                                }
                            }
                            mostProbableSequences += "|";
                            allPossibleSequences  += "|";

                            //record parents
                            string tempParents = "";

                            mostProbableParents += tempParents;
                            allPossibleParents  += tempParents;
                        }

                        allPossibleSequences  = allPossibleSequences.Substring(0, allPossibleSequences.Length - 1);   //remove last "|"
                        mostProbableSequences = mostProbableSequences.Substring(0, mostProbableSequences.Length - 1); //remove last "|"

                        string ambiguity = "";
                        NeoFindAmbiguity.FindIons(psm.candidates[indexOfFirstProbableSequence], psm, spectrum); //this should be carried over, but it's not...
                                                                                                                //      mutableError_message += e;
                        bool[] foundIons = psm.candidates[indexOfFirstProbableSequence].foundIons;
                        char[] firstSeq  = psm.candidates[indexOfFirstProbableSequence].seq.ToCharArray();

                        bool ambiguous = false;
                        for (int i = 1; i < foundIons.Length; i++)
                        {
                            if (foundIons[i])                 //if found
                            {
                                ambiguity += firstSeq[i - 1]; //add aa
                                if (ambiguous)                //if it is part of an ambiguous sequence
                                {
                                    ambiguity += ")";
                                    ambiguous  = false; //no longer ambiguous
                                }
                            }
                            else
                            {
                                if (!ambiguous)
                                {
                                    ambiguous  = true;
                                    ambiguity += "(";
                                }
                                ambiguity += firstSeq[i - 1];
                            }
                        }
                        ambiguity += firstSeq[foundIons.Length - 1];
                        if (ambiguous)
                        {
                            ambiguity += ")";
                        }
                        string potentialFalsePositives = "";

                        if (potentialFalsePositives.Length > 0)
                        {
                            potentialFalsePositives = potentialFalsePositives.Substring(0, potentialFalsePositives.Length - 1); //remove last |
                            if (potentialFalsePositives.Length > 30000)
                            {
                                potentialFalsePositives = potentialFalsePositives.Substring(0, 30000);
                            }
                        }
                        //workarounds for excel. Actual limit is 32767, but that doesn't seem to work
                        if (mostProbableParents.Length > 30000)
                        {
                            mostProbableParents = mostProbableParents.Substring(0, 30000);
                        }
                        if (allPossibleParents.Length > 30000)
                        {
                            allPossibleParents = allPossibleParents.Substring(0, 30000);
                        }
                        int score = 0;
                        foreach (bool b in psm.candidates[indexOfFirstProbableSequence].foundIons)
                        {
                            if (b)
                            {
                                score++;
                            }
                        }
                        lock (file)
                        {
                            file.WriteLine(psm.scanNumber.ToString() + '\t' + psm.expMass.ToString() + '\t' + psm.nInfo.seq + '\t' + psm.nInfo.score + '\t' + psm.cInfo.seq + '\t' + psm.cInfo.score + '\t' + psm.candidates[indexOfFirstProbableSequence].seq + '\t' + ambiguity + '\t' + psm.fusionType.ToString() + '\t' + mostProbableSequences + '\t' + mostProbableSequences.Replace("-", "") + '\t' + mostProbableParents + '\t' + allPossibleSequences + '\t' + allPossibleSequences.Replace("-", "") + '\t' + allPossibleParents + '\t' + psm.candidates.Count().ToString() + '\t' + potentialFalsePositives + '\t' + score);
                            //progress++;
                            //this.worker.ReportProgress((int)(progress / psms.Count() * 100));
                        }
                    }
                });
            }

            using (StreamWriter file = new StreamWriter(path + folder + @"\" + folder + "ExportedFusionCandidatesTS.txt"))
            {
                file.WriteLine("Scan" + '\t' + "ExperimentalMass" + '\t' + "OriginalNSequence" + '\t' + "OriginalNScore" + '\t' + "OriginalCSequence" + '\t' + "OriginalCScore" + '\t' + "SampleSequence" + '\t' + "Ambiguity" + '\t' + "ProbableType" + '\t' + "MostProbableSequenceJunctions" + '\t' + "MostProbableSequence(s)" + '\t' + "MostProbableParents" + '\t' + "AllPossibleSequenceJunctions" + '\t' + "AllPossibleSequence(s)" + '\t' + "AllPossibleParent(s)" + '\t' + "NumberOfPossibleSequences" + '\t' + "PotentialFalsePositives" + '\t' + "TotalScore");

                Parallel.ForEach(psms, new ParallelOptions {
                    MaxDegreeOfParallelism = commonParameters.MaxThreadsToUsePerFile
                }, (psm) =>
                {
                    if (psm.candidates.Any(x => x.fusionType == FusionCandidate.FusionType.TS))
                    {
                        Ms2ScanWithSpecificMass spectrum = spectra[psm.scanNumber];
                        //printout the scan, the mass, the sequences with and without junctions, the number of potential sequences
                        string allPossibleSequences             = "";
                        string mostProbableSequences            = "";
                        int indexOfFirstProbableSequence        = -1;
                        string mostProbableParents              = "";
                        string allPossibleParents               = "";
                        FusionCandidate.FusionType probableType = psm.fusionType;
                        for (int fc = 0; fc < psm.candidates.Count(); fc++)
                        {
                            FusionCandidate fusionCandidate = psm.candidates[fc]; //need fc for indexOfFirstProbableSequence
                            if (fusionCandidate.fusionType != FusionCandidate.FusionType.TS)
                            {
                                continue;
                            }
                            char[] tempArray = fusionCandidate.seq.ToCharArray();
                            //if most probable, add to all and most

                            //record sequences
                            if (indexOfFirstProbableSequence < 0)
                            {
                                indexOfFirstProbableSequence = fc;
                            }
                            for (int i = 0; i < tempArray.Count(); i++)
                            {
                                mostProbableSequences += tempArray[i];
                                allPossibleSequences  += tempArray[i];
                                foreach (int junction in fusionCandidate.junctionIndexes)
                                {
                                    if (junction == i)
                                    {
                                        mostProbableSequences += "-";
                                        allPossibleSequences  += "-";
                                    }
                                }
                            }
                            mostProbableSequences += "|";
                            allPossibleSequences  += "|";

                            //record parents
                            string tempParents = "";

                            mostProbableParents += tempParents;
                            allPossibleParents  += tempParents;
                        }

                        allPossibleSequences  = allPossibleSequences.Substring(0, allPossibleSequences.Length - 1);   //remove last "|"
                        mostProbableSequences = mostProbableSequences.Substring(0, mostProbableSequences.Length - 1); //remove last "|"

                        string ambiguity = "";
                        NeoFindAmbiguity.FindIons(psm.candidates[indexOfFirstProbableSequence], psm, spectrum); //this should be carried over, but it's not...
                                                                                                                //      mutableError_message += e;
                        bool[] foundIons = psm.candidates[indexOfFirstProbableSequence].foundIons;
                        char[] firstSeq  = psm.candidates[indexOfFirstProbableSequence].seq.ToCharArray();

                        bool ambiguous = false;
                        for (int i = 1; i < foundIons.Length; i++)
                        {
                            if (foundIons[i])                 //if found
                            {
                                ambiguity += firstSeq[i - 1]; //add aa
                                if (ambiguous)                //if it is part of an ambiguous sequence
                                {
                                    ambiguity += ")";
                                    ambiguous  = false; //no longer ambiguous
                                }
                            }
                            else
                            {
                                if (!ambiguous)
                                {
                                    ambiguous  = true;
                                    ambiguity += "(";
                                }
                                ambiguity += firstSeq[i - 1];
                            }
                        }
                        ambiguity += firstSeq[foundIons.Length - 1];
                        if (ambiguous)
                        {
                            ambiguity += ")";
                        }
                        string potentialFalsePositives = "";

                        if (potentialFalsePositives.Length > 0)
                        {
                            potentialFalsePositives = potentialFalsePositives.Substring(0, potentialFalsePositives.Length - 1); //remove last |
                            if (potentialFalsePositives.Length > 30000)
                            {
                                potentialFalsePositives = potentialFalsePositives.Substring(0, 30000);
                            }
                        }
                        //workarounds for excel. Actual limit is 32767, but that doesn't seem to work
                        if (mostProbableParents.Length > 30000)
                        {
                            mostProbableParents = mostProbableParents.Substring(0, 30000);
                        }
                        if (allPossibleParents.Length > 30000)
                        {
                            allPossibleParents = allPossibleParents.Substring(0, 30000);
                        }
                        int score = 0;
                        foreach (bool b in psm.candidates[indexOfFirstProbableSequence].foundIons)
                        {
                            if (b)
                            {
                                score++;
                            }
                        }
                        lock (file)
                        {
                            file.WriteLine(psm.scanNumber.ToString() + '\t' + psm.expMass.ToString() + '\t' + psm.nInfo.seq + '\t' + psm.nInfo.score + '\t' + psm.cInfo.seq + '\t' + psm.cInfo.score + '\t' + psm.candidates[indexOfFirstProbableSequence].seq + '\t' + ambiguity + '\t' + psm.fusionType.ToString() + '\t' + mostProbableSequences + '\t' + mostProbableSequences.Replace("-", "") + '\t' + mostProbableParents + '\t' + allPossibleSequences + '\t' + allPossibleSequences.Replace("-", "") + '\t' + allPossibleParents + '\t' + psm.candidates.Count().ToString() + '\t' + potentialFalsePositives + '\t' + score);
                            //progress++;
                            //this.worker.ReportProgress((int)(progress / psms.Count() * 100));
                        }
                    }
                });
            }
        }