Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bug #19

Closed
wants to merge 4 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 25 additions & 8 deletions charger/charger.py
Original file line number Diff line number Diff line change
Expand Up @@ -903,26 +903,43 @@ def getMacClinVarTSV( self , tsvfile ):
for line in macFile:
fields = ( line.rstrip( ) ).split( "\t" )
[ description , status ] = self.parseMacPathogenicity( header, fields ) # no need to specify which fields here anymore; parseMacPathogenicity now knows which specific columns to look for
pos = int(fields[header.index("pos")])
ref = fields[header.index("ref")]
alt = fields[header.index("alt")]
if len(ref) == 1 and len(alt) > 1: # insertion
ref = '-'
alt = alt[1:]
start = pos
stop = pos + 1
elif len(ref) > 1 and len(alt) == 1: # deletion
ref = ref[1:]
alt = '-'
start = pos + 1
stop = pos + len(ref)
else: # snv
start = pos
stop = pos
if len(header) > 27: # if yes, file is in the new format
var = clinvarvariant( chromosome = fields[header.index("chrom")] , \
start = fields[header.index("pos")] , \
reference = fields[header.index("ref")] , \
alternate = fields[header.index("alt")] , \
start = start , \
stop = stop , \
reference = ref , \
alternate = alt , \
uid = fields[header.index("variation_id")], \
gene = fields[header.index("symbol")] , \
clinical = { "description" : description , "review_status" : status } , \
trait = { fields[header.index("xrefs")] : fields[header.index("all_traits")] } )
else: # file in the old format
var = clinvarvariant( chromosome = fields[header.index("chrom")] , \
start = fields[header.index("pos")] , \
reference = fields[header.index("ref")] , \
alternate = fields[header.index("alt")] , \
start = start , \
stop = stop , \
reference = ref , \
alternate = alt , \
uid = fields[header.index("measureset_id")], \
gene = fields[header.index("symbol")] , \
clinical = { "description" : description , "review_status" : status } , \
trait = { fields[-1] : fields[header.index("all_traits")] } )
var.setStopFromReferenceAndAlternate( )
var.splitHGVSc( fields[header.index("hgvs_c")] , override = True )
var.splitHGVSc( fields[header.index("hgvs_c")] )
var.splitHGVSp( fields[header.index("hgvs_p")] )
#var.printVariant( "," )
#print( var.proteogenomicVar( ) )
Expand Down