1

I would like to get differences between 2 amino acid sequences after alignment

For example from:

target: LTTYEYLDDCRDDEE
query:  LATYYYLDDCRDDEE

I would like to know amino acid changes and where it occurs.

Here is my code:

//alignment
        try {
            String aaref = symL2ref.seqString();
            ProteinSequence sRef = new ProteinSequence(aaref);
            String aaseq = symL2.seqString();
            ProteinSequence sSeq = new ProteinSequence(aaseq);
            SubstitutionMatrix<AminoAcidCompound> matrix2 = SubstitutionMatrixHelper.getBlosum65();
            GapPenalty penalty = new SimpleGapPenalty();
            short gop = 8;
            short extend = 1;
            penalty.setOpenPenalty(gop);
            penalty.setExtensionPenalty(extend);
            PairwiseSequenceAligner<ProteinSequence, AminoAcidCompound> smithWaterman = Alignments.getPairwiseAligner(sRef, sSeq, PairwiseSequenceAlignerType.LOCAL, penalty, matrix2);
            SequencePair<ProteinSequence, AminoAcidCompound> psa2 = smithWaterman.getPair();
            System.out.println("alignment: \n" + psa2);
            int startt = 1;
            int endd = psa2.getLength();
            Mut mut = new Mut();

//amino acid difference
            int k;
            for(k = startt; k <= endd; ++k) {
                AminoAcidCompound aadifftarget = (AminoAcidCompound)psa2.getCompoundInTargetAt(k);
                int aadiff = psa2.getIndexInQueryAt(k);
                AminoAcidCompound aadiffquery = (AminoAcidCompound)psa2.getCompoundInQueryAt(k);
                if (!((AminoAcidCompound)psa2.getQuery().getCompoundAt(k)).equals(psa2.getTarget().getCompoundAt(k))) {
                    mut.getQuer(aadiffquery);
                }

                mut.getPos(aadiff);
                mut.getTarg(aadifftarget);
            }
//trying to make a relevant output
            System.out.println("aadifftarget: \n" + mut);
            System.out.println(psa2.getIndexInQueryAt(1));
            System.out.println(psa2.getIndexInTargetAt(1));
            System.out.println(psa2.getCompoundInQueryAt(1));
            System.out.println(psa2.getCompoundInTargetAt(1));
            k = psa.getNumIdenticals();
        } catch (BioException var53) {
            var53.printStackTrace();
        }

I can't get a usable output. How can I get an object containing: T2A, E5Y?

Thank a lot for your help and comments!

vmicrobio
  • 331
  • 1
  • 2
  • 13

0 Answers0