Try to call the REST APIs provided by Enrichr from Matlab, but webwrite does not work
Trying to translate a piece of Python code below to Matlab. The Python code is provided by Enrichr (see maayanlab.cloud/Enrichr/help#api) as an example for calling its REST APIs.
%{
% – this is the Python code
import json
import requests
ENRICHR_URL = ‘https://maayanlab.cloud/Enrichr/addList’
genes_str = ‘n’.join([
‘PHF14’, ‘RBM3’, ‘MSL1’, ‘PHF21A’, ‘ARL10’, ‘INSR’, ‘JADE2’, ‘P2RX7’,
‘LINC00662’, ‘CCDC101’, ‘PPM1B’, ‘KANSL1L’, ‘CRYZL1’, ‘ANAPC16’, ‘TMCC1’,
‘CDH8’, ‘RBM11’, ‘CNPY2’, ‘HSPA1L’, ‘CUL2’, ‘PLBD2’, ‘LARP7’, ‘TECPR2’,
‘ZNF302’, ‘CUX1’, ‘MOB2’, ‘CYTH2’, ‘SEC22C’, ‘EIF4E3’, ‘ROBO2’,
‘ADAMTS9-AS2’, ‘CXXC1’, ‘LINC01314’, ‘ATF7’, ‘ATP5F1’
])
description = ‘Example gene list’
payload = {
‘list’: (None, genes_str),
‘description’: (None, description)
}
response = requests.post(ENRICHR_URL, files=payload)
%}
% – this is the Matlab code
ENRICHR_URL = ‘https://maayanlab.cloud/Enrichr/addList’;
genes = {‘PHF14’, ‘RBM3’, ‘MSL1’, ‘PHF21A’, ‘ARL10’, ‘INSR’, ‘JADE2’, ‘P2RX7’, …
‘LINC00662’, ‘CCDC101’, ‘PPM1B’, ‘KANSL1L’, ‘CRYZL1’, ‘ANAPC16’, ‘TMCC1’, …
‘CDH8’, ‘RBM11’, ‘CNPY2’, ‘HSPA1L’, ‘CUL2’, ‘PLBD2’, ‘LARP7’, ‘TECPR2’, …
‘ZNF302’, ‘CUX1’, ‘MOB2’, ‘CYTH2’, ‘SEC22C’, ‘EIF4E3’, ‘ROBO2’, …
‘ADAMTS9-AS2’, ‘CXXC1’, ‘LINC01314’, ‘ATF7’, ‘ATP5F1’};
genes_str = strjoin(genes, newline);
description = ‘Example gene list’;
options = weboptions(‘MediaType’, ‘application/json’);
payload(1).(‘list’) = [];
payload(2).(‘list’) = genes_str;
payload(1).(‘description’) = [];
payload(2).(‘description’) = description;
%payload = struct(‘list’, {string(missing), genes_str}, …
% ‘description’, {string(missing), description});
response = webwrite(ENRICHR_URL, payload, options)
But, the translated Matlab code does not work. Any suggestions would be greatly apprecaited.Trying to translate a piece of Python code below to Matlab. The Python code is provided by Enrichr (see maayanlab.cloud/Enrichr/help#api) as an example for calling its REST APIs.
%{
% – this is the Python code
import json
import requests
ENRICHR_URL = ‘https://maayanlab.cloud/Enrichr/addList’
genes_str = ‘n’.join([
‘PHF14’, ‘RBM3’, ‘MSL1’, ‘PHF21A’, ‘ARL10’, ‘INSR’, ‘JADE2’, ‘P2RX7’,
‘LINC00662’, ‘CCDC101’, ‘PPM1B’, ‘KANSL1L’, ‘CRYZL1’, ‘ANAPC16’, ‘TMCC1’,
‘CDH8’, ‘RBM11’, ‘CNPY2’, ‘HSPA1L’, ‘CUL2’, ‘PLBD2’, ‘LARP7’, ‘TECPR2’,
‘ZNF302’, ‘CUX1’, ‘MOB2’, ‘CYTH2’, ‘SEC22C’, ‘EIF4E3’, ‘ROBO2’,
‘ADAMTS9-AS2’, ‘CXXC1’, ‘LINC01314’, ‘ATF7’, ‘ATP5F1’
])
description = ‘Example gene list’
payload = {
‘list’: (None, genes_str),
‘description’: (None, description)
}
response = requests.post(ENRICHR_URL, files=payload)
%}
% – this is the Matlab code
ENRICHR_URL = ‘https://maayanlab.cloud/Enrichr/addList’;
genes = {‘PHF14’, ‘RBM3’, ‘MSL1’, ‘PHF21A’, ‘ARL10’, ‘INSR’, ‘JADE2’, ‘P2RX7’, …
‘LINC00662’, ‘CCDC101’, ‘PPM1B’, ‘KANSL1L’, ‘CRYZL1’, ‘ANAPC16’, ‘TMCC1’, …
‘CDH8’, ‘RBM11’, ‘CNPY2’, ‘HSPA1L’, ‘CUL2’, ‘PLBD2’, ‘LARP7’, ‘TECPR2’, …
‘ZNF302’, ‘CUX1’, ‘MOB2’, ‘CYTH2’, ‘SEC22C’, ‘EIF4E3’, ‘ROBO2’, …
‘ADAMTS9-AS2’, ‘CXXC1’, ‘LINC01314’, ‘ATF7’, ‘ATP5F1’};
genes_str = strjoin(genes, newline);
description = ‘Example gene list’;
options = weboptions(‘MediaType’, ‘application/json’);
payload(1).(‘list’) = [];
payload(2).(‘list’) = genes_str;
payload(1).(‘description’) = [];
payload(2).(‘description’) = description;
%payload = struct(‘list’, {string(missing), genes_str}, …
% ‘description’, {string(missing), description});
response = webwrite(ENRICHR_URL, payload, options)
But, the translated Matlab code does not work. Any suggestions would be greatly apprecaited. Trying to translate a piece of Python code below to Matlab. The Python code is provided by Enrichr (see maayanlab.cloud/Enrichr/help#api) as an example for calling its REST APIs.
%{
% – this is the Python code
import json
import requests
ENRICHR_URL = ‘https://maayanlab.cloud/Enrichr/addList’
genes_str = ‘n’.join([
‘PHF14’, ‘RBM3’, ‘MSL1’, ‘PHF21A’, ‘ARL10’, ‘INSR’, ‘JADE2’, ‘P2RX7’,
‘LINC00662’, ‘CCDC101’, ‘PPM1B’, ‘KANSL1L’, ‘CRYZL1’, ‘ANAPC16’, ‘TMCC1’,
‘CDH8’, ‘RBM11’, ‘CNPY2’, ‘HSPA1L’, ‘CUL2’, ‘PLBD2’, ‘LARP7’, ‘TECPR2’,
‘ZNF302’, ‘CUX1’, ‘MOB2’, ‘CYTH2’, ‘SEC22C’, ‘EIF4E3’, ‘ROBO2’,
‘ADAMTS9-AS2’, ‘CXXC1’, ‘LINC01314’, ‘ATF7’, ‘ATP5F1’
])
description = ‘Example gene list’
payload = {
‘list’: (None, genes_str),
‘description’: (None, description)
}
response = requests.post(ENRICHR_URL, files=payload)
%}
% – this is the Matlab code
ENRICHR_URL = ‘https://maayanlab.cloud/Enrichr/addList’;
genes = {‘PHF14’, ‘RBM3’, ‘MSL1’, ‘PHF21A’, ‘ARL10’, ‘INSR’, ‘JADE2’, ‘P2RX7’, …
‘LINC00662’, ‘CCDC101’, ‘PPM1B’, ‘KANSL1L’, ‘CRYZL1’, ‘ANAPC16’, ‘TMCC1’, …
‘CDH8’, ‘RBM11’, ‘CNPY2’, ‘HSPA1L’, ‘CUL2’, ‘PLBD2’, ‘LARP7’, ‘TECPR2’, …
‘ZNF302’, ‘CUX1’, ‘MOB2’, ‘CYTH2’, ‘SEC22C’, ‘EIF4E3’, ‘ROBO2’, …
‘ADAMTS9-AS2’, ‘CXXC1’, ‘LINC01314’, ‘ATF7’, ‘ATP5F1’};
genes_str = strjoin(genes, newline);
description = ‘Example gene list’;
options = weboptions(‘MediaType’, ‘application/json’);
payload(1).(‘list’) = [];
payload(2).(‘list’) = genes_str;
payload(1).(‘description’) = [];
payload(2).(‘description’) = description;
%payload = struct(‘list’, {string(missing), genes_str}, …
% ‘description’, {string(missing), description});
response = webwrite(ENRICHR_URL, payload, options)
But, the translated Matlab code does not work. Any suggestions would be greatly apprecaited. webwrite rest api, enrichr MATLAB Answers — New Questions