Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def gtf_row2interval(row):
"""Note: GTF is 1-based
"""
return Interval(str(row.Chromosome),
int(row.Start) - 1,
int(row.End),
strand=str(row.Strand))
def strand_default(self, intervals):
return [Interval(interval.chrom, interval.start, interval.end, interval.name, interval.score, strand=".") for interval in intervals]
def gtf_row2interval(row, interval_attrs: Union[str, List[str]] = None):
"""
Convert gtf row object into interval class.
"""
if interval_attrs:
# check type
if not isinstance(interval_attrs, list):
interval_attrs = [interval_attrs]
interval_attrs = {i: row[i] for i in interval_attrs if i in row}
return Interval(str(row.Chromosome),
int(row.Start),
int(row.End),
strand=str(row.Strand),
attrs=interval_attrs)