|
30 | 30 | import org.biojava.nbio.structure.align.ce.CeParameters; |
31 | 31 | import org.biojava.nbio.structure.align.gui.StructureAlignmentDisplay; |
32 | 32 | import org.biojava.nbio.structure.align.model.AFPChain; |
| 33 | +import org.biojava.nbio.structure.align.seq.SmithWaterman3DParameters; |
33 | 34 | import org.biojava.nbio.structure.align.seq.SmithWaterman3Daligner; |
34 | 35 | import org.biojava.nbio.structure.align.util.AtomCache; |
35 | 36 |
|
36 | 37 | public class DemoSW3DAligner { |
37 | 38 |
|
38 | 39 |
|
39 | 40 |
|
40 | | - public static void main(String[] args){ |
41 | | - |
42 | | - //String name1 = "4hhb.A"; |
43 | | - //String name2 = "4hhb.B"; |
44 | | - |
45 | | - String name1 = "1cdg.A"; |
46 | | - String name2 = "1tim.B"; |
47 | | - |
48 | | - AtomCache cache = new AtomCache(); |
49 | | - |
50 | | - Structure structure1 = null; |
51 | | - Structure structure2 = null; |
52 | | - |
53 | | - try { |
54 | | - |
55 | | - StructureAlignment algorithm = StructureAlignmentFactory.getAlgorithm(SmithWaterman3Daligner.algorithmName); |
56 | | - |
57 | | - structure1 = cache.getStructure(name1); |
58 | | - structure2 = cache.getStructure(name2); |
59 | | - |
60 | | - Atom[] ca1 = StructureTools.getAtomCAArray(structure1); |
61 | | - Atom[] ca2 = StructureTools.getAtomCAArray(structure2); |
62 | | - |
63 | | - // get default parameters |
64 | | - CeParameters params = new CeParameters(); |
65 | | - |
66 | | - // add more print |
67 | | - params.setShowAFPRanges(true); |
68 | | - |
69 | | - // set the maximum gap size to unlimited |
70 | | - params.setMaxGapSize(-1); |
71 | | - |
72 | | - AFPChain afpChain = algorithm.align(ca1,ca2,params); |
73 | | - |
74 | | - afpChain.setName1(name1); |
75 | | - afpChain.setName2(name2); |
76 | | - |
77 | | - // flexible original results: |
78 | | - System.out.println(afpChain.toFatcat(ca1,ca2)); |
79 | | - |
80 | | - // print rotation matrices |
81 | | - System.out.println(afpChain.toRotMat()); |
82 | | - //System.out.println(afpChain.toCE(ca1, ca2)); |
83 | | - |
84 | | - // print XML representation |
85 | | - //System.out.println(AFPChainXMLConverter.toXML(afpChain,ca1,ca2)); |
86 | | - |
87 | | - StructureAlignmentDisplay.display(afpChain, ca1, ca2); |
88 | | - |
89 | | - } catch (Exception e) { |
90 | | - e.printStackTrace(); |
91 | | - return; |
92 | | - } |
93 | | - } |
| 41 | + public static void main(String[] args){ |
| 42 | + |
| 43 | + String name1 = "1MBN.A"; |
| 44 | + String name2 = "4ODC.A"; |
| 45 | + |
| 46 | + AtomCache cache = new AtomCache(); |
| 47 | + |
| 48 | + Structure structure1 = null; |
| 49 | + Structure structure2 = null; |
| 50 | + |
| 51 | + try { |
| 52 | + |
| 53 | + StructureAlignment algorithm = StructureAlignmentFactory.getAlgorithm(SmithWaterman3Daligner.algorithmName); |
| 54 | + |
| 55 | + System.out.println("using " + algorithm.getAlgorithmName()); |
| 56 | + |
| 57 | + SmithWaterman3DParameters params = new SmithWaterman3DParameters(); |
| 58 | + |
| 59 | + System.out.println("Gap open:" + params.getGapOpen()); |
| 60 | + System.out.println("Gap extension:" + params.getGapExtend()); |
| 61 | + |
| 62 | + structure1 = cache.getStructure(name1); |
| 63 | + structure2 = cache.getStructure(name2); |
| 64 | + |
| 65 | + Atom[] ca1 = StructureTools.getAtomCAArray(structure1); |
| 66 | + Atom[] ca2 = StructureTools.getAtomCAArray(structure2); |
| 67 | + |
| 68 | + |
| 69 | + AFPChain afpChain = algorithm.align(ca1,ca2,params); |
| 70 | + |
| 71 | + afpChain.setName1(name1); |
| 72 | + afpChain.setName2(name2); |
| 73 | + |
| 74 | + // flexible original results: |
| 75 | + System.out.println(afpChain.toFatcat(ca1,ca2)); |
| 76 | + |
| 77 | + // print rotation matrices |
| 78 | + System.out.println(afpChain.toRotMat()); |
| 79 | + //System.out.println(afpChain.toCE(ca1, ca2)); |
| 80 | + |
| 81 | + // print XML representation |
| 82 | + //System.out.println(AFPChainXMLConverter.toXML(afpChain,ca1,ca2)); |
| 83 | + |
| 84 | + StructureAlignmentDisplay.display(afpChain, ca1, ca2); |
| 85 | + |
| 86 | + } catch (Exception e) { |
| 87 | + e.printStackTrace(); |
| 88 | + return; |
| 89 | + } |
| 90 | + } |
94 | 91 |
|
95 | 92 |
|
96 | 93 | } |
0 commit comments