*/
// invoked by openModel in ChimeraManager
// line: #1, chain A: hiv-1 protease
+ // line: Model 0 (filename)
public static int[] parseOpenedModelNumber(String inputLine)
{
int hash = inputLine.indexOf('#');
- int space = inputLine.indexOf(',', hash);
+ int space = -1;
+ if (hash == (-1))
+ {
+ hash = inputLine.indexOf("Model");
+ if (hash >= 0)
+ {
+ hash = hash + 5;
+ }
+ space = inputLine.indexOf(' ', hash + 1);
+ }
+ else
+ {
+ space = inputLine.indexOf(',', hash);
+ }
+
int decimal = inputLine.substring(hash + 1, space).indexOf('.');
// model number is between hash+1 and space
int modelNumber = -1;
{
int start = inputLine.indexOf("name ");
if (start < 0)
+ {
return null;
+ }
// Might get a quoted string (don't understand why, but there you have it)
if (inputLine.startsWith("\"", start + 5))
{
return inputLine.substring(start, end);
}
else
+ {
return inputLine.substring(start);
+ }
}
else
{
{
String[] subSplit = split[0].substring(1).split("\\.");
if (subSplit.length > 0)
+ {
model = Integer.parseInt(subSplit[0]);
+ }
else
+ {
model = Integer.parseInt(split[0].substring(1));
+ }
if (subSplit.length > 1)
+ {
submodel = Integer.parseInt(subSplit[1]);
+ }
} catch (Exception e)
{
// ignore
{
if (atom.equals("C") || atom.equals("CA") || atom.equals("N")
|| atom.equals("O") || atom.equals("H"))
+ {
return true;
+ }
return false;
}
}
else
{
+ // length > 1, so we probably have a file name with "." in it
logger.info("Could not parse model identifier: " + modelID);
+ resKeyParts[0] = modelID;
}
}
}
// }
// System.out.println("model = " + model + " chain = " + chain +
- // " residue = " +
- // residue);
+ // " residue = " + residue);
if (model != null)
{
List<ChimeraModel> models = chimeraManager.getChimeraModels(model,
}
if (chimeraResidue != null)
+ {
return chimeraResidue;
+ }
if (chimeraChain != null)
+ {
return chimeraChain;
+ }
if (chimeraModel != null)
+ {
return chimeraModel;
+ }
} catch (Exception ex)
{
}
if (chimeraResidue != null)
+ {
return chimeraResidue;
+ }
if (chimeraChain != null)
+ {
return chimeraChain;
+ }
if (chimeraModel != null)
+ {
return chimeraModel;
+ }
} catch (Exception ex)
{
public static String findStructures(String residueList)
{
if (residueList == null)
+ {
return null;
+ }
String[] residues = residueList.split(",");
Map<String, String> structureNameMap = new HashMap<String, String>();
for (int i = 0; i < residues.length; i++)
}
}
if (structureNameMap.isEmpty())
+ {
return null;
+ }
String structure = null;
for (String struct : structureNameMap.keySet())
{
if (structure == null)
+ {
structure = new String();
+ }
else
+ {
structure = structure.concat(",");
+ }
structure = structure.concat(struct);
}
return structure;
{
resRange = resRange.concat("-");
if (chain != null && range[res].indexOf('.') == -1)
+ {
range[res] = range[res].concat("." + chain);
+ }
}
if (res == 0 && range.length >= 2 && range[res].indexOf('.') > 0)
public static String toFullName(String aaType)
{
if (!aaNames.containsKey(aaType))
+ {
return aaType;
- String[] ids = ((String) aaNames.get(aaType)).split(" ");
+ }
+ String[] ids = aaNames.get(aaType).split(" ");
return ids[2].replace('_', ' ');
}
public static String toSingleLetter(String aaType)
{
if (!aaNames.containsKey(aaType))
+ {
return aaType;
- String[] ids = ((String) aaNames.get(aaType)).split(" ");
+ }
+ String[] ids = aaNames.get(aaType).split(" ");
return ids[0];
}
public static String toThreeLetter(String aaType)
{
if (!aaNames.containsKey(aaType))
+ {
return aaType;
- String[] ids = ((String) aaNames.get(aaType)).split(" ");
+ }
+ String[] ids = aaNames.get(aaType).split(" ");
return ids[1];
}
public static String toSMILES(String aaType)
{
if (!aaNames.containsKey(aaType))
+ {
return null;
- String[] ids = ((String) aaNames.get(aaType)).split(" ");
+ }
+ String[] ids = aaNames.get(aaType).split(" ");
if (ids.length < 4)
+ {
return null;
+ }
return ids[3];
}