0
点赞
收藏
分享

微信扫一扫

如何快速将参考基因组拆分为各条染色体序列?

624c95384278 2022-05-31 阅读 68

目录

  • ​​需求​​
  • ​​方法一​​
  • ​​方法二​​

需求

客户反映,完整的基因组太大打不开,要我将之按各条染色体和scaffold拆分。如何快速实现?

方法一

借助工具:

$ pip install pyfaidx
$ faidx -x sequences.fa

方法二

自己写脚本:​​split.pl​

#!/usr/bin/perl

$f = $ARGV[0]; #get the file name

open (INFILE, "<$f")
or die "Can't open: $f $!";

while (<INFILE>) {
$line = $_; 
chomp $line;
if ($line =~ /\>/) { #if has fasta >
close OUTFILE;
$new_file = substr($line,1);
$new_file .= ".fa";
open (OUTFILE, ">$new_file")
or die "Can't open: $new_file $!";
}
print OUTFILE "$line\n";
}
close OUTFILE;

运行:​​perl split.pl sequences.fa​

放到一个目录中,​​gzip -r dir​​一并发给客户。


​​https://www.biostars.org/p/173723/​​​​http://seqanswers.com/forums/archive/index.php/t-32162.html​​



作者:Bioinfarmer,若要及时了解动态信息,请关注同名微信公众号:Bioinfarmer。

举报

相关推荐

0 条评论