public void createProteinList() { minProteins = new HashMap<String, Protein>(); for (Peptide pg : minPeptides.values()) { String pepName = pg.getSequence(); for (String protName : pg.getProteins()) { if (minProteins.containsKey(protName)) { Protein prot = minProteins.get(protName); prot.addPeptide(pepName); } else { Protein prot = new Protein(); prot.setName(protName); prot.addPeptide(pepName); prot.setCluster(cluster_num); minProteins.put(protName, prot); } } } for (Protein p : minProteins.values()) { ProteinInfo pInfo = new ProteinInfo(); pInfo.setName(p.getName()); pInfo.setDescription(p.getDescription()); pInfo.setLength(p.getLength()); MassSieveFrame.addProtein(pInfo); } }
public Integer getCountablesCount() { if (countablesCount == null) { HashSet<Integer> uniqueEquivs = new HashSet<Integer>(); for (Protein p : getCountables()) { uniqueEquivs.add(p.getEquivalentGroup()); } countablesCount = uniqueEquivs.size(); } return countablesCount; }
public static BSTree createTree(Protein[] p) { int l = p.length; BSTree[] protree = new BSTree[l]; for (int i = 0; i < l; ++i) protree[i] = p[i].treeify(); while (l > 0) { System.out.println(l + " generalized leaf node" + (l > 1 ? "s" : "") + " left."); System.out.println(prettyPrint(protree)); if (l == 1) break; int maxReward = Integer.MIN_VALUE; int maxPos = -1; Protein maxCestor = null; for (int i = 0; i < l - 1; ++i) { Protein thisCestor = ((Protein) (protree[i].root().data())) .findMLAncestor((Protein) (protree[i + 1].root().data())); int thisReward = thisCestor.weight(); if (maxReward < thisReward) { maxReward = thisReward; maxPos = i; maxCestor = thisCestor; } } // System.out.println ("We're joining \"" + ((Protein)(protree[maxPos].root().data())).desc() // + "\"(" + maxPos + ") and \"" + ((Protein)(protree[maxPos+1].root().data())).desc() + "\"(" // + (maxPos + 1) + ") with a reward of " + maxReward + "."); BSTree[] protree_new = new BSTree[l - 1]; BSTree tree_merged = maxCestor.treeify().merge(protree[maxPos], protree[maxPos + 1], maxReward); for (int i = 0; i < l - 1; ++i) { protree_new[i] = (i < maxPos ? protree[i] : i == maxPos ? tree_merged : protree[i + 1]); } protree = protree_new; // System.out.println ("Suddenly, " + (l-1) + " element" + (l-1==1?" is":"s are") + " left."); --l; } return protree[0]; }
private PeptideProteinNameSet ProteinListToPPNSet(ArrayList<Protein> proteins) { Set<String> protNames = new HashSet<String>(); Set<String> pepNames = new HashSet<String>(); for (Protein p : proteins) { protNames.add(p.getName()); pepNames.addAll(p.getPeptides()); } PeptideProteinNameSet pps = new PeptideProteinNameSet(); pps.setPeptides(pepNames); pps.setProteins(protNames); return pps; }
private DefaultMutableTreeNode ProListToEquivTree(ArrayList<Protein> proList, String name) { DefaultMutableTreeNode root, child; int size = 0; PeptideProteinNameSet pps = ProteinListToPPNSet(proList); root = new DefaultMutableTreeNode(pps); HashSet<String> usedProteins = new HashSet<String>(); for (Protein p : proList) { if (!usedProteins.contains(p.getName())) { if (p.getEquivalent().size() > 0) { ArrayList<Protein> equivList = new ArrayList<Protein>(); equivList.add(p); equivList.addAll(p.getEquivalent()); PeptideProteinNameSet ppsEquiv = ProteinListToPPNSet(equivList); ppsEquiv.setName(p.getName() + " Group (" + equivList.size() + ")"); child = new DefaultMutableTreeNode(ppsEquiv); size++; for (Protein ps : equivList) { child.add(new DefaultMutableTreeNode(ps)); usedProteins.add(ps.getName()); } root.add(child); } else { root.add(new DefaultMutableTreeNode(p)); usedProteins.add(p.getName()); size++; } } } pps.setName(name + " (" + size + ")"); return root; }
/** Compare the DNA and byte versions */ public final void testCodonToAmino1() { assertEquals(512, TranslatedFrame.CODON_TO_AMINO.length); for (final DNA c1 : DNA.values()) { for (final DNA c2 : DNA.values()) { for (final DNA c3 : DNA.values()) { final Protein pr = TranslatedFrame.codonToAmino(c1, c2, c3); final byte prb = TranslatedFrame.codonToAmino( (byte) c1.ordinal(), (byte) c2.ordinal(), (byte) c3.ordinal()); assertEquals(pr.ordinal(), prb); } } } }
private void addLinkedMembers(PeptideCollection cluster, Integer clustNum, Peptide pg) { for (String proName : pg.getProteins()) { Protein pro = minProteins.get(proName); pro.setCluster(clustNum); for (String pepName : pro.getPeptides()) { Peptide subPg = minPeptides.get(pepName); if (subPg.getCluster() == -1) { subPg.setCluster(clustNum); cluster.addPeptideGroup(subPg); addLinkedMembers(cluster, clustNum, subPg); } } } }
public PeptideCollection filterByPeptidePerProtein(int numPeps) { HashSet<String> proDiscard = new HashSet<String>(); for (String pName : minProteins.keySet()) { Protein p = minProteins.get(pName); if (p.getNumUniquePeptides() < numPeps) { proDiscard.add(pName); } } PeptideCollection new_pc = new PeptideCollection(); for (PeptideHit ph : peptideHits) { new_pc.addPeptideHit(ph.maskProtein(proDiscard)); } new_pc.createProteinList(); return new_pc; }
public PeptideCollection filterByProteinCoverage(int minCoverage) { HashSet<String> proDiscard = new HashSet<String>(); for (String pName : minProteins.keySet()) { Protein p = minProteins.get(pName); if (p.getCoveragePercent() < minCoverage) { proDiscard.add(pName); } } PeptideCollection new_pc = new PeptideCollection(); for (PeptideHit ph : peptideHits) { new_pc.addPeptideHit(ph.maskProtein(proDiscard)); } new_pc.createProteinList(); return new_pc; }
/** * this is what a Mapper does * * @param keyin * @param valuein * @return iterator over mapped key values */ @Nonnull @Override public Iterable<KeyValueObject<String, String>> mapValues( @Nonnull final String annotation, @Nonnull final String sequence) { List<KeyValueObject<String, String>> holder = new ArrayList<KeyValueObject<String, String>>(); IPeptideDigester digester = getDigester(); IProtein prot = Protein.getProtein(annotation, annotation, sequence, null); // do a boolean for a peptide belonging to a decoy protein, but use the public isDecoy // boolean/method in Protein class boolean isDecoy = prot.isDecoy(); IPolypeptide[] pps = digester.digest(prot); PeptideModification[] modifications1 = getModifications(); for (int i = 0; i < pps.length; i++) { IPolypeptide pp = pps[i]; if (!pp.isValid()) continue; // hadoop write intermediate seq finder writePeptide(pp, holder); // if(isDecoy) // continue; // skip the rest of the loop // if it is decoy, don't add modifications to it if (!isDecoy || isGenerateDecoysForModifiedPeptides()) { // generate modified peptides and add to the output IModifiedPeptide[] modifications = ModifiedPolypeptide.buildModifications(pp, modifications1); for (int m = 0; m < modifications.length; m++) { IModifiedPeptide modification = modifications[m]; writePeptide(modification, holder); } } } boolean semiTryptic = digester.isSemiTryptic(); if (semiTryptic) { IPolypeptide[] semipps = digester.addSemiCleavages(prot); for (int j = 0; j < semipps.length; j++) { IPolypeptide semipp = semipps[j]; if (!semipp.isValid()) continue; writePeptide(semipp, holder); IModifiedPeptide[] modifications = ModifiedPolypeptide.buildModifications(semipp, modifications1); for (int k = 0; k < modifications.length; k++) { IModifiedPeptide modification = modifications[k]; writePeptide(modification, holder); } } } return holder; }
/** * Matrix for protein distance * * @param matrixName "<code>BLOSUM45</code>", "<code>BLOSUM62</code>", "<code>BLOSUM80</code>" * etc. * @throws InvalidParamsException exception when invalid parameters. * @throws IOException exception when IO goes wrong */ public ProteinScoringMatrix(String matrixName) throws InvalidParamsException, IOException { final String mat = matrixName.toUpperCase(Locale.getDefault()); final int len = Protein.values().length; mScores = new int[len][]; // C# restrictions for (int i = 0; i < len; i++) { mScores[i] = new int[len]; } final String res = "com/rtg/mode/" + mat; try (InputStream in = Resources.getResourceAsStream(res)) { if (in == null) { throw new MissingResourceException( "Could not find:" + res, ProteinScoringMatrix.class.getName(), res); } try (BufferedReader re = new BufferedReader(new InputStreamReader(in))) { try { parse(re); } catch (final IOException | NumberFormatException e) { throw new MissingResourceException( "Malformed resource: " + res + " message: " + e.getMessage(), ProteinScoringMatrix.class.getName(), res); } final String resProps = "com/rtg/mode/" + mat + ".properties"; try (final InputStream inProps = Resources.getResourceAsStream(resProps)) { if (inProps == null) { throw new MissingResourceException( "Could not find:" + resProps, ProteinScoringMatrix.class.getName(), resProps); } final Properties pr = new Properties(); try { pr.load(inProps); } catch (final IOException e) { throw new InvalidParamsException( ErrorType.PROPS_LOAD_FAILED, "Matrix", resProps, e.getMessage()); } catch (final IllegalArgumentException e) { throw new InvalidParamsException(ErrorType.PROPS_INVALID, "Matrix", resProps); } mK = getDouble(mat, pr, "K"); mLogK = Math.log(mK); mH = getDouble(mat, pr, "H"); mLambda = getDouble(mat, pr, "LAMBDA"); mHit = getDouble(mat, pr, "HIT"); mMiss = getDouble(mat, pr, "MISS"); mGap = getDouble(mat, pr, "GAP"); mExtend = getDouble(mat, pr, "EXTEND"); mExpected = getDouble(mat, pr, "EXPECTED"); mMax = findMax(); } } } assert integrity(); }
public final void testCodonToAmino() { final Map<Protein, SortedSet<String>> map = new TreeMap<>(); for (final DNA c1 : DNA.values()) { for (final DNA c2 : DNA.values()) { for (final DNA c3 : DNA.values()) { final String s = "" + c1 + c2 + c3; final Protein pr = TranslatedFrame.codonToAmino(c1, c2, c3); if (c1.ignore() || c2.ignore()) { assertTrue(s + ":" + pr, pr.ignore()); } else { final SortedSet<String> set = map.get(pr); final SortedSet<String> ns; if (set == null) { ns = new TreeSet<>(); map.put(pr, ns); } else { ns = set; } ns.add(s); } } } } final StringBuilder sb = new StringBuilder(); for (final Map.Entry<Protein, SortedSet<String>> e : map.entrySet()) { final Protein pr = e.getKey(); final SortedSet<String> set = e.getValue(); sb.append(pr.threeLetter()).append("/").append(pr.toString()).append(" "); int i = 0; for (final String s : set) { if (i > 0) { sb.append(", "); } sb.append(s); i++; } sb.append(LS); } assertEquals(CODON_TABLE, sb.toString()); }
public void updateProteins(HashMap<String, Protein> mainProteins) { minProteins = new HashMap<String, Protein>(); for (Peptide pg : minPeptides.values()) { String pepName = pg.getSequence(); for (String protName : pg.getProteins()) { if (minProteins.containsKey(protName)) { Protein prot = minProteins.get(protName); prot.addPeptide(pepName); } else { Protein prot = mainProteins.get(protName); minProteins.put(protName, prot); } } } for (Peptide pg : minPeptides.values()) { pg.updateProteins(minProteins); } for (Protein p : minProteins.values()) { p.updatePeptides(minPeptides); } }
private void categorizeProteins() { equivalents = new ArrayList<Protein>(); subsets = new ArrayList<Protein>(); supersets = new ArrayList<Protein>(); subsumables = new ArrayList<Protein>(); differentiables = new ArrayList<Protein>(); discretes = new ArrayList<Protein>(); countables = new ArrayList<Protein>(); ArrayList<Protein> sortProteins = new ArrayList<Protein>(); sortProteins.addAll(minProteins.values()); Collections.sort(sortProteins); for (Protein p : sortProteins) { switch (p.getParsimonyType()) { case EQUIVALENT: equivalents.add(p); break; case SUBSET: subsets.add(p); break; case SUPERSET: supersets.add(p); break; case SUBSUMABLE: subsumables.add(p); break; case DIFFERENTIABLE: differentiables.add(p); break; case DISCRETE: discretes.add(p); break; } } countables.addAll(discretes); countables.addAll(differentiables); countables.addAll(supersets); countables.addAll(equivalents); }
/** * Writes out all protein matches for the specified protein (GFF formatted). * * @param protein containing matches to be written out * @return the number of rows printed (i.e. the number of Locations on Matches). * @throws java.io.IOException in the event of I/O problem writing out the file. */ public int write(Protein protein) throws IOException { List<String> proteinIdsForGFF = getProteinAccessions(protein); int sequenceLength = protein.getSequenceLength(); String md5 = protein.getMd5(); String date = dmyFormat.format(new Date()); Set<Match> matches = protein.getMatches(); // Write sequence region information for (String proteinIdForGFF : proteinIdsForGFF) { if (matches.size() > 0) { // Check if protein accessions are GFF3 valid proteinIdForGFF = ProteinMatchesGFFResultWriter.getValidGFF3SeqId(proteinIdForGFF); // Write sequence-region super.gffWriter.write("##sequence-region " + proteinIdForGFF + " 1 " + sequenceLength); if (writeFullGFF) { writeReferenceLine(proteinIdForGFF, sequenceLength, md5); addFASTASeqToMap(proteinIdForGFF, protein.getSequence()); } processMatches(matches, proteinIdForGFF, date, protein, proteinIdForGFF, writeFullGFF); } // end match size check } return 0; }
public void updateParsimony() { for (Protein prot : minProteins.values()) { for (String pepName : prot.getPeptides()) { Peptide pep = minPeptides.get(pepName); prot.addAssociatedProteins(pep.getProteins()); } } for (Protein prot : minProteins.values()) { prot.updateParsimony(minProteins); } for (Protein prot : minProteins.values()) { prot.computeParsimonyType(); } }
public static void main(String[] args) { ArrayList<Protein> proteins = new ArrayList<Protein>(); entityManagerFactory = Persistence.createEntityManagerFactory("dataMining"); entityManager = entityManagerFactory.createEntityManager(); entityManager.getTransaction().begin(); List<TableDeFait> tableDeFaits = (List<TableDeFait>) entityManager.createQuery("SELECT t FROM TableDeFait t").getResultList(); for (TableDeFait tableDeFait : tableDeFaits) { proteins.add(new Protein(tableDeFait)); /* * int numOfAA = tableDeFait.getComposition().getNumAA(); int * hydrophobicityPercent = hydrophobicity * 100 / numOfAA; if * (hydrophobicityPercent > 80) { proteins.add(new Protein(1, * tableDeFait)); } else if (hydrophobicityPercent > 60) { * proteins.add(new Protein(2, tableDeFait)); } else if * (hydrophobicityPercent > 50) { proteins.add(new Protein(3, * tableDeFait)); } else if (hydrophobicityPercent > 40) { * proteins.add(new Protein(4, tableDeFait)); } else if * (hydrophobicityPercent > 30) { proteins.add(new Protein(5, * tableDeFait)); } else if (hydrophobicityPercent > 20) { * proteins.add(new Protein(6, tableDeFait)); } else { * proteins.add(new Protein(7, tableDeFait)); } */ } Collections.sort(proteins); String line = new String(); line = proteins.size() + " 2\n"; for (int i = 0; i < proteins.size(); i++) { Protein protein = proteins.get(i); line += protein.getNumTransmembrane() + " " + protein.getNumIntermembrane() + "\n"; } for (int i = 0; i < numOfCluster; i++) { for (int j = 0; j < proteins.size() / numOfCluster; j++) { ((Protein) proteins.get((i * proteins.size() / numOfCluster) + j)).setTypeProtein(i + 1); } } for (Protein protein : proteins) { System.out.println(protein.getHydrophobicity()); System.out.println(protein.getTypeProtein()); } StringReader stringReader = new StringReader(line); BufferedReader br = new BufferedReader(stringReader); ACPCalcul calcul = new ACPCalcul(br); System.out.println("\n"); entityManager.close(); }
public Graph toGraph() { Table edgeTable = new Table(); Table nodeTable = new Table(); HashMap<String, Integer> unique = new HashMap<String, Integer>(); edgeTable.addColumn("Node1", int.class); edgeTable.addColumn("Node2", int.class); nodeTable.addColumn("key", int.class); nodeTable.addColumn("name", String.class); nodeTable.addColumn("type", String.class); nodeTable.addColumn("indeterminate", int.class); int idx = 0; for (Protein prot : minProteins.values()) { int row = nodeTable.addRow(); unique.put(prot.getName(), idx); nodeTable.setInt(row, "key", idx++); nodeTable.setString(row, "name", prot.getName()); nodeTable.setString(row, "type", "protein"); nodeTable.setInt(row, "indeterminate", 0); } for (Peptide pep : minPeptides.values()) { int row = nodeTable.addRow(); unique.put(pep.getSequence(), idx); nodeTable.setInt(row, "key", idx++); nodeTable.setString(row, "name", pep.getSequence()); nodeTable.setString(row, "type", "peptide"); if (pep.getIndeterminateType() == PeptideIndeterminacyType.NONE) { nodeTable.setInt(row, "indeterminate", 0); } else { nodeTable.setInt(row, "indeterminate", 1); } } for (Protein prot : minProteins.values()) { int id1 = unique.get(prot.getName()); for (String pep : prot.getPeptides()) { int id2 = unique.get(pep); int row = edgeTable.addRow(); edgeTable.setInt(row, "Node1", id1); edgeTable.setInt(row, "Node2", id2); } } Graph g = new Graph(nodeTable, edgeTable, false, "key", "Node1", "Node2"); // System.err.println(g.getEdgeCount()); return g; }
public void updateClusters() { clusters = new HashMap<Integer, PeptideCollection>(); for (Peptide pg : minPeptides.values()) { pg.setCluster(-1); } int cluster_num = 1; for (Peptide pg : minPeptides.values()) { if (pg.getCluster() == -1) { PeptideCollection newCluster = new PeptideCollection(); newCluster.setClusterNum(cluster_num); pg.setCluster(cluster_num); newCluster.addPeptideGroup(pg); addLinkedMembers(newCluster, cluster_num, pg); newCluster.updateProteins(minProteins); newCluster.updateParsimony(); clusters.put(cluster_num, newCluster); cluster_num++; } } int equivGroup = 0; HashSet<String> usedProteins = new HashSet<String>(); ArrayList<Protein> equivOrder = new ArrayList<Protein>(); equivOrder.addAll(getCountables()); equivOrder.addAll(getSubsets()); equivOrder.addAll(getSubsumables()); for (Protein p : equivOrder) { if (!usedProteins.contains(p.getName())) { p.setEquivalentGroup(equivGroup); usedProteins.add(p.getName()); for (Protein ps : p.getEquivalent()) { ps.setEquivalentGroup(equivGroup); usedProteins.add(ps.getName()); } equivGroup++; } } }
public void reset(Protein protein) { reset(protein, protein.get(protein.size() - 1)); }
public static IProtein processProtein(final String line) { String peptide = XMLUtil.extractAttribute(line, "protein_descr"); if (peptide == null) throw new IllegalArgumentException("bad line " + line); return Protein.getProtein(peptide, "", "", null); }
public void actionPerformed(ActionEvent actionEvent) { String cmd = actionEvent.getActionCommand(); if ("Console" .equals( cmd)) { // opens a window to read the coordinates of a point that is added to the point // set. new InputPanelPointApplet(this); } else if ("Select_Point" .equals(cmd)) { // opens a window with the list of points. One is to be selected. new SelectPointPanelApplet(this); } else if ("Select_Cell" .equals(cmd)) { // opens a window with the list of cells. One is to be selected. // new SelectCellPanelApplet(this); } else if ("Random Point".equals(cmd)) { // adds random point to the point set /* com.artchase.geom3d.Point3d pointToAdd = new com.artchase.geom3d.Point3d(randGen); int size = getCells().getVertices().getSize(); Vertex v = new Vertex(pointToAdd, size); getCells().getVertices().insert(v); addSphere(v, 0.02f, Colors.red); getCells().setNrVertices(size+1); */ } else if ("Selected_Point_Move".equals(cmd)) { // new SelectedPointMovePanel(this); } else if ("Selected_Cell_Adjacent".equals(cmd)) { /* if (selectedCell != null) { System.out.println("selectedCell is not null"); if (selectedAdjCell != null) { System.out.println("adjacentCellShown is TRUE"); selectedAdjCell.changeAppearance(1, LineAttributes.PATTERN_SOLID, Colors.yellow); selectedAdjCell = null; } System.out.println("adjacentCellShown is FALSE"); if (cells.getNrCells() > 0) { System.out.println("Number of cells is " + cells.getNrCells()); int nrIter = 0; do { nrIter++; selectedAdjCellIndex = (++selectedAdjCellIndex)%4; System.out.println("selectedAdjCellIndex = " + selectedAdjCellIndex); selectedAdjCell = selectedCell.getAdjCell(selectedAdjCellIndex); } while (selectedAdjCell.isInfiniteCell() && (nrIter < 4)); if (!selectedAdjCell.isInfiniteCell()) { // adjacent cell found System.out.println("i am here displaying cell " + selectedAdjCellIndex); selectedAdjCell.changeAppearance(5, LineAttributes.PATTERN_SOLID, Colors.magenta); } else selectedAdjCell = null; // all adjacent cells are infinite } } */ } else if ("Selected_Cell_Circumcircle".equals(cmd)) { /* if (circumCircleShown) { circumCircleBranchGroup.detach(); circumCircleShown = false; } else { com.artchase.geom3d.Point3d[] points = selectedCell.getPoints(); Sphere3d sphere = new Sphere3d(points[0],points[1],points[2],points[3]); com.artchase.geom3d.Point3d center = sphere.getCenter(); circumCircleBranchGroup = addSphere(center, sphere.getRadius(), Colors.green); circumCircleShown = true; } */ } else if ("Random".equals(cmd)) { complex.clear(); spin.removeAllChildren(); setNrSpannedVerticesField(0); setNrEdgesField(0); setNrFacesField(0); setNrCellsField(0); // Open window to get the number of random points to be generated. new InputPanelRandomApplet(this); } else if ("Clear".equals(cmd)) { complex.clear(); spin.removeAllChildren(); setNrSpannedVerticesField(0); setNrEdgesField(0); setNrFacesField(0); setNrCellsField(0); selectedSimplex = null; selectedAdjCell = null; count2 = count3 = 0; } else if ("Run".equals(cmd)) { Simplex simplex; if (!complex.getPoints().isEmpty() && complex.isEmpty()) { simplex = complex.first3Simplex(); // addTriangle(simplex,Colors.yellow); while (!complex.getStack().isEmpty()) complex.next4Simplex(); /* int size = complex.simplicies[3].getSize(); for (int i = 0; i < size; i++) { simplex = (Simplex)complex.simplicies[3].get(i); addTetrahedron(simplex,Colors.yellow); } */ complex.computeAlphaValues(); SorterSelection sorter = new SorterSelection(); SortToolSimplexAlpha sortTool = new SortToolSimplexAlpha(); sorter.Sort(complex.getSimplicies()[1], sortTool, false); sorter.Sort(complex.getSimplicies()[2], sortTool, false); sorter.Sort(complex.getSimplicies()[3], sortTool, false); complex.toConsole(complex.getSimplicies()[1]); complex.toConsole(complex.getSimplicies()[2]); complex.toConsole(complex.getSimplicies()[3]); } /* if (!complex.points.isEmpty()) { while (!complex.stack.isEmpty()) complex.next4Simplex(); int size = complex.simplicies[3].getSize(); for (int i = 0; i < size; i++) { simplex = (Simplex)complex.simplicies[3].get(i); addTetrahedron(simplex,Colors.yellow); } } */ } else if ("Step".equals(cmd)) stepSimplicies3(); // stepSimplicies23 also available else if ("Step1".equals(cmd)) { if (complex.isEmpty()) { Simplex simplex = complex.first3Simplex(); addTriangle(simplex, Colors.yellow); } Simplex simplex = complex.next4Simplex(); if (simplex != null) addTetrahedron(simplex, Colors.yellow); } else if ("Save".equals(cmd)) { try { BufferedWriter bw = new BufferedWriter(new FileWriter("data")); PrintWriter out = new PrintWriter(bw); int size = complex.getPoints().getSize(); Point3d p; for (int i = 0; i < size; i++) { p = (Point3d) complex.getPoints().get(i); out.print(p.getX() + " " + p.getY() + " " + p.getZ() + '\n'); } out.close(); } catch (IOException e) { System.out.println("IOException error!"); e.printStackTrace(); } } else if ("Load".equals(cmd)) { complex.clear(); spin.removeAllChildren(); geom3d.PointSet3d points = new PointSet3d("data"); int size = points.getSize(); Point3d point; for (int i = 0; i < size; i++) { point = (Point3d) points.get(i); complex.getPoints().insert(point); Simplex simplex = new Simplex(i); complex.insert(simplex); addSphere(simplex, 0.02f, Colors.red); } } else if ("PDB".equals(cmd)) { complex.clear(); spin.removeAllChildren(); Protein protein = new Protein("1CR4", 0, true); PointSet3d points = protein.getPointSet(); points.translate(points.getCentroid()); int size = points.getSize(); Point3d point; for (int i = 0; i < size; i++) { point = (Point3d) points.get(i); complex.getPoints().insert(point); Simplex simplex = new Simplex(i); complex.insert(simplex); addSphere(simplex, 0.02f, Colors.red); } // new InputPanelPDBApplet(this); } else if ("Point".equals(cmd)) { /* ap.setPolygonAttributes(new PolygonAttributes(PolygonAttributes.POLYGON_POINT, PolygonAttributes.CULL_BACK, 0)); ap.setPointAttributes(new PointAttributes(5, false)); } else if ("Line".equals(cmd)) { /* ap.setPolygonAttributes(new PolygonAttributes(PolygonAttributes.POLYGON_LINE, PolygonAttributes.CULL_BACK, 0)); ap.setLineAttributes(new LineAttributes(2, LineAttributes.PATTERN_DASH,false)); */ } else if ("Polygon".equals(cmd)) { // ap.setPolygonAttributes(new PolygonAttributes(PolygonAttributes.POLYGON_FILL, // PolygonAttributes.CULL_BACK, 0)); } else if ("Gouraud".equals(cmd)) { /* ColoringAttributes ca = new ColoringAttributes(); ca.setShadeModel(ColoringAttributes.SHADE_GOURAUD); ap.setColoringAttributes(ca); ap.setMaterial(null); RenderingAttributes ra = new RenderingAttributes(); ra.setIgnoreVertexColors(false); ap.setRenderingAttributes(ra); */ } else if ("Lighting".equals(cmd)) { /* ap.setMaterial(new Material()); RenderingAttributes ra = new RenderingAttributes(); ra.setIgnoreVertexColors(true); ap.setRenderingAttributes(ra); */ } }