@@ -7894,9 +7894,6 @@ def _full_color_list(top, df, colors=None) -> _DF:
7894
7894
7895
7895
The main idea is to incorporate per-residue color values
7896
7896
7897
- Main ideas:
7898
- * Create
7899
-
7900
7897
Parameters
7901
7898
----------
7902
7899
top : :obj:`~mdtraj.Topology`
@@ -7925,13 +7922,21 @@ def _full_color_list(top, df, colors=None) -> _DF:
7925
7922
if colors is None :
7926
7923
_colors = list (_mdcplots .color_dict_guesser ("tab10" , _np .arange (len (frags_from_df ))).values ())
7927
7924
jdf ["frag_color" ] = list (_mdcflare ._utils .col_list_from_input_and_fragments (_colors , frags_from_df ))
7925
+ one_intf_frag = _np .unique (jdf ["interface fragment" ])
7926
+ if len (one_intf_frag )== 1 :
7927
+ assert jdf ["self interface residx" ].any (), ValueError ("If there's only one interface fragment, "
7928
+ "then there should be some shared residues between interface members" )
7929
+ #For the purposes of the flareplot we'll split the shared residxs
7930
+ jdf .loc [jdf ["self interface residx" ], "interface fragment" ] = {1 : 0 ,
7931
+ 0 : 1 }[one_intf_frag [0 ]]
7932
+
7928
7933
else :
7929
7934
jdf ["frag_color" ] = list (_mdcflare ._utils .col_list_from_input_and_fragments (colors , frags_from_df ))
7930
7935
7931
7936
if "interface fragment" in df .keys ():
7932
- # TODO do this from self.interface_indices
7933
- intf_from_df = [_np .flatnonzero (df ["interface fragment" ] == ii ) for ii in
7934
- df [ ~ df ["interface fragment" ].isnull ()]["interface fragment" ].unique ()]
7937
+ # TODO do this from self.interface_indices or with groupby
7938
+ intf_from_df = [_np .flatnonzero (jdf ["interface fragment" ] == ii ) for ii in
7939
+ jdf [ ~ jdf ["interface fragment" ].isnull ()]["interface fragment" ].unique ()]
7935
7940
intf_colors = [None ] * top .n_residues
7936
7941
if colors is None :
7937
7942
if len (frags_from_df )== 1 : #means no fragments, TODO think about other way of infering this
0 commit comments