Skip to content
Snippets Groups Projects
Commit 1ba3eff4 authored by jedlickap's avatar jedlickap
Browse files

add updated scripts

parent 343f63fc
No related branches found
No related tags found
No related merge requests found
......@@ -22,9 +22,9 @@ class Executor:
new_elements = module.tool.run(self.sequence.seq)
self._crop_sequence(new_elements)
elements += new_elements
self._recalculate_coordinates(elements)
for module in self.modules:
if hasattr(module.output_generator, "__iter__"):
for generator in module.output_generator:
......
......@@ -37,7 +37,7 @@ class RetroTeDomains(ToolInterface):
retro_domains = self._filter_candidates(candidates)
retro_domains.sort(key=lambda e: e.location[0])
retro_domains.sort(key=lambda e: e.location[0], reverse=True)
self.output_object = RetroDomainOutputObject(self.seqId, sequence, retro_domains)
return retro_domains
......@@ -45,8 +45,12 @@ class RetroTeDomains(ToolInterface):
retro_domains = []
# filter on matches with evalue 0.1 and lower
candidates = [candidate for candidate in candidates if candidate.evalue <= 0.1]
for c in candidates:
c.location.sort()
# sort after location and score
candidates.sort(key=lambda e: (e.location, -e.score))
candidates.sort(key=lambda e: (e.location[0], -e.score))
for candidate in candidates:
add = True
for domain in retro_domains:
......
......@@ -12,6 +12,11 @@ class RetroDomainOutputGenerator(BaseOutputGenerator):
def generate_output(self, output_object: RetroDomainOutputObject) -> NoReturn:
self.create_data_directory(output_object.sequence_id)
# sort elements after location[0]
for element in output_object.elements:
element.location = [min(element.location), max(element.location)]
output_object.elements.sort(key=lambda e: e.location[0])
with open(f"{self.directory}/{output_object.sequence_id}/{output_object.sequence_id}_retro_domain.gff", "w+") as gff:
i = 0
gff.write("##gff-version 3\n")
......@@ -20,7 +25,6 @@ class RetroDomainOutputGenerator(BaseOutputGenerator):
sign = (lambda x: x and (1, -1)[x < 0])(domain.frame[0])
strand = "+"
if sign < 0:
domain_location = [domain_location[1], domain_location[0]]
strand = '-'
gff.write(output_object.sequence_id + "\t"
+ "retroTeDomain\tpolypeptide_conserved_region\t"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment