merging structures

Jay Vyas <[email protected]>
Newsgroups gmane.comp.java.bio.general
Message-ID <[email protected]>
Hi guys : Im using the biojava structure api to merge some structures .

Ive written the following test method, which I believe should work to merge
the first chain of several different structures into on Structure object. Im
only concerned about CA's for now.

is there an easier way to do this ?

public static Structure merge(List<Structure> struc) throws Exception

{

StructureImpl si = new StructureImpl();

         si.setPDBCode("1JAY");

si.setId(0L);

si.setName("Merged");

si.setPDBHeader(new PDBHeader());

si.setNmr(true);


 int index=0;

for(Structure s : struc)

{

ChainImpl ch = new ChainImpl();

ch.setName(alphabet.charAt(index++)+"");

ch.setChainID(ch.getName());

//strip atoms of the backbone, add them to a chain.

Atom[] atoms = StructureTools.getAtomCAArray(s.getChain(0));

char[] aminoAcids = s.getChain(0).getAtomSequence().toCharArray();

 for(int i = 0 ; i < atoms.length; i++)

{

AminoAcid a = new AminoAcidImpl();

a.setAminoType(aminoAcids[i]);

a.setPDBName(new AminoAcidBean(aminoAcids[i]).getThreeLetter());

a.setResidueNumber(new ResidueNumber(ch.getChainID(), i, null));

a.getAtoms().add(atoms[i]);

a.setChain(ch);

ch.addGroup(a);

}

Jlog.info("adding chain " + si.getName());

si.addChain(ch);

}

System.out.println(si.toPDB());

return si;

}


but it crashes due to a null pointer exception

at org.biojava.bio.structure.io.FileConvert.alignLeft(FileConvert.java:86)

at org.biojava.bio.structure.io.FileConvert.toPDB(FileConvert.java:296)

at org.biojava.bio.structure.StructureImpl.toPDB(StructureImpl.java:566)

at common.Utilities.merge(Utilities.java:92)

at common.Utilities.main(Utilities.java:115)
_______________________________________________
Biojava-l mailing list  -  [email protected]
http://lists.open-bio.org/mailman/listinfo/biojava-l
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.