Count words in second and third column when first column value is constant

I want to count values/word occurrence in second and third column of a tab delim txt file, where first column value is same

Input file:

GeneA Pathogenic snp
GeneA Pathogenic snp
GeneA Benign indel
GeneA Likely_pathogenic snp
GeneA Pathogenic indel
GeneB Benign snp
GeneB Pathogenic snp
GeneB Benign indel
GeneC Benign snp
GeneC Likely_pathogenic snp

Expected Output:(tabular format)

Pathogenic Benign Likely_Pathogenic snp indel
GeneA 3 1 1 3 2
GeneB 1 2 0 2 1
GeneC 0 1 1 2 0

According to our system @Lini

It’s been a while since we’ve seen Lini — their last post was 3 years ago.

In three years you should be able to at least write some code that you tried and post any error messages, etc.

1 Like

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.