Smithwaterman alignment related question: need alignment score
1
0
Entering edit mode
8.7 years ago

How to get the alignment score? This is the code I am using:

DNASequence target = null; try { target = new DNASequence(seq1.toString(), AmbiguityDNACompoundSet.getDNACompoundSet()); } catch (CompoundNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); }

    DNASequence query = null;

    try {
        query = new DNASequence(seq2.toString(), AmbiguityDNACompoundSet.getDNACompoundSet());
    } catch (CompoundNotFoundException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }

    SubstitutionMatrix<NucleotideCompound> matrix = SubstitutionMatrixHelper.getNuc4_4();
    SimpleGapPenalty gapP = new SimpleGapPenalty();
    gapP.setOpenPenalty((short)5);
    gapP.setExtensionPenalty((short)2);

    SequencePair<DNASequence, NucleotideCompound> psa =
            Alignments.getPairwiseAlignment(query, target,
                    PairwiseSequenceAlignerType.LOCAL, gapP, matrix);

```

alignment • 1.5k views
ADD COMMENT
1
Entering edit mode

Is this BioJava? If so, you might want to tag your post with that.

ADD REPLY
0
Entering edit mode
8.5 years ago
disimos89 • 0

take a look!

public class DeterministicAlignmentDemo {
    public static void main(String[] args) throws Exception{
        String targetSeq = "AGGCCTGGCTCTGAAGAGGACCAAATGAGAGCCCCTTACTTATTTCA";
        DNASequence target = new DNASequence(targetSeq,AmbiguityDNACompoundSet.getDNACompoundSet());


        String querySeq = "yyray";
        DNASequence query = new DNASequence(querySeq,AmbiguityDNACompoundSet.getDNACompoundSet());


        SubstitutionMatrix<NucleotideCompound> matrix = SubstitutionMatrixHelper.getNuc4_4();

        SimpleGapPenalty gapP = new SimpleGapPenalty();
        gapP.setOpenPenalty((short)5);
        gapP.setExtensionPenalty((short)2);

        SequencePair<DNASequence, NucleotideCompound> psa =
                Alignments.getPairwiseAlignment(query, target,PairwiseSequenceAlignerType.LOCAL, gapP, matrix);
        System.out.println(psa);
        System.out.println(psa.getIndexInTargetAt(1));
        System.out.println(psa.getIndexInQueryAt(1));
        System.out.println(Alignments.getPairwiseAligner(query, target, PairwiseSequenceAlignerType.LOCAL,gapP, matrix).getMaxScore());
    }
}
ADD COMMENT

Login before adding your answer.

Traffic: 2102 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6