当前位置: 首页 > news >正文

js | 网页上的 json 数据怎么保存到本地表格中?

1.思路

  • json 转为 csv 保存到本地
  • 或者:json 转为 html 显示到网页中,然后复制到excel中。

(2) 数据

wjl={"code":1,"data":[{"chrmiRNA":"chr1","0":"chr1","startmiRNA":"17018729","1":"17018729","endmiRNA":"17018752","2":"17018752","myIDmiRNA":"human_miRNA_CLIPdb_3383750","3":"human_miRNA_CLIPdb_3383750","sthmiRNA":"0","4":"0","strandmiRNA":"-","5":"-","miRNA":"hsa-miR-2053","6":"hsa-miR-2053","miRNAenergy":"-4.99","7":"-4.99","miRNAscore":"147","8":"147","techmiRNA":"CLIPdb","9":"CLIPdb","chr":"chr1","10":"chr1","start":"17018721","11":"17018721","end":"17018767","12":"17018767","myIDRBP":"Human_RBP_POSTAR2update_49365","13":"Human_RBP_POSTAR2update_49365","sthRBP":"0","14":"0","strandRBP":"-","15":"-","RBP":"UPF1","16":"UPF1","protocol":"HITS-CLIP,CLIPper","17":"HITS-CLIP,CLIPper","tissueType":"HEK_293_FRT","18":"HEK_293_FRT","rawData":"GSE69586,GSM1704215","19":"GSE69586,GSM1704215","score":"9.16564913093e-65","20":"9.16564913093e-65","chrGene":"chr1","21":"chr1","startGene":"17018721","22":"17018721","endGene":"17018883","23":"17018883","geneID":"ENSG00000117118","24":"ENSG00000117118","sthGene":"0","25":"0","strandGene":"-","26":"-","geneType":"protein_coding","27":"protein_coding","genomicContext":"UTR3","28":"UTR3","geneName":"SDHB","29":"SDHB","PhastCons":"0.643239","30":"0.643239","Phylop":"1.00965","31":"1.00965","l1":"chr1:17018729-17018752","32":"chr1:17018729-17018752","l2":"chr1:17018721-17018767","33":"chr1:17018721-17018767"},{"chrmiRNA":"chr1","0":"chr1","startmiRNA":"17018729","1":"17018729","endmiRNA":"17018752","2":"17018752","myIDmiRNA":"human_miRNA_CLIPdb_3383750","3":"human_miRNA_CLIPdb_3383750","sthmiRNA":"0","4":"0","strandmiRNA":"-","5":"-","miRNA":"hsa-miR-2053","6":"hsa-miR-2053","miRNAenergy":"-4.99","7":"-4.99","miRNAscore":"147","8":"147","techmiRNA":"CLIPdb","9":"CLIPdb","chr":"chr1","10":"chr1","start":"17018721","11":"17018721","end":"17018803","12":"17018803","myIDRBP":"human_RBP_CLIPdb_3285450","13":"human_RBP_CLIPdb_3285450","sthRBP":"0","14":"0","strandRBP":"-","15":"-","RBP":"ATXN2","16":"ATXN2","protocol":"PAR-CLIP,PARalyzer","17":"PAR-CLIP,PARalyzer","tissueType":"HEK293T","18":"HEK293T","rawData":"DRA001158,DRS012390","19":"DRA001158,DRS012390","score":"0.9096663971101061","20":"0.9096663971101061","chrGene":"chr1","21":"chr1","startGene":"17018721","22":"17018721","endGene":"17018883","23":"17018883","geneID":"ENSG00000117118","24":"ENSG00000117118","sthGene":"0","25":"0","strandGene":"-","26":"-","geneType":"protein_coding","27":"protein_coding","genomicContext":"UTR3","28":"UTR3","geneName":"SDHB","29":"SDHB","PhastCons":"0.606463","30":"0.606463","Phylop":"1.01427","31":"1.01427","l1":"chr1:17018729-17018752","32":"chr1:17018729-17018752","l2":"chr1:17018721-17018803","33":"chr1:17018721-17018803"},{"chrmiRNA":"chr1","0":"chr1","startmiRNA":"17018729","1":"17018729","endmiRNA":"17018752","2":"17018752","myIDmiRNA":"human_miRNA_CLIPdb_3383750","3":"human_miRNA_CLIPdb_3383750","sthmiRNA":"0","4":"0","strandmiRNA":"-","5":"-","miRNA":"hsa-miR-2053","6":"hsa-miR-2053","miRNAenergy":"-4.99","7":"-4.99","miRNAscore":"147","8":"147","techmiRNA":"CLIPdb","9":"CLIPdb","chr":"chr1","10":"chr1","start":"17018724","11":"17018724","end":"17018765","12":"17018765","myIDRBP":"Human_RBP_POSTAR2update_49366","13":"Human_RBP_POSTAR2update_49366","sthRBP":"0","14":"0","strandRBP":"-","15":"-","RBP":"UPF1","16":"UPF1","protocol":"HITS-CLIP,CLIPper","17":"HITS-CLIP,CLIPper","tissueType":"HEK_293_FRT","18":"HEK_293_FRT","rawData":"GSE69586,GSM1704216","19":"GSE69586,GSM1704216","score":"7.1365700412e-42","20":"7.1365700412e-42","chrGene":"chr1","21":"chr1","startGene":"17018721","22":"17018721","endGene":"17018883","23":"17018883","geneID":"ENSG00000117118","24":"ENSG00000117118","sthGene":"0","25":"0","strandGene":"-","26":"-","geneType":"protein_coding","27":"protein_coding","genomicContext":"UTR3","28":"UTR3","geneName":"SDHB","29":"SDHB","PhastCons":"0.689293","30":"0.689293","Phylop":"1.16863","31":"1.16863","l1":"chr1:17018729-17018752","32":"chr1:17018729-17018752","l2":"chr1:17018724-17018765","33":"chr1:17018724-17018765"}],"message":"success"}
response=wjl.data

2. 代码1

// todo

3. 代码2

//数字的排序:
//response=response.sort(function(x, y){ return x[16].localeCompare(-y[16]) } )

//字符串按照ascii排序:
response=response.sort(function(x, y){ return x[16].localeCompare(y[16]) } )

mirna_binding_exp_content=""


/*
http://111.198.139.65/script/ajax/postar3_crosstalk.php
*/
species="Human" 

  mirna_binding_exp_content += '<table id="mirna_binding_exp_table" class="table table-striped table-hover">';
  mirna_binding_exp_content += '<thead class="thead-light">';
  mirna_binding_exp_content += '<tr>';
  mirna_binding_exp_content +=
	'<th>RBP</th><th>RBP info </th><th>Tissue type</th><th>Position</th><th>Strand</th><th>CLIP-seq technology and peak calling method</th><th>Score<span class="glyphicon glyphicon-question-sign" title="Piranha score: Peak heights from the CLIP-seq data. &#10;PARalyzer score: T-to-C transition ratio, while higher ratio means more possible to bind RBPs. &#10;MiClip score: Probability of RBP binding. &#10;CIMS (CTK) score: Mismatch (HITS-CLIP) / Truncated (iCLIP) peak heights. &#10;PureCLIP score: Sum of log posterior probability ratio scores. &#10;ENCODE eCLIP score: -log10 P-value. "></span></th><th>PhastCons score</th><th>PhyloP score</th><th>Data accession</th><th>miRNA</th><th>miRNA-binding sites</th><th>Binding energy</th><th>Confidence</th>';
  mirna_binding_exp_content += '</tr>';
  mirna_binding_exp_content += '</thead>';
  mirna_binding_exp_content += '<tbody>';

  for (var i = 0; i < response.length; i++) {
	mirna_binding_exp_content += '<tr>';
	mirna_binding_exp_content +=
	  '<td class="table-success">' +
	  response[i][16] +
	  '</td><td class="table-success">' +
	  "<a target='_blank' href='./motif.php?RBP=" +
	  response[i][16] +
	  '&module=clipdb&species=' +
	  species +
	  "'>" +
	  'info' +
	  '</a>' +
	  '</td><td class="table-success">' +
	  response[i][18] +
	  '</td>';


	mirna_binding_exp_content += '<td class="table-success">' + response[i][33] + '</td>';

	mirna_binding_exp_content +=
	  '<td class="table-success">' +
	  response[i][26] +
	  '</td><td class="table-success">' +
	  response[i][17] +
	  '</td><td class="table-success">' +
	  Number(response[i][20]).toFixed(3) +
	  '</td><td class="table-success">' +
	  Number(response[i][30]).toFixed(3) +
	  '</td><td class="table-success">' +
	  Number(response[i][31]).toFixed(3) +
	  '</td><td class="table-success">' +

	  response[i][19] +
	  '</td><td class="table-danger">' +
	  response[i][6] +
	  '</td><td class="table-danger">' +
	  response[i][32] +
	  '</a>' +
	  '</td><td class="table-danger">' +
	  response[i][7] +
	  '</td><td class="table-danger">' +
	  response[i][8] +
	  '</td>';
	mirna_binding_exp_content += '</tr>';
  }
  mirna_binding_exp_content += '</tbody>';
  mirna_binding_exp_content += '</table>';


//输出到新网页
var newWindowObi=window.open('', "_blank");
//console.log(this);
newWindowObi.document.write(mirna_binding_exp_content )

在这里插入图片描述

然后就可以把网页上的表格复制到excel中了。

Ref

  • http://111.198.139.65/Crosstalk.html

相关文章:

  • NAS-相关软件推荐——非相册和备份的
  • 影刀RPA证书题库包含初级、中级、高级和AP初级
  • Trinity三位一体开源程序是可解释的 AI 分析工具和 3D 可视化
  • try...catch、async/await和Promise区别与联系
  • Openlayers:实现聚合
  • [LeetCode 55] 跳跃游戏
  • 【今日三题】经此一役小红所向无敌(模拟) / 连续子数组最大和(动态规划) / 非对称之美(贪心)
  • 在Ubuntu下进行单片机开发是否需要关闭Secure Boot
  • 扩展欧几里得算法:求解乘法逆元
  • 【MySQL数据库】InnoDB存储引擎:逻辑存储结构、内存架构、磁盘架构
  • 门极驱动器DRV8353M设计(三)
  • OpenCV中的轮廓检测方法详解
  • OpenCV day2
  • 无人船 | 图解基于视线引导(LOS)的无人艇制导算法
  • OpenAI为抢跑AI,安全底线成牺牲品?
  • CA证书的申请及使用流程
  • 记录:安装 Docker Desktop 时直接设置安装路径及容器存储路径
  • 思维与算法共舞:AIGC语言模型的艺术与科学
  • 人力不足导致项目延期,如何补救
  • 【教学类-102-11】蝴蝶外轮廓01——Python对黑白图片进行PS填充三种颜色+图案描边+图案填充白色+制作1图2图6图24图
  • 观察|动力电池步入“多核时代”,宁德时代新技术密集开箱有何启示
  • 重庆一幼儿园回应招聘硕士幼教:统一标准,江北区学前教育岗的硬性要求
  • 涡虫首上太空,神舟二十号任务将开展3项生命科学实验
  • 智飞生物一季度营收下滑79%,连续三个季度亏损,称业绩波动与行业整体趋势一致
  • 对话地铁读书人|豪宅房产经纪人:读书使我免于抑郁
  • 锚定“水库不垮坝”目标,水利部部署今年水库安全度汛工作