jeudi 2 janvier 2020

How to count a matching pattern in one line?

enter code hereI have a fasta file containing sequences

lcl|QCYY01003067.1_cds_ROT65593.1_2 ATGCGTCTCCCCTTTAGAGAGTTCTCTCTAGCTACGTA lcl|QCYY01003067.1_cds_ROT65593.1_3 ATCTCTNNNNNNNNNNATATCCCCTTTNNNNNCTCTCT lcl|QCYY01003067.1_cds_ROT65593.1_4 ATCTCTNNNNNNNNNNATATCCCCTTCTCGGGGCCCC

I wanted to count the number of 'N' and also the number of patterns occurring in each line. No need to include header (>lcl|QCYY01003067.1_cds_ROT65593.1_2 )

eg:-

 line 2=0,0
 line 4=15,2
 line 6=10,1

How to improve this code:

grep -n '[{N}]' <filename> | cut -d : -f 1 | uniq -c

Aucun commentaire:

Enregistrer un commentaire