public void parse() throws IOException
{
// TODO set the filename sensibly
- id = (inFile == null) ? "PDBFILE" : inFile.getName();
+ id = (inFile == null || inFile.getName()==null || inFile.getName().length()==0) ? "PDBFILE" : inFile.getName();
try
{
chains = new Vector();
String line;
boolean modelFlag = false;
boolean terFlag = false;
+ String lastID="";
int index = 0;
+ String atomnam=null;
while ((line = nextLine()) != null)
{
if (line.indexOf("HEADER") == 0)
{
if (line.length()>62)
{
+ String tid;
if (line.length()>67) {
- id = line.substring(62, 67).trim();
+ tid = line.substring(62, 67).trim();
} else {
- id=line.substring(62).trim();
+ tid=line.substring(62).trim();
+ }
+ if (tid.length()>0)
+ {
+ id = tid;
}
continue;
}
terFlag = false;
// Jalview is only interested in CA bonds????
- if (!line.substring(12, 15).trim().equals("CA"))
+ atomnam = line.substring(12, 15).trim();
+ if (!atomnam.equals("CA") && !atomnam.equals("P"))
{
continue;
}
tmpchain = findChain(tmpatom.chain);
if (tmpchain != null)
{
+ if (tmpatom.resNumIns.trim().equals(lastID))
+ {
+ // phosphorylated protein - seen both CA and P..
+ continue;
+ }
tmpchain.atoms.addElement(tmpatom);
}
else
chains.addElement(tmpchain);
tmpchain.atoms.addElement(tmpatom);
}
+ lastID = tmpatom.resNumIns.trim();
}
index++;
}