Hi,

How can I get the Internal Stability graph  or short oligonutides, like this one for B1 ([1993 Rychlik][1])

![enter image description here][2]

Also I don't know why the last nucleotides does not match with any value of the graph

I try to get the graph using nearest neighbor dG values, but I cant get a similar graph with the python 2.7 code below, using this approach I can get every value exept for the last nucleotide.

![enter image description here][3]

    def calc_dG(seq):
        NearPairsPlus = ['AA','AC','AG','AT',
                         'CA','CC','CG','CT',
                         'GA','GC','GG','GT',
                         'TA','TC','TG','TT']
        DeltaG =        [-1.9, -1.3, -1.6, -1.5,
                         -1.9, -3.1, -3.6, -1.6,
                         -1.6, -3.1, -3.1, -1.3,
                         -1.0, -1.6, -1.9, -1.9 ]
        c = []
        seq = seq+ ' '
        a = 0
        while a < len(seq):
            b = 0
            nuc = []
            while b < len(NearPairsPlus):
                if seq[a-2:a] == NearPairsPlus[b]:
                    c.append(DeltaG[b])
                b = b + 1
            a = a + 1
        return c
    
    sequence = "ACTTGGGATTGGGCT"
    dG_values = calc_dG(sequence)
    y = dG_values
    x = list(sequence)[:-1]
    
    import matplotlib.pyplot as plt
    
    plt.plot(dG_values)
    plt.gca().invert_yaxis()
    plt.ylabel(r'$\Delta$ G $\left(\frac{kcal}{mol}\right)$')
    plt.show()


  [1]: https://www.ncbi.nlm.nih.gov/pubmed/21400260
  [2]: https://i.snag.gy/DBjuKk.jpg
  [3]: https://i.cubeupload.com/FC5rQv.png
I just solved it, didn't read  that the dG values were from pentamers.

Now I got a similar graph from B1
![enter image description here][1]

    def calc_dG(seq):
        NearPairsPlus = ['AA','AC','AG','AT',
                         'CA','CC','CG','CT',
                         'GA','GC','GG','GT',
                         'TA','TC','TG','TT']
        DeltaG =        [-1.9, -1.3, -1.6, -1.5,
                         -1.9, -3.1, -3.6, -1.6,
                         -1.6, -3.1, -3.1, -1.3,
                         -1.0, -1.6, -1.9, -1.9 ]
        c = []
        seq = seq+ ' '
        a = 0
        while a < len(seq):
            b = 0
            nuc = []
            while b < len(NearPairsPlus):
                if seq[a-2:a] == NearPairsPlus[b]:
                    c.append(DeltaG[b])
                b = b + 1
            a = a + 1
        return c
    
    sequence = "ACTTGGGATTGGGCT"
    dG_values = calc_dG(sequence)
    y = dG_values
    x = list(sequence)[:-1]
    
    dG_pentamers = []
    for i in range(0, len(y)):
        dG_pentamers.append(sum(y[i:i+4]))
        if i+4 == len(y):
            break
    
    import matplotlib.pyplot as plt
    
    y_labels = list(sequence[0:-5])
    y_labels.append(sequence[len(sequence)-5:len(sequence)])
    
    plt.plot(dG_pentamers, marker='o', linestyle=':', color='b')
    
    plt.ylabel(r'$\sum \Delta$ G $\left(\frac{kcal}{mol}\right)$ pentamers')
    plt.xticks(range(len(y_labels)), y_labels)
    plt.gca().axes.set_ylim([-12,-5])
    plt.gca().invert_yaxis()
    plt.show()


  [1]: http://i.imgur.com/AhtXrT5.png