You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was trying to run the examples and there seemed to be some issues in pyNBS_core.py in this piece of code (lines 77-86):
# Filter columns by network nodes only if network is given
if propNet is not None:
# Check if network node names intersect with somatic mutation matrix column names
# If there is no intersection, throw an error, gene names are not matched
if len(set(list(propNet.nodes)).intersection(set(sm_mat.columns)))==0:
raise ValueError('No mutations found in network nodes. Gene names may be mismatched.')
gind_sample_filt = gind_sample.T.ix[list(propNet.nodes)].fillna(0).T
else:
gind_sample_filt = gind_sample
return gind_sample_filt
Specifically:
This line if len(set(list(propNet.nodes)).intersection(set(sm_mat.columns)))==0:
was always giving a warning because propNet.nodes names were in unicode and sm_mat.columns names were in string format, so the intersection was always 0.
I changed that line to convert propNet.nodes names to string when computing the intersection:
if len(set(list(str(n) for n in propNet.nodes)).intersection(set(sm_mat.columns))) == 0:
I assumed that the following line was meant to add genes in the matrix that were in the network and not in the matrix. The problem is that it actually raised an error when indexing the data frame with values that were not present. I changed this:
Hi Guadalupe,
Thank you for your fixes. You are correct about your assumption in point #2. I think these fixes look fine to me to use. I think the error is the result of your pandas version. Pandas deprecated the '.ix' indexing function when it moved to 0.20+, and I also believe that the correct way to identify nodes in a network in networkx is to call ".nodes" as a function on the graph object now (e.g. propNet.nodes()). Some of these kinds of changes are now causing pyNBS, built on older versions of these dependencies, to throw errors when users have updated version of the package.
Hi,
I was trying to run the examples and there seemed to be some issues in pyNBS_core.py in this piece of code (lines 77-86):
Specifically:
if len(set(list(propNet.nodes)).intersection(set(sm_mat.columns)))==0:
was always giving a warning because propNet.nodes names were in unicode and sm_mat.columns names were in string format, so the intersection was always 0.
I changed that line to convert propNet.nodes names to string when computing the intersection:
if len(set(list(str(n) for n in propNet.nodes)).intersection(set(sm_mat.columns))) == 0:
gind_sample_filt = gind_sample.T.ix[list(propNet.nodes)].fillna(0).T
to:
Please let me know if those change look okay.
Maybe it is something related to the specific python/packages versions I am using. I am running Python 2.7. My pip freeze output is:
The text was updated successfully, but these errors were encountered: