MCPcopy
hub / github.com/google-deepmind/alphagenome / generate_gtf

Function generate_gtf

scripts/process_gtf.py:66–81  ·  view source on GitHub ↗

Generates GTF from a GTF path.

(path: str)

Source from the content-addressed store, hash-verified

64
65
66def generate_gtf(path: str) -> pd.DataFrame:
67 """Generates GTF from a GTF path."""
68 url = parse.urlparse(path)
69 if all([url.scheme, url.netloc]):
70 with tempfile.TemporaryDirectory() as d:
71 path, _ = request.urlretrieve(
72 path,
73 filename=os.path.join(d, os.path.basename(path)),
74 )
75 logging.info('Downloaded GTF to %s', path)
76 gtf = pyranges.read_gtf(path, as_df=True, duplicate_attr=True)
77 else:
78 gtf = pyranges.read_gtf(path, as_df=True, duplicate_attr=True)
79
80 gtf['gene_id_nopatch'] = gtf['gene_id'].str.split('.', expand=True)[0]
81 return gtf
82
83
84def main(_) -> None:

Callers 1

mainFunction · 0.85

Calls 1

splitMethod · 0.80

Tested by

no test coverage detected