您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

43 行
855B

  1. import pandas as pd
  2. import sys, argparse, os
  3. mut = pd.read_table(sys.argv[1])
  4. outFile = open(sys.argv[2],'w')
  5. for row in mut.itertuples():
  6. #d5
  7. if ',' in row.V4:
  8. alt = row.V4.split(',')
  9. alt_len = [len(i) for i in alt]
  10. alt_max = max(alt_len)
  11. else:
  12. alt_max = len(row.V4)
  13. #d6
  14. alt = alt_max
  15. ref = row.V3
  16. pos = int(row.V2)
  17. if len(ref) == 1 and alt == 1:
  18. StartPos = int(pos) -1
  19. EndPos = int(pos)
  20. cate = 'SNV'
  21. elif len(ref) > alt:
  22. StartPos = int(pos) - 1
  23. EndPos = int(pos) + (len(ref) - 1)
  24. cate = 'INDEL'
  25. elif alt > len(ref):
  26. StartPos = int(pos) - 1
  27. EndPos = int(pos) + (alt - 1)
  28. cate = 'INDEL'
  29. elif len(ref) == alt:
  30. StartPos = int(pos) - 1
  31. EndPos = int(pos) + (alt - 1)
  32. cate = 'INDEL'
  33. outline = row.V1 + '\t' + str(StartPos) + '\t' + str(EndPos) + '\t' + str(row.V2) + '\t' + cate + '\n'
  34. outFile.write(outline)