leezx

参见:

Question: How to extract all non-seqenced positions from a genome (Fasta file)?

 

test.fa

>chr1
NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN
NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN
NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNtaaattgttt
taaattgtttctgtttgcagttgacatgatctNNNNNatagaaaacacca
ataactctgccaaaaaatttagaattcataaatgaatttagtaaagttgc
>chr2
NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN
NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN
NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNtaaattgttt
taaattgtttctgtttgcagttgacatgatcttatatatagaaaacacca
ataactctgccaaaaaatttagaattcataaatgaatttagtaaagttgc

  

perl一行命令

perl -ne \'chomp;if( />(.*)/){$head = $1; $i=0; next};@a=split("",$_); foreach(@a){$i++;if($_ eq "N" && $s ==0 ){print "$head\t$i"; $s =1}elsif($s==1 && $_ ne "N"){print "\t$i\n";$s=0}}\' test.fa

 

转为规范化的bed

cat gap.bed | awk \'BEGIN{i=0}{i++;print $1,$5,$6,"Gap"i}\' > gap.2.bed

  

  

 

分类:

技术点:

相关文章:

  • 2022-01-19
  • 2022-12-23
  • 2021-06-21
  • 2022-02-15
  • 2022-01-19
  • 2021-12-18
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-08-13
  • 2021-11-07
  • 2022-01-22
  • 2022-02-02
  • 2021-07-26
相关资源
相似解决方案