We have two data frames
Data frame 1
sl no. Segment_name Segment
1 Segment1 AACG
2 Segment2 ACTG
3 Segment3 GTCA
Data frame 2
sl no. Dinucleotides Free energy Values
1 AA -1.0
2 AC -1.76
3 CG -1.5
4 CT -1.23
5 TG -1.67
6 GT -1.82
7 TC -1.43
8 CA -1.98
We want to compare the column 'Segment' of Data frame 1 and the column 'Free energy Values' of Data frame 2. Comparison of particular segment with the given free energy values (through a sliding window algorithm i.e. AA, AC, CG respectively for segment1=AACG) would give us the value of -4.26 for the sum of the nucleotides AA,AC,CG respectively of the segment1. We want to repeat the the same for the rest of the segments and store the summation of free energy values in a separate column in the data frame 1 as
sl no. Segment_name Segment Free energy
1 Segment1 AACG -4.26
2 Segment2 ACTG -4.66
3 Segment3 GTCA -5.23