You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
importgenomepydefmito_genes(annotation_path):
ann=genomepy.annotation(annotation_path)
gtf=ann.named_gtf# very quick, very dirty way to find the name for the mitochondrion.# could also try to read this from the assembly report, but that's also not perfect. mt=gtf[gtf["seqname"].str.contains("chrM", case=False, regex=False)]["seqname"].unique()
iflen(mt) !=1:
mt=gtf[gtf["seqname"].str.contains("MT", case=False, regex=False)]["seqname"].unique()
iflen(mt) !=1:
mt=gtf[gtf["seqname"].str.contains("mito", case=False, regex=False)]["seqname"].unique()
iflen(mt) !=1:
mt=gtf[gtf["seqname"].str.contains("m", case=False, regex=False)]["seqname"].unique()
iflen(mt) !=1:
print("we tried...")
return {}
genes=set(gtf[gtf["seqname"] ==mt[0]].index)
returngenes
The text was updated successfully, but these errors were encountered:
The text was updated successfully, but these errors were encountered: