Example #1
0
        private static Database databaseSetUp(String fasta_file_name)
        {
            FastaFile         f  = Loader.parseFasta(fasta_file_name);
            DigestedFastaFile df = PerformDigestion.performDigest(f, GlobalVar.NUM_MISSED_CLEAVAGES);

            int numberOfProteinsInFasta         = f.getAccessionToFullSequence().Count;
            int numberOfPeptidesInDigestedFasta = df.getDigestedPeptideArray().Count;

            log.Info("Fasta file: " + fasta_file_name);
            log.Info("Num missed cleavages: " + GlobalVar.NUM_MISSED_CLEAVAGES);
            log.Info("Number of proteins: " + numberOfProteinsInFasta);
            log.Info("Number of peptides: " + numberOfPeptidesInDigestedFasta);

            log.Debug("Constructing graph...");
            Database g;

            if (GlobalVar.isSimulationForFeatureExtraction == true)
            {
                g = new Database(f, df, true, false);
            }
            else
            {
                g = new Database(f, df, true, true);
            }
            log.Debug(g);

            return(g);
        }
        //depricated
        public static String GenerateConcacenatedDecoyFasta_MimicCometInternal(String fastaFile, String outputFilePath)
        {
            StreamWriter sw = new StreamWriter(outputFilePath);



            DigestedFastaFile      df = PerformDigestion.performDigest(fastaFile, GlobalVar.NUM_MISSED_CLEAVAGES, false);
            List <DigestedPeptide> targetSequences = df.getDigestedPeptideArray();


            String line;

            foreach (DigestedPeptide targetSeq in targetSequences)
            {
                //write the target sequence
                line = ">" + targetSeq.getAccession();
                sw.WriteLine(line);

                line = targetSeq.getSequence();
                sw.WriteLine(line);

                //write the decoy sequence
                line = ">" + GlobalVar.DecoyPrefix + targetSeq.getAccession();
                sw.WriteLine(line);

                line = ReverseSequence_keepCTerm(targetSeq.getSequence());
                sw.WriteLine(line);
            }
            sw.Close();
            return(outputFilePath);
        }
Example #3
0
        public static DigestedFastaFile performDigest(String fastaFilePath, int numMissedCleavages, Boolean keepFile)
        {
            if (GlobalVar.useChainsawComputedFile)
            {
                return(Loader.parseDigestedFasta(InputFileOrganizer.ChainSawResult));
            }

            // These are the output file paths
            String outputTSVFile   = fastaFilePath + "_digestedPeptides.tsv";
            String outputIndexFile = fastaFilePath + ".index";


            /* Peptide chainsaw parameters */
            String chainsaw = InputFileOrganizer.ChainSaw; // tool location
            //String enzyme = "Trypsin/P";
            String enzyme               = "Trypsin";
            String specificity          = "fully";
            int    minimumPeptideLength = GlobalVar.MinimumPeptideLength;
            int    maximumPeptideLength = 200;
            // minimum and maximum peptide length is what typically is analyzed well by the
            // mass spectrometer

            // This is the chainsaw command to be run on the terminal
            String chainsawCommand = chainsaw + " -c " + enzyme + " -s " + specificity + " -m " + minimumPeptideLength
                                     + " -M " + maximumPeptideLength + " -n " + numMissedCleavages + " " + fastaFilePath;

            log.Info("Digesting database using ChainSaw");
            // perform in-silico digestion
            String chainsawOutput = ExecuteShellCommand.executeCommand(chainsawCommand);

            log.Info(chainsawCommand);
            log.Debug(chainsawOutput);

            // parse new tsv file
            DigestedFastaFile df = Loader.parseDigestedFasta(outputTSVFile);

            // this tool automatically outputs file in the same folder as the input database, move file to output folder,
            if (keepFile)
            {
                ExecuteShellCommand.executeCommand("move " + outputTSVFile + " " + InputFileOrganizer.preExperimentFilesFolder);
                InputFileOrganizer.ChainSawResult = InputFileOrganizer.preExperimentFilesFolder + "\\" + IOUtils.getBaseName(outputTSVFile);
            }
            else
            {
                ExecuteShellCommand.executeCommand("rm " + outputTSVFile);
            }
            //ExecuteShellCommand.executeCommand("rm " + outputIndexFile);

            return(df);
        }
Example #4
0
        public Database(FastaFile fastaFile, DigestedFastaFile digestedFastaFile, bool _includeCarbamidoModification,
                        bool _includeRetentionTime, double _retentionTimeWindow)
        {
            includeCarbamidoModification = _includeCarbamidoModification;
            includeRetentionTime         = _includeRetentionTime;
            retentionTimeWindow          = _retentionTimeWindow;
            log.Debug("Constructing graph...");
            SequenceToPeptide   = new Dictionary <String, Peptide>();
            peptides            = new List <Peptide>();
            AccesstionToProtein = fastaFile.getAccessionToFullSequence();
            addPeptides(digestedFastaFile.getDigestedPeptideArray());

            log.Debug("Done constructing graph.");
        }
Example #5
0
 public static Database loadExclusionDatabase(FastaFile fasta, DigestedFastaFile digestedFasta)
 {
     return(new Database(fasta, digestedFasta));
 }
Example #6
0
 public Database(FastaFile fastaFile, DigestedFastaFile digestedFastaFile, bool _includeCarbamidoModification,
                 bool _includeRetentionTime) : this(fastaFile, digestedFastaFile, _includeCarbamidoModification, _includeRetentionTime,
                                                    DEFAULT_RETENTION_TIME_WINDOW)
 {
 }
Example #7
0
 public Database(FastaFile fastaFile, DigestedFastaFile digestedFastaFile) :
     this(fastaFile, digestedFastaFile, DEFAULT_INCLUDE_CARBAMIDO_MODIFICATION, DEFAULT_INCLUDE_RETENTION_TIME)
 {
 }