本篇内容主要讲解“如何用R语言XML包获得html文件中的表格”,感兴趣的朋友不妨来看看。本文介绍的方法操作简单快捷,实用性强。下面就让小编来带大家学习“如何用R语言XML包获得html文件中的表格”吧!
使用snpEff
软件对vcf
格式文件进行注释后会生成一个snpEff_summary.html
;这个文件是对vcf
格式文件中的内容进行的统计,结果会以表格和图片的形式在html文件里展示。我现在想把html中的数据提取出来,自己来做图。
https://stackoverflow.com/questions/14517732/how-to-get-table-data-from-html-table-in-xml
How to get table data from html table in xml
使用到的R语言代码
library(XML)doc<-htmlParse("snpEff_summary.html")total_table<-getNodeSet(doc,"//table")# 以上代码是固定的写法# 下面的代码想获得第几个表格,中括号中的数字就改成几df3<-readHTMLTable(total_table[[3]])df3class(df3)
结果以数据框的形式存储
vcftools --vcf input.vcf --min-alleles 2 --max-alleles 2 --recode --recode-INFO-all --out output_vcf_prefix
vcftools的帮助文档
--min-alleles <integer> --max-alleles <integer>Include only sites with a number of alleles greater than or equal to the "--min-alleles" value and less than or equal to the "--max-alleles" value. One of these options may be used without the other.For example, to include only bi-allelic sites, one could use:vcftools --vcf file1.vcf --min-alleles 2 --max-alleles 2
到此,相信大家对“如何用R语言XML包获得html文件中的表格”有了更深的了解,不妨来实际操作一番吧!这里是亿速云网站,更多相关内容可以进入相关频道进行查询,关注我们,继续学习!
亿速云「云服务器」,即开即用、新一代英特尔至强铂金CPU、三副本存储NVMe SSD云盘,价格低至29元/月。点击查看>>
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。
原文链接:https://my.oschina.net/u/4579431/blog/4376880