Browse Source

Swp2 plot but reversed

tforest 8 months 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,7 +241,7 @@ def barplot_sfs(sfs,  xlab, ylab, folded=True, title = "Barplot", transformed =
241 241
             # then plot a theoritical distribution as 1/i
242 242
             expected_y = [1/(2*x+1) for x in list(sfs.keys())]
243 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 245
             #print(expected_y)
246 246
             
247 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,7 +35,9 @@ def return_x_y_from_stwp_theta_file(stwp_theta_file, breaks, mu, tgen):
35 35
     # list of thetas 
36 36
     theta_L = []
37 37
     sum_t = 0
38
+    #groups.sort(reverse=True)
38 39
     for group_nb, group in enumerate(groups):
40
+        print(group_nb, group)
39 41
         # store all the thetas one by one, with one theta per group
40 42
         theta_L.append(float(theta_site[group_nb]))
41 43
         # if the group is of size 1
@@ -58,11 +60,13 @@ def return_x_y_from_stwp_theta_file(stwp_theta_file, breaks, mu, tgen):
58 60
         sum_t = t[i]
59 61
     # build the y axis (sizes)
60 62
     y = []
63
+    #theta_L.sort(reverse=True)
61 64
     for theta in theta_L:
62 65
         # with size N = theta/4mu
63 66
         size = theta / (4*mu)
64 67
         y.append(size)
65 68
         y.append(size)
69
+    
66 70
     # build the time x axis
67 71
     x = [0]
68 72
     for time in range(0, len(t.values())-1):
@@ -70,6 +74,9 @@ def return_x_y_from_stwp_theta_file(stwp_theta_file, breaks, mu, tgen):
70 74
         x.append(list(t.values())[time])
71 75
     x.append(list(t.values())[len(t.values())-1])
72 76
 
77
+    #x.sort(reverse=True)
78
+    #y.sort(reverse=True)
79
+    
73 80
     return x,y,likelihood
74 81
 
75 82
 def plot_3epochs_thetafolder(folder_path, mu, tgen, breaks = 2, title = "Title"):