GoekeLab / m6anet

Detection of m6A from direct RNA-Seq data
https://m6anet.readthedocs.io/
MIT License
103 stars 19 forks source link

output dictionary with a list of tuples #4

Closed yuukiiwa closed 3 years ago

yuukiiwa commented 3 years ago

Hi @chrishendra93, now this outputs a binary pickle file(data.json) that outputs dictionary with a list of tuples in the format of (norm_mean,norm_std,dwell_time), so you'll need pickle.loads() to load in inference.py. Here is an example code:

import sys, pickle
index_file=open(sys.argv[2],"r")
index_file.readline()
outfile=open("test_load.json","a")
with open(sys.argv[1], 'rb') as f_data:
 for ln in index_file:
  ln=ln.strip().split(",")
  pos_start,pos_end=int(ln[-2]),int(ln[-1])
  f_data.seek(pos_start,0)
  json_str=f_data.read(pos_end-pos_start)
  chunk=pickle.loads(json_str)
  print(chunk,file=outfile)