MaayanLab/clustergrammer-widget

Clustergrammer- Network load_file : Passing filename dynamically

Opened this issue · 4 comments

Hi,

We trying to pass the filename dynamically in 'make_clustergrammer.py', each call the text file name will be different.

fileName = sys.argv[1:]
loadFile = ''.join(fileName)
decoded_string = bytes(loadFile, "utf-8").decode("unicode_escape") # python3

load matrix tsv file

tempassign = decoded_string.replace('"','')
confilename = 'txt/' + tempassign + '.' + 'txt'
print(confilename )
net.load_file(confilename)

Error which i m getting as follows,

FileNotFoundError: [Errno 2] No such file or directory: 'txt/.txt'

1 . assigned variable is empty
2. I m communicating python script from nodejs.

Pls help me out, i got stuck with this more than a week.

Really, this clustergrammer is what needed exactly for our project.

We using MEAN(MongoDb, ExpressJS, Angular 4, NodeJs).

Thanks in advance.

Hi,

It sounds like you are using the base Clustergrammer-PY library and not this widget. Your error

FileNotFoundError: [Errno 2] No such file or directory: 'txt/.txt'

looks like your tempassign string variable is empty. I would check (e.g. print out the variable) that you are setting this variable correctly. Or try first 'hardwiring' the variable, e.g. explicitly set tempassign to what is needs to be for testing purposes. I'm not sure I understand your setup; are you running a node.js server that is executing the Python script?

Let us know if that helps out.

Best,
Nick

Hi Nick,
Thanks for your response,

  1. Yes i m running a node.js server that is executing the Python script using 'Python - Shell' npm.
  2. When i hard coded the 'tempassign', it is working as expected.

Actual prob is when i assign the argv[1:] to a variable and use that variable as parameter for 'net.load_file('filename')', it is empty.

Hard code:
capture

capture1

capture 2

Thanks in advance.

Hi,

You raised another issue in the Clustergrammer-PY library. Does this mean that you resolved this issue?

Best,
Nick

Nope, i kept that on hold.
Bypassed that issue by passing static file path.

Need to work on that later.

Thanks in advance.