Skip to content

Commit

Permalink
edit
Browse files Browse the repository at this point in the history
  • Loading branch information
jingchunzhu committed Jan 10, 2020
1 parent 072fcbc commit e964f61
Showing 1 changed file with 17 additions and 12 deletions.
29 changes: 17 additions & 12 deletions converter/ArribaToXena.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,18 @@
import sys, os, json, datetime
import requests
# import requests
sys.path.insert(0,os.path.dirname(__file__))
import filearray_convert

suffix = 'arriba.fusions.tsv$'
columns = ['breakpoint1', 'breakpoint2', 'gene1', 'gene2', 'site1', 'site2', 'type', 'direction1', 'direction2',
'reading_frame', 'confidence']

def parseInfo(line):
dic ={}
for item in line.split(";"):
data = item.split("=")
if len(data) == 2:
key, value = data
dic[key] = value
return dic
columns = ['breakpoint1', 'breakpoint2', 'gene1', 'gene2', 'site1', 'site2', 'strand1',
'type', 'direction1', 'direction2', 'fusion_transcript', 'reading_frame', 'confidence']

compliment = {
'A' : 'T',
'T' : 'A',
'G' : 'C',
'C' : 'G'
}

def parsePos(genomicPos):
Chr, pos = genomicPos.split(':')
Expand All @@ -28,6 +26,12 @@ def parsePos(genomicPos):
def doChr (data, columnPos): return parsePos(data[columnPos['breakpoint1']])['Chr']
def doPos (data, columnPos): return parsePos(data[columnPos['breakpoint1']])['pos']
def doRef (data, columnPos):
DNA = data[columnPos['fusion_transcript']].split('|')[0][-1]
strand = data[columnPos['strand1']].split('/')[1]
if strand == '-':
DNA = compliment[DNA]
return DNA
'''
r = parsePos(data[columnPos['breakpoint1']])
Chr = r['Chr']
pos = r['pos']
Expand All @@ -42,6 +46,7 @@ def doRef (data, columnPos):
else:
print ('FAILED api.genome.ucsc.edu call')
return 'ERROR'
'''

def doAlt (data, columnPos):
ref = doRef(data, columnPos)
Expand Down

0 comments on commit e964f61

Please sign in to comment.