Skip to content

Commit

Permalink
self.stranded property converted to boolean
Browse files Browse the repository at this point in the history
  • Loading branch information
tleonardi committed Feb 10, 2019
1 parent 6811f8b commit f6b61b7
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions bedparse/bedline.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,13 @@ def __init__(self, line=None):
#Validate the strand and set stranded property
if(self.bedType>=6):
if(self.strand=="+" or self.strand=="-"):
self.stranded=1
self.stranded=True
elif(self.strand=="" or self.strand == "."):
self.strand=0
self.stranded=False
else:
raise BEDexception("The strand is not any of '+', '-', '.' or '' for transcript: "+self.name)
else:
self.stranded=False

if(self.bedType==12):
# Validate nEx, and CDS fields
Expand Down Expand Up @@ -339,7 +341,7 @@ def bed12tobed6(self, appendExN=False, whichExon="all"):
if(self.bedType!=12): raise BEDexception("Only BED12 lines can be coverted to BED6")
if whichExon not in ("all", "first", "last"):
raise BEDexception("whichExon has to be one of [all, first, last]")
if whichExon is not "all" and self.stranded!=1:
if whichExon is not "all" and not self.stranded:
raise BEDexception("whichExon is only allowed if the transcripts are stranded. %s is not"%self.name)

exons=list()
Expand Down

0 comments on commit f6b61b7

Please sign in to comment.