2222
2323import org .biojava .nbio .structure .Atom ;
2424import org .biojava .nbio .structure .Calc ;
25+ import org .biojava .nbio .structure .Chain ;
2526import org .biojava .nbio .structure .cluster .SubunitCluster ;
2627import org .biojava .nbio .structure .symmetry .geometry .MomentsOfInertia ;
2728import org .biojava .nbio .structure .symmetry .utils .SymmetryTools ;
@@ -51,6 +52,7 @@ public class QuatSymmetrySubunits {
5152
5253 private List <Integer > folds = new ArrayList <Integer >();
5354 private List <Integer > clusterIds = new ArrayList <Integer >();
55+ private List <SubunitCluster > clusters ;
5456
5557 private Point3d centroid ;
5658 private MomentsOfInertia momentsOfInertia = new MomentsOfInertia ();
@@ -63,6 +65,8 @@ public class QuatSymmetrySubunits {
6365 */
6466 public QuatSymmetrySubunits (List <SubunitCluster > clusters ) {
6567
68+ this .clusters = clusters ;
69+
6670 // Loop through all subunits in the clusters and fill Lists
6771 for (int c = 0 ; c < clusters .size (); c ++) {
6872
@@ -82,7 +86,7 @@ public QuatSymmetrySubunits(List<SubunitCluster> clusters) {
8286
8387 // List number of members in each cluster
8488 List <Integer > stoichiometries = clusters .stream ().map (c -> c .size ())
85- .collect (Collectors .toList ());
89+ .collect (Collectors .toList ());
8690 folds = SymmetryTools .getValidFolds (stoichiometries );
8791 }
8892
@@ -94,6 +98,52 @@ public List<Integer> getClusterIds() {
9498 return clusterIds ;
9599 }
96100
101+ /**
102+ * This method is provisional and should only be used for coloring Subunits.
103+ * A new coloring schema has to be implemented to allow the coloring of
104+ * Subunits, without implying one Subunit = one Chain.
105+ *
106+ * @return A List of the Chain Ids of each Subunit
107+ */
108+ public List <String > getChainIds () {
109+ return clusters
110+ .stream ()
111+ .map (c -> c .getSubunits ().get (0 ).getRepresentativeAtoms ()[0 ]
112+ .getGroup ().getChainId ()).collect (Collectors .toList ());
113+ }
114+
115+ /**
116+ * This method is provisional and should only be used for coloring Subunits.
117+ * A new coloring schema has to be implemented to allow the coloring of
118+ * Subunits, without implying one Subunit = one Chain.
119+ *
120+ * @return A List of the Model number of each Subunit
121+ */
122+ public List <Integer > getModelNumbers () {
123+ List <Integer > models = new ArrayList <Integer >(clusterIds .size ());
124+
125+ // Loop through all subunits in the clusters and fill Lists
126+ for (int c = 0 ; c < clusters .size (); c ++) {
127+ for (int s = 0 ; s < clusters .get (c ).size (); s ++) {
128+
129+ Atom [] atoms = clusters .get (c ).getAlignedAtomsSubunit (s );
130+
131+ // TODO guess them chain and model (very ugly)
132+ Chain chain = atoms [0 ].getGroup ().getChain ();
133+
134+ int model = 0 ;
135+ for (int m = 0 ; m < chain .getStructure ().nrModels (); m ++) {
136+ if (chain .getStructure ().getModel (m ).contains (chain )) {
137+ model = m ;
138+ break ;
139+ }
140+ }
141+ models .add (model );
142+ }
143+ }
144+ return models ;
145+ }
146+
97147 public int getSubunitCount () {
98148 run ();
99149 if (centers == null ) {
0 commit comments