[英]how can i choose multiple chains as a structure object for structural alignment in biojava
我正在嘗試使用BioJava庫進行結構比對。 我想從一個結構對象中一個接一個地選擇鏈,然后將它們添加到另一個結構對象中,這樣我就可以與它們進行結構對齊,但是我還無法弄清楚如何做。 我到目前為止編寫的代碼如下,但是它給出了空指針異常(可能是因為new_structure
設置為null)。 我還能嘗試什么?
private static Structure prepareStructures(String structure_name, AtomCache cache){
Structure structure = null;
Structure new_structure = null;
String[] pdbnchain;
try{
pdbnchain = structure_name.split("\\.");
structure = cache.getStructure(pdbnchain[0]);
for(int i = 0; i < pdbnchain[1].length(); i++){
String letter = pdbnchain[1].charAt(i)+"";
new_structure.addChain(structure.getChainByPDB(letter));
}
} catch(Exception ex){
ex.printStackTrace();
}
return new_structure;
}
您可以使用 :
Structure new_structure = structure.clone();
以獲得結構的相同副本。然后,您還將在new_structure中擁有所有第一個結構的鏈。
可能您應該在執行以下操作之后:
structure = cache.getStructure(pdbnchain[0]);
new_structure = structure.clone();
具有非null值。 請參閱此文檔。
您也可以嘗試:
Structure new_structure = new StructureImpl(); // StructureImpl implements Structure interface.
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.