Skip to content

Commit

Permalink
Merge pull request #92 from ggilestro/master
Browse files Browse the repository at this point in the history
Fixes issue #90
  • Loading branch information
Nanguage authored Dec 20, 2023
2 parents 36a86b2 + 20ea085 commit 008a2b6
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions coolbox/core/track/gtf.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,14 +112,16 @@ def fetch_intervals(self, gr: GenomeRange):
if gene_name.hasnans:
gene_id = df['attribute'].str.extract(".*gene_id (.*?) ").iloc[:, 0].str.strip('\";')
gene_name.fillna(gene_id, inplace=True)
if gene_name.hasnans:
pos_str = df['seqname'].astype(str) + ":" +\
df['start'].astype(str) + "-" +\
df['end'].astype(str)
gene_name.fillna(pos_str, inplace=True)
df['feature_name'] = gene_name
else:
df['feature_name'] = df['attribute'].str.extract(f".*{name_attr} (.*?) ").iloc[:, 0].str.strip('\";')
gene_name = df['attribute'].str.extract(f".*{name_attr} (.*?)(?:[ ;])").iloc[:, 0].str.strip('\";')

if gene_name.hasnans:
pos_str = df['seqname'].astype(str) + ":" +\
df['start'].astype(str) + "-" +\
df['end'].astype(str)
gene_name.fillna(pos_str, inplace=True)

df['feature_name'] = gene_name
return df

def plot(self, ax, gr: GenomeRange, **kwargs):
Expand Down

0 comments on commit 008a2b6

Please sign in to comment.