supercat666 commited on
Commit
c29b4c5
1 Parent(s): 8e874ac
Files changed (1) hide show
  1. cas9on.py +6 -6
cas9on.py CHANGED
@@ -224,12 +224,12 @@ def create_bigwig(df, bigwig_path):
224
  bw = pyBigWig.open(bigwig_path, "w")
225
  bw.addHeader(header)
226
 
227
- # Add entries for each chromosome
228
- for chr, group in df.groupby('Chr'):
229
- starts = group['Start Pos'].tolist()
230
- ends = group['End Pos'].tolist()
231
- values = group['Prediction'].astype(float).tolist()
232
- bw.addEntries(str(chr), starts, ends=ends, values=values)
233
 
234
  # Close the BigWig file
235
  bw.close()
 
224
  bw = pyBigWig.open(bigwig_path, "w")
225
  bw.addHeader(header)
226
 
227
+ # Create a list of tuples with (chromosome, start, end, value)
228
+ entries = [(row['Chr'], row['Start Pos'], row['End Pos'], row['Prediction'])
229
+ for _, row in df.iterrows()]
230
+
231
+ # Add entries to the BigWig file
232
+ bw.addEntries(entries)
233
 
234
  # Close the BigWig file
235
  bw.close()