Browse Source

Swp2 plot but reversed

tforest 1 year ago
parent
commit
592b16e7f3
3 changed files with 8 additions and 744 deletions
  1. 0 743
      dependences/pybam.py~
  2. 1 1
      sfs_tools.py
  3. 7 0
      swp2.py

File diff suppressed because it is too large
+ 0 - 743
dependences/pybam.py~


+ 1 - 1
sfs_tools.py View File

241
             # then plot a theoritical distribution as 1/i
241
             # then plot a theoritical distribution as 1/i
242
             expected_y = [1/(2*x+1) for x in list(sfs.keys())]
242
             expected_y = [1/(2*x+1) for x in list(sfs.keys())]
243
             print(sum(expected_y))
243
             print(sum(expected_y))
244
-            plt.plot([x for x in list(sfs.keys())], expected_y, color='r', linestyle='-')
244
+            #plt.plot([x for x in list(sfs.keys())], expected_y, color='r', linestyle='-')
245
             #print(expected_y)
245
             #print(expected_y)
246
             
246
             
247
     customgraphics.barplot(x = [x for x in list(sfs.keys())], y= sfs_val, xlab = xlab, ylab = ylab, title = title)
247
     customgraphics.barplot(x = [x for x in list(sfs.keys())], y= sfs_val, xlab = xlab, ylab = ylab, title = title)

+ 7 - 0
swp2.py View File

35
     # list of thetas 
35
     # list of thetas 
36
     theta_L = []
36
     theta_L = []
37
     sum_t = 0
37
     sum_t = 0
38
+    #groups.sort(reverse=True)
38
     for group_nb, group in enumerate(groups):
39
     for group_nb, group in enumerate(groups):
40
+        print(group_nb, group)
39
         # store all the thetas one by one, with one theta per group
41
         # store all the thetas one by one, with one theta per group
40
         theta_L.append(float(theta_site[group_nb]))
42
         theta_L.append(float(theta_site[group_nb]))
41
         # if the group is of size 1
43
         # if the group is of size 1
58
         sum_t = t[i]
60
         sum_t = t[i]
59
     # build the y axis (sizes)
61
     # build the y axis (sizes)
60
     y = []
62
     y = []
63
+    #theta_L.sort(reverse=True)
61
     for theta in theta_L:
64
     for theta in theta_L:
62
         # with size N = theta/4mu
65
         # with size N = theta/4mu
63
         size = theta / (4*mu)
66
         size = theta / (4*mu)
64
         y.append(size)
67
         y.append(size)
65
         y.append(size)
68
         y.append(size)
69
+    
66
     # build the time x axis
70
     # build the time x axis
67
     x = [0]
71
     x = [0]
68
     for time in range(0, len(t.values())-1):
72
     for time in range(0, len(t.values())-1):
70
         x.append(list(t.values())[time])
74
         x.append(list(t.values())[time])
71
     x.append(list(t.values())[len(t.values())-1])
75
     x.append(list(t.values())[len(t.values())-1])
72
 
76
 
77
+    #x.sort(reverse=True)
78
+    #y.sort(reverse=True)
79
+    
73
     return x,y,likelihood
80
     return x,y,likelihood
74
 
81
 
75
 def plot_3epochs_thetafolder(folder_path, mu, tgen, breaks = 2, title = "Title"):
82
 def plot_3epochs_thetafolder(folder_path, mu, tgen, breaks = 2, title = "Title"):