0

I have a text file with some lines as follows

3NHE,A,503,LYS,NZ,10.246915660855539,positive,A,444,PRO,CB 3NHE,A,440,ASP,OD1,11.166332392875592,positive,A,439,TRP,CB 3NHE,B,42,ARG,NH1,8.076673650559258,positive,B,44,ILE,CD1 3NHE,B,6,LYS,NZ,6.366139095873315,positive,A,489,PHE,CD2 3NHE,A,503,LYS,NZ,10.246915660855539,positive,A,444,PRO,CG 3NHE,A,503,LYS,NZ,10.246915660855539,positive,B,70,VAL,CB 3NHE,B,6,LYS,NZ,6.366139095873315,positive,A,444,PRO,CG 3NHE,B,76,GLY,OXT,4.547711997741236,positive,A,277,PHE,CB

I want to calculate the number of times the words ‘ASP and ‘LYS’ has occured in the whole file Can somebody please tell me how to do this? Example answer is

ASP: 5 LYS: 4

1 Answers1

0

Assuming that you have already loaded the data, you can see here how to count the number of occurrences of a substring inside a string:

Count number of occurrences of a given substring in a string

Kamuish
  • 118
  • 6