Smithwaterman alignment related question: need alignment score
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);
```
• 1,859 views
•
link
1 answer
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());
}
}
• 0 views
•
link
Log in to answer this question.
Is this BioJava? If so, you might want to tag your post with that.