Skip to content

Commit

Permalink
overwrite all pathmakers with code from busco moshpit
Browse files Browse the repository at this point in the history
  • Loading branch information
VinzentRisch committed Jul 4, 2024
1 parent 0bf7f20 commit 8378b45
Showing 1 changed file with 10 additions and 22 deletions.
32 changes: 10 additions & 22 deletions q2_amr/amrfinderplus/types/_format.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ def _validate_(self, level):
pass


def _path_maker(name):
return str(name)


class AMRFinderPlusDatabaseDirFmt(model.DirectoryFormat):
amr_lib = model.File("AMR.LIB", format=TextFormat)
amr_lib_comp = model.FileCollection(r"^AMR\.LIB\.h3.$", format=BinaryFormat)
Expand All @@ -42,26 +46,10 @@ class AMRFinderPlusDatabaseDirFmt(model.DirectoryFormat):
amr_cds_comp = model.FileCollection(r"^AMR_CDS\.n..$", format=BinaryFormat)
amr_cds = model.File("AMR_CDS", format=MixedCaseDNAFASTAFormat)

@amr_lib_comp.set_path_maker
def amr_lib_comp_path_maker(self):
return r"^AMR\.LIB\.h3.$"

@amrprot_blast.set_path_maker
def amrprot_blast_path_maker(self):
return r"^AMRProt\.p..$"

@amr_dna.set_path_maker
def amr_dna_path_maker(self):
return r"^AMR_DNA-[a-zA-Z_]+$"

@amr_dna_comp.set_path_maker
def amr_dna_comp_path_maker(self):
return r"^AMR_DNA-[a-zA-Z_]+\.n..$"

@amr_cds_comp.set_path_maker
def amr_cds_comp_path_maker(self):
return r"^AMR_CDS\.n..$"
def __init__(self, path, mode):
super().__init__(path, mode)

@amr_dna_tab.set_path_maker
def amr_dna_tab_path_maker(self):
return r"^AMR_DNA-[a-zA-Z_]+\.tab$"
# Overwrite path maker methods for all file collections
for var_name, var_value in vars(self.__class__).items():
if isinstance(var_value, model.FileCollection):
var_value.set_path_maker(_path_maker)

0 comments on commit 8378b45

Please sign in to comment.