I have some sequencing data of multiple patients in pandas dataframe, each patient has one column with genotype (string in format x/x:xxx:xxxx), the number of patients will vary...
I need to do two things with this information, 

1. count frequency of substrings in each genotype column for each row e.g. three patients with genotype: 0/1:xxx:xxxx 0/1:xxxx:xxxx 1/1:xxxx:xxxx:xxxx and I need to get how many times was 0/1 in row into new column df['freq\_01'], how many times was 1/1 in row into df['freq\_11'] etc.
2. I would need to create new column with sample names (name of the column) for each genotype from previous step like:
df['samples\_01]= "S1, S2, S4" (for each row)

I am able to do this by iterating over each row, but I wonder if it is possible to do that by pandas more efficiently.

The original data (in my file there is about 100 000 rows):

```
| id | S1      | S2      | S3      | S4      |
|----|---------|---------|---------|---------|
| 1  | 1/1:5:5 | 0/1:3:3 | 0/1:2:2 | 0/1:7:6 |
| 2  | 0/1:3:3 | 1/1:5:5 | 1/1:5:5 | 0       |
| 3  | 0/1:3:3 | 0       | 0/1:3:3 | 1/1:5:5 |

```

How should look the result:

```
| id | S1      | S2      | S3      | S4      | freq_01 | samples_01 |
|----|---------|---------|---------|---------|---------|------------|
| 1  | 1/1:5:5 | 0/1:3:3 | 0/1:2:2 | 0/1:7:6 | 3       | S2,S3,S4   |
| 2  | 0/1:3:3 | 1/1:5:5 | 1/1:5:5 | 0       | 1       | S1         |
| 3  | 0/1:3:3 | 0       | 0/1:3:3 | 1/1:5:5 | 2       | S1,S3      |

```