资源简介
可以使用需要重新加载biojava.jar jar包代码是全的,不会可以问我。jar包在lib目录下面
输出结果:
Global alignment with Needleman-Wunsch:
Time (ms): 3
Length: 9
Score: 0
Query: query, Length: 9
Target: target, Length: 8
Query: 1 gccctagcg 9
|| | | |
Target: 1 gcgc-aatg 8
Local alignment with Smith-Waterman:
Time (ms): 0
Length: 3
Score: 3
Query: query, Length: 9
Target: target, Length: 8
Query: 7 gcg 9
|||
Target: 1 gcg 3
代码片段和文件信息
/**
* Author: Paul Reiners
*/
package com.ibm.biojava.sample;
import org.biojava.bio.alignment.NeedlemanWunsch;
import org.biojava.bio.alignment.SequenceAlignment;
import org.biojava.bio.alignment.SmithWaterman;
import org.biojava.bio.alignment.SubstitutionMatrix;
import org.biojava.bio.seq.DNATools;
import org.biojava.bio.seq.Sequence;
import org.biojava.bio.symbol.AlphabetManager;
import org.biojava.bio.symbol.FiniteAlphabet;
/**
* @author Paul Reiners
*
* based closely on code by Andreas Dräger
*/
public class BioJavaSample {
/**
* @param args
* @throws Exception
*/
public static void main(String[] args) throws Exception {
// The alphabet of the sequences. For this example DNA is chosen.
FiniteAlphabet alphabet = (FiniteAlphabet) AlphabetManager
.alphabetForName(“DNA“);
// Use a substitution matrix with equal scores for every match and every
// replace.
short match = 1;
short replace = -1;
SubstitutionMatrix matrix = new SubstitutionMatrix(alphabet match
replace);
// Firstly define the expenses (penalties) for every single operation.
short insert = 2;
short delete = 2;
short gapExtend = 2;
// Global alignment.
SequenceAlignment aligner = new NeedlemanWunsch(match replace insert
delete gapExtend matrix);
Sequence query = DNATools.createDNASequence(“GCCCTAGCG“ “query“);
Sequence target = DNATools.createDNASequence(“GCGCAATG“ “target“);
// Perform an alignment and save the results.
aligner.pairwiseAlignment(query // first sequence
target // second one
);
// Print the alignment to the screen
System.out.println(“Global alignment with Needleman-Wunsch:\n“
+ aligner.getAlignmentString());
// Perform a local alignment from the sequences with Smith-Waterman.
aligner = new SmithWaterman(match replace insert delete gapExtend
matrix);
// Perform the local alignment.
aligner.pairwiseAlignment(query target);
System.out.println(“\nLocal alignment with Smith-Waterman:\n“
+ aligner.getAlignmentString());
}
}
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 481 2016-08-10 13:58 SequenceAlignment\.classpath
....... 393 2008-02-28 12:58 SequenceAlignment\.project
....... 21864 2008-02-28 12:58 SequenceAlignment\.settings\org.eclipse.jdt.core.prefs
....... 228 2008-02-28 12:58 SequenceAlignment\.settings\org.eclipse.jdt.ui.prefs
文件 2299 2016-08-10 14:32 SequenceAlignment\bin\com\ibm\biojava\sample\BioJavaSample.class
文件 1414 2016-08-10 13:58 SequenceAlignment\bin\com\ibm\compbio\Cell.class
文件 4041 2016-08-10 13:58 SequenceAlignment\bin\com\ibm\compbio\DynamicProgramming.class
文件 2426 2016-08-10 14:37 SequenceAlignment\bin\com\ibm\compbio\misc\DNAGenerator.class
文件 1391 2016-08-10 13:58 SequenceAlignment\bin\com\ibm\compbio\misc\Fibonacci.class
文件 2611 2016-08-10 13:58 SequenceAlignment\bin\com\ibm\compbio\seqalign\NeedlemanWunsch.class
文件 2239 2016-08-10 13:58 SequenceAlignment\bin\com\ibm\compbio\seqalign\SequenceAlignment.class
文件 2653 2016-08-10 13:58 SequenceAlignment\bin\com\ibm\compbio\seqalign\SmithWaterman.class
文件 2532 2016-08-10 13:58 SequenceAlignment\bin\com\ibm\compbio\sequence\LongestCommonSubsequence.class
文件 3607968 2016-08-10 13:38 SequenceAlignment\lib\biojava.jar
文件 102896 2016-08-10 13:54 SequenceAlignment\lib\biojava3-alignment-3.0.1.jar
文件 163026 2016-08-10 13:54 SequenceAlignment\lib\biojava3-alignment-3.0.5-sources.jar
文件 183516 2016-08-10 13:54 SequenceAlignment\lib\biojava3-alignment-3.0.5.jar
文件 190116 2016-08-10 13:54 SequenceAlignment\lib\biojava3-core-3.0-sources.jar
文件 255177 2016-08-10 13:54 SequenceAlignment\lib\biojava3-core-3.0.1.jar
文件 315410 2016-08-10 13:54 SequenceAlignment\lib\biojava3-structure-gui-3.0.5.jar
文件 391834 2016-08-10 13:49 SequenceAlignment\lib\log4j-1.2.15.jar
文件 2283 2016-08-10 13:57 SequenceAlignment\src\com\ibm\biojava\sample\BioJavaSample.java
....... 1252 2008-02-28 12:58 SequenceAlignment\src\com\ibm\compbio\Cell.java
....... 4489 2008-02-28 12:58 SequenceAlignment\src\com\ibm\compbio\DynamicProgramming.java
文件 3875 2016-08-10 14:37 SequenceAlignment\src\com\ibm\compbio\misc\DNAGenerator.java
....... 1130 2008-02-28 12:58 SequenceAlignment\src\com\ibm\compbio\misc\Fibonacci.java
....... 2713 2008-02-28 12:58 SequenceAlignment\src\com\ibm\compbio\seqalign\NeedlemanWunsch.java
....... 2431 2008-02-28 12:58 SequenceAlignment\src\com\ibm\compbio\seqalign\SequenceAlignment.java
....... 2835 2008-02-28 12:58 SequenceAlignment\src\com\ibm\compbio\seqalign\SmithWaterman.java
....... 3225 2008-02-28 12:58 SequenceAlignment\src\com\ibm\compbio\sequence\LongestCommonSubsequence.java
............此处省略25个文件信息
评论
共有 条评论