{"id":407,"date":"2025-01-17T16:19:18","date_gmt":"2025-01-17T08:19:18","guid":{"rendered":"https:\/\/www.kz-hub.tech\/?p=407"},"modified":"2025-02-24T08:43:43","modified_gmt":"2025-02-24T00:43:43","slug":"%e4%bd%bf%e7%94%a8facets%e8%bf%9b%e8%a1%8c%e8%82%bf%e7%98%a4%e6%8b%b7%e8%b4%9d%e6%95%b0%e6%8e%a8%e6%96%ad","status":"publish","type":"post","link":"https:\/\/www.kz-hub.tech\/index.php\/2025\/01\/17\/%e4%bd%bf%e7%94%a8facets%e8%bf%9b%e8%a1%8c%e8%82%bf%e7%98%a4%e6%8b%b7%e8%b4%9d%e6%95%b0%e6%8e%a8%e6%96%ad\/","title":{"rendered":"\u4f7f\u7528facets\u8fdb\u884c\u80bf\u7624\u62f7\u8d1d\u6570\u63a8\u65ad"},"content":{"rendered":"<p><a href=\"https:\/\/github.com\/dariober\/cnv_facets\">github dariober\/cnv_facets \u5b98\u7f51<\/a><\/p>\n<h2>\u5b89\u88c5 cnv_facets \u5e76\u51c6\u5907\u6587\u4ef6<\/h2>\n<pre><code class=\"language-bash\">conda create -n facets\nconda activate facets\n\nconda install bioconda::cnv_facets\n\n# \u4e0b\u8f7dsnp\u6587\u4ef6: \n# https:\/\/ftp.ncbi.nih.gov\/snp\/organisms\/human_9606\/VCF\/00-common_all.vcf.gz\ngunzip common_all.vcf.gz\n\n# \u67e5\u770b\u67d3\u8272\u4f53\u7f16\u53f7\u683c\u5f0f\u6709\u65e0chr\nawk &#039;!\/^#\/ {print $1}&#039; 00-common_all.vcf | sort -u\n\n# \u5bf9\u9664\u4e86\u6709#\u7684\u884c\u6dfb\u52a0chr\uff1a\nsed &#039;\/^#\/!s\/^\/chr\/&#039; 00-common_all.vcf &gt; 00-common_all_chr.vcf\nbgzip 00-common_all_chr.vcf\ntabix 00-common_all_chr.vcf.gz\nbgzip 00-common_all.vcf\n<\/code><\/pre>\n<h2>\u8fd0\u884cfacets<\/h2>\n<h3>1. \u4f7f\u7528\u65b9\u6cd5\u4e00\uff1aBAM &amp; VCF input (\u4f1a\u753b\u56fe\uff0c\u751f\u6210vcf\u6587\u4ef6\uff0c\u4e0d\u597d\u7528)<\/h3>\n<pre><code>perl -ne &#039;chomp; next if \/^$\/; @a = split \/\\t\/; print &quot;cnv_facets.R -t ..\/align\/$a[0]_bqsr.bam -n ..\/align\/$a[1]_bqsr.bam -vcf \/data02\/zhangmengmeng\/database\/dbSNP\/00-common_all_chr.vcf.gz -o $a[0] &amp;&amp; echo $a[0] facets ok\\n&quot;&#039; sample_pair.txt &gt; Runfacets.sh<\/code><\/pre>\n<h3>2. \u4f7f\u7528\u65b9\u6cd5\u4e8c\uff1aPileup input (\u53ef\u4ee5\u8f93\u51fa\u80bf\u7624\u500d\u6027\u6587\u4ef6\u4ee5\u53caCN\u8868\u683c\uff0c\u597d\u7528)<\/h3>\n<p>This pileup file is generated by cnv_facets.R when run with bam input as in option 1. If you need to explore different parameter values for CNV detection, using a pre-made pileup file can save considerable computing time.<\/p>\n<pre><code>perl -ne &#039;chomp;next if($_=~\/^$\/);my @a=split \/\\t\/;print &quot;snp-pileup -A -p -v \/data02\/zhangmengmeng\/database\/dbSNP\/00-common_all_chr.vcf.gz $a[0].txt ..\/align\/$a[1]_bqsr.bam ..\/align\/$a[0]_bqsr.bam &amp;&amp; cp \/data02\/zhangmengmeng\/software\/facets_demo.R $a[0].R &amp;&amp; sed -i \\&quot;s\/example\/$a[0]\/\\&quot; $a[0].R &amp;&amp; Rscript $a[0].R &amp;&amp; echo $a[0] facets ok\\n&quot;&#039; sample_pair.txt &gt;CreateFacetsPileup.sh\n\nls *_cncf.xls|perl -ne &#039;chomp;if($_=~\/(\\S+)\\_cncf.xls\/){print &quot;perl \/data02\/zhangmengmeng\/software\/annovar\/facets_annovar.pl $_ &gt;$1.cnv.annovar &amp;&amp; perl \/data02\/zhangmengmeng\/software\/annovar\/annotate_variation.pl -buildver hg38 $1.cnv.annovar \/data02\/zhangmengmeng\/database\/annovar_db\/humandb_hg38 &amp;&amp; perl \/data02\/zhangmengmeng\/software\/annovar\/annotate_variation.pl -regionanno -build hg38 -out $1.cnv.annovar -dbtype cytoBand $1.cnv.annovar \/data02\/zhangmengmeng\/database\/annovar_db\/humandb_hg38 &amp; echo $1 facets annovar ok\\n&quot;}&#039; &gt; facets.annovar.sh<\/code><\/pre>\n<h4>facets_demo.R<\/h4>\n<pre><code class=\"language-R\">library(facets)\nrcmat&lt;-readSnpMatrix(&quot;example.txt&quot;, perl.pileup=F)\nset.seed(1234)\nxx=preProcSample(rcmat)\noo=procSample(xx)\nfit=emcncf(oo)\ninfo&lt;-c(fit$purity, fit$ploidy)\nwrite.table(info, file=&quot;example_info.xls&quot;, sep=&quot;\\t&quot;,quote=T,col.names=T,row.names=T)\nwrite.table(fit$cncf, file=&quot;example_cncf.xls&quot;, sep=&quot;\\t&quot;,quote=T,col.names=T,row.names=T)<\/code><\/pre>\n<h4>facets_annovar.pl<\/h4>\n<pre><code>#!\/usr\/bin\/perl\nuse strict;\nuse File::Basename qw(basename dirname);\n\nmy $file=shift;\nopen(FILE,$file)||die&quot;can&#039;t open the cnv file\\n&quot;;\n\nwhile (&lt;FILE&gt;) {\n    chomp;\n    $_=~s\/\\&quot;\/\/g;\n    my @temp=split \/\\t\/;\n    next if($_=~\/NA\/ || $temp[3]&lt;100 || $temp[-2]==2);\n    if ($temp[-2]&gt;2) {\n        print &quot;chr$temp[1]\\t$temp[-5]\\t$temp[-4]\\t0\\t0\\tGain\\t$temp[-3]\\t$temp[-2]\\t$temp[-1]\\n&quot;;\n    }elsif($temp[-2]&lt;2){\n        print &quot;chr$temp[1]\\t$temp[-5]\\t$temp[-4]\\t0\\t0\\tLoss\\t$temp[-3]\\t$temp[-2]\\t$temp[-1]\\n&quot;;\n    }\n}\nclose FILE;<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>github dariober\/cnv_facets \u5b98\u7f51 \u5b89\u88c5 cnv_facets \u5e76\u51c6\u5907\u6587\u4ef6 conda&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-407","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/www.kz-hub.tech\/index.php\/wp-json\/wp\/v2\/posts\/407","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.kz-hub.tech\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.kz-hub.tech\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.kz-hub.tech\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.kz-hub.tech\/index.php\/wp-json\/wp\/v2\/comments?post=407"}],"version-history":[{"count":12,"href":"https:\/\/www.kz-hub.tech\/index.php\/wp-json\/wp\/v2\/posts\/407\/revisions"}],"predecessor-version":[{"id":454,"href":"https:\/\/www.kz-hub.tech\/index.php\/wp-json\/wp\/v2\/posts\/407\/revisions\/454"}],"wp:attachment":[{"href":"https:\/\/www.kz-hub.tech\/index.php\/wp-json\/wp\/v2\/media?parent=407"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.kz-hub.tech\/index.php\/wp-json\/wp\/v2\/categories?post=407"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.kz-hub.tech\/index.php\/wp-json\/wp\/v2\/tags?post=407"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}