@@ -23,9 +23,9 @@ class AnophelesGenomeFeaturesData(AnophelesGenomeSequenceData):
2323 def __init__ (
2424 self ,
2525 * ,
26- gff_gene_type : str ,
27- gff_gene_name_attribute : str ,
28- gff_default_attributes : Tuple [str , ...],
26+ gff_gene_type : Optional [ str ] = None ,
27+ gff_gene_name_attribute : Optional [ str ] = None ,
28+ gff_default_attributes : Optional [ Tuple [str , ...]] = None ,
2929 gene_names : Optional [Mapping [str , str ]] = None ,
3030 ** kwargs ,
3131 ):
@@ -34,16 +34,30 @@ def __init__(
3434 # to the superclass constructor.
3535 super ().__init__ (** kwargs )
3636
37- # TODO Consider moving these parameters to configuration, as they could
38- # change if the GFF ever changed.
39- self ._gff_gene_type = gff_gene_type
40- self ._gff_gene_name_attribute = gff_gene_name_attribute
41- self ._gff_default_attributes = gff_default_attributes
37+ # Read GFF parameters from the JSON config, falling back to
38+ # constructor args for backward compatibility.
39+ config = self .config
40+ self ._gff_gene_type = config .get ("GFF_GENE_TYPE" , gff_gene_type or "gene" )
41+ self ._gff_gene_name_attribute = config .get (
42+ "GFF_GENE_NAME_ATTRIBUTE" , gff_gene_name_attribute or "Name"
43+ )
44+ _default_attrs = config .get ("GFF_DEFAULT_ATTRIBUTES" , None )
45+ if _default_attrs is not None :
46+ self ._gff_default_attributes = tuple (_default_attrs )
47+ elif gff_default_attributes is not None :
48+ self ._gff_default_attributes = gff_default_attributes
49+ else :
50+ self ._gff_default_attributes = ("ID" , "Parent" , "Name" , "description" )
4251
4352 # Allow manual override of gene names.
44- if gene_names is None :
45- gene_names = dict ()
46- self ._gene_name_overrides = gene_names
53+ # Read from config if available, falling back to constructor arg.
54+ _gene_names = config .get ("GENE_NAMES" , None )
55+ if _gene_names is not None :
56+ self ._gene_name_overrides = _gene_names
57+ elif gene_names is not None :
58+ self ._gene_name_overrides = gene_names
59+ else :
60+ self ._gene_name_overrides = dict ()
4761
4862 # Setup caches.
4963 self ._cache_genome_features : Dict [Tuple [str , ...], pd .DataFrame ] = dict ()
0 commit comments