Skip to content
Permalink
4ff4d46c11
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
24 lines (18 sloc) 763 Bytes
import pandas as pd
df_utr_regions = pd.read_csv(snakemake.input[0])
info = list(df_utr_regions["info"])
chrms = list(df_utr_regions["chr"])
start = list(df_utr_regions["start"])
stop = list(df_utr_regions["stop"])
output = []
for ann in range(len(info)):
if "gene_name" in info[ann]:
line = info[ann].split(";")
transID = line[1].split(" ")[-1][1:-1].split(".")[0]
gene = line[3].split(" ")[-1][1:-1]
if (gene == snakemake.params[0].upper()):
bedline = chrms[ann] + "\t" + str(start[ann]) + "\t" + str(stop[ann]) + "\t" + transID
output.append(bedline)
output_file = open(snakemake.output[0],"w+")
output_file.write("\n".join(output))
output_file.close()