Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix repeatmasker GFF2Bed out of sort issue #27

Merged
merged 1 commit into from
Dec 20, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/telr/TELR_te.py
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,8 @@ def gff3tobed(gff, bed):
)
sys.exit(1)
break
with open(bed, "w") as output, open(gff, "r") as input:
bed_tmp = bed + ".tmp"
with open(bed_tmp, "w") as output, open(gff, "r") as input:
for line in input:
if "#" not in line:
entry = line.replace("\n", "").split("\t")
Expand All @@ -459,6 +460,12 @@ def gff3tobed(gff, bed):
[entry[0], str(int(entry[3]) - 1), entry[4], family, ".", entry[6]]
)
output.write(out_line + "\n")

# sort BED file
command = "bedtools sort -i " + bed_tmp
with open(bed, "w") as output:
subprocess.call(command, shell=True, stdout=output)
os.remove(bed_tmp)


def parse_rm_out(rm_gff, gff3):
Expand Down