compomics-utilities icon indicating copy to clipboard operation
compomics-utilities copied to clipboard

Semi-specific digestion in the IteratorFactory

Open wenbostar opened this issue 1 year ago • 6 comments

Is there a way to do semi-tryptic digestion using the getSequenceIterator function from IteratorFactory?

wenbostar avatar Apr 29 '24 17:04 wenbostar

Yes, I think you should be able to do something like this:

DigestionParameters digestionPreferences = new DigestionParameters();
digestionPreferences.setCleavageParameter(DigestionParameters.CleavageParameter.enzyme);
digestionPreferences.addEnzyme(enzymeFactory.getEnzyme("Trypsin"));
SequenceIterator sequenceIterator = iteratorFactoryNoModifications.getSequenceIterator(yourSequence, digestionPreferences, 0.0, Double.MAX_VALUE);

hbarsnes avatar Apr 30 '24 10:04 hbarsnes

Hi @hbarsnes , thanks. Which parameter in the code is used to control for semi-digestion?

wenbostar avatar Apr 30 '24 17:04 wenbostar

Ah, sorry, forgot to add the semi-specific part. See the fourth line below.

DigestionParameters digestionPreferences = new DigestionParameters();
digestionPreferences.setCleavageParameter(DigestionParameters.CleavageParameter.enzyme);
digestionPreferences.addEnzyme(enzymeFactory.getEnzyme("Trypsin"));
digestionPreferences.setSpecificity("Trypsin", Specificity.semiSpecific);
SequenceIterator sequenceIterator = iteratorFactoryNoModifications.getSequenceIterator(yourSequence, digestionPreferences, 0.0, Double.MAX_VALUE);

hbarsnes avatar Apr 30 '24 20:04 hbarsnes

It looks like this doesn't work.

void testSemi_digestion(){
        IteratorFactory iteratorModifications = new IteratorFactory(new ArrayList<>());
        DigestionParameters digestionPreferences = new DigestionParameters();
        digestionPreferences.setCleavageParameter(DigestionParameters.CleavageParameter.enzyme);
        digestionPreferences.addEnzyme(EnzymeFactory.getInstance().getEnzyme("Trypsin"));
        digestionPreferences.setSpecificity("Trypsin", DigestionParameters.Specificity.semiSpecific);

        try {
            SequenceIterator sequenceIterator = iteratorModifications.getSequenceIterator("MTEYKLVVVGAGGVGKSALTIQLIQNHFVDEYDPTIEDSYR", digestionPreferences, 0.0, Double.MAX_VALUE);
            ExtendedPeptide extendedPeptide;
            while (true) {
                try {
                    if ((extendedPeptide = sequenceIterator.getNextPeptide()) == null) {
                        break;
                    }

                    Peptide peptide = extendedPeptide.peptide;
                    System.out.println(peptide.getSequence());

                } catch (InterruptedException e) {
                    e.printStackTrace();
                }



            }
        } catch (InterruptedException e) {
            throw new RuntimeException(e);
        }
    }

Output:

MTEYK
LVVVGAGGVGK
SALTIQLIQNHFVDEYDPTIEDSYR

Utilities version: 5.0.39.

wenbostar avatar Apr 30 '24 21:04 wenbostar

Does this indicate semi-digestion is not implemented yet? https://github.com/compomics/compomics-utilities/blob/master/src/test/java/com/compomics/util/test/experiment/sequences/digestion/ProteinSequenceIteratorTest.java#L244

wenbostar avatar Apr 30 '24 21:04 wenbostar

Seems like you are correct in that the support for semi-specific has not been implemented for the IteratorFactory. I'll add it to the list of requested features, but I'm afraid that we will not have the resources to look into it at the moment.

hbarsnes avatar Apr 30 '24 22:04 hbarsnes