diff --git a/README.pdf b/README.pdf index 119a69f..286883f 100644 Binary files a/README.pdf and b/README.pdf differ diff --git a/RELEASE_NOTES.pdf b/RELEASE_NOTES.pdf index ae6ae2d..89c3994 100644 Binary files a/RELEASE_NOTES.pdf and b/RELEASE_NOTES.pdf differ diff --git a/docs/docs.pdf b/docs/docs.pdf index 60458c1..201b3e7 100644 Binary files a/docs/docs.pdf and b/docs/docs.pdf differ diff --git a/docs/help.configuration.calculation.pdf b/docs/help.configuration.calculation.pdf index c8552fd..da300a0 100644 Binary files a/docs/help.configuration.calculation.pdf and b/docs/help.configuration.calculation.pdf differ diff --git a/docs/help.configuration.pdf b/docs/help.configuration.pdf index d044506..24c4029 100644 Binary files a/docs/help.configuration.pdf and b/docs/help.configuration.pdf differ diff --git a/docs/help.configuration.prioritization.pdf b/docs/help.configuration.prioritization.pdf index e323ed9..50a85b5 100644 Binary files a/docs/help.configuration.prioritization.pdf and b/docs/help.configuration.prioritization.pdf differ diff --git a/docs/help.parameters.databases.pdf b/docs/help.parameters.databases.pdf index 6edc67d..4877440 100644 Binary files a/docs/help.parameters.databases.pdf and b/docs/help.parameters.databases.pdf differ diff --git a/docs/help.parameters.pdf b/docs/help.parameters.pdf index 14984d9..269d959 100644 Binary files a/docs/help.parameters.pdf and b/docs/help.parameters.pdf differ diff --git a/docs/help.pdf b/docs/help.pdf index 7189791..ada53c8 100644 Binary files a/docs/help.pdf and b/docs/help.pdf differ diff --git a/docs/pdoc/howard/objects/variants.html b/docs/pdoc/howard/objects/variants.html index 541f50d..83d5367 100644 --- a/docs/pdoc/howard/objects/variants.html +++ b/docs/pdoc/howard/objects/variants.html @@ -12108,9 +12108,9 @@

11713 del header.infos[field_to_rename] 11714 11715 # Rename INFO patterns -11716 field_pattern = rf'(^|;)({field_to_rename})=([^;]*)' +11716 field_pattern = rf'(^|;)({field_to_rename})($|;|=[^;]*)' 11717 if field_renamed is not None: -11718 field_renamed_pattern = rf'\1{field_renamed}=\3' +11718 field_renamed_pattern = rf'\1{field_renamed}\3' 11719 else: 11720 field_renamed_pattern = '' 11721 @@ -12131,76 +12131,81 @@

11736 else: 11737 log.info(f"Rename or remove fields - field '{field_to_rename}' removed") 11738 -11739 # Rename INFO -11740 for regex_replace_key, regex_replace in regex_replace_dict.items(): -11741 log.info(f"Rename or remove fields - Process [{regex_replace_key+1}/{len(regex_replace_dict)}]...") -11742 query = f""" -11743 UPDATE {table} -11744 SET -11745 INFO = {regex_replace} -11746 """ -11747 log.debug(f"query={query}") -11748 self.execute_query(query=query) -11749 -11750 return fields_renamed -11751 -11752 def calculation_rename_info_fields( -11753 self, -11754 fields_to_rename: dict = None, -11755 table: str = None, -11756 operation_name: str = "RENAME_INFO_FIELDS", -11757 ) -> None: -11758 """ -11759 The `calculation_rename_info_fields` function retrieves parameters from a dictionary, updates -11760 fields to rename and table if provided, and then calls another function to rename the fields. -11761 -11762 :param fields_to_rename: `fields_to_rename` is a dictionary that contains the fields to be -11763 renamed in a table. Each key-value pair in the dictionary represents the original field name as -11764 the key and the new field name as the value -11765 :type fields_to_rename: dict -11766 :param table: The `table` parameter in the `calculation_rename_info_fields` method is used to -11767 specify the name of the table for which the fields are to be renamed. It is a string type -11768 parameter -11769 :type table: str -11770 :param operation_name: The `operation_name` parameter in the `calculation_rename_info_fields` -11771 method is a string that specifies the name of the operation being performed. In this context, it -11772 is used as a default value for the operation name if not explicitly provided when calling the -11773 function, defaults to RENAME_INFO_FIELDS -11774 :type operation_name: str (optional) -11775 """ -11776 -11777 # Param -11778 param = self.get_param() -11779 -11780 # Get param fields to rename -11781 param_fields_to_rename = ( -11782 param.get("calculation", {}) -11783 .get("calculations", {}) -11784 .get(operation_name, {}) -11785 .get("fields_to_rename", None) -11786 ) -11787 -11788 # Get param table -11789 param_table = ( -11790 param.get("calculation", {}) -11791 .get("calculations", {}) -11792 .get(operation_name, {}) -11793 .get("table", None) -11794 ) -11795 -11796 # Init fields_to_rename -11797 if fields_to_rename is None: -11798 fields_to_rename = param_fields_to_rename -11799 -11800 # Init table -11801 if table is None: -11802 table = param_table -11803 -11804 renamed_fields = self.rename_info_fields( -11805 fields_to_rename=fields_to_rename, table=table -11806 ) -11807 -11808 log.debug(f"renamed_fields:{renamed_fields}") +11739 else: +11740 +11741 log.warning(f"Rename or remove fields - field '{field_to_rename}' not in header") +11742 +11743 +11744 # Rename INFO +11745 for regex_replace_key, regex_replace in regex_replace_dict.items(): +11746 log.info(f"Rename or remove fields - Process [{regex_replace_key+1}/{len(regex_replace_dict)}]...") +11747 query = f""" +11748 UPDATE {table} +11749 SET +11750 INFO = {regex_replace} +11751 """ +11752 log.debug(f"query={query}") +11753 self.execute_query(query=query) +11754 +11755 return fields_renamed +11756 +11757 def calculation_rename_info_fields( +11758 self, +11759 fields_to_rename: dict = None, +11760 table: str = None, +11761 operation_name: str = "RENAME_INFO_FIELDS", +11762 ) -> None: +11763 """ +11764 The `calculation_rename_info_fields` function retrieves parameters from a dictionary, updates +11765 fields to rename and table if provided, and then calls another function to rename the fields. +11766 +11767 :param fields_to_rename: `fields_to_rename` is a dictionary that contains the fields to be +11768 renamed in a table. Each key-value pair in the dictionary represents the original field name as +11769 the key and the new field name as the value +11770 :type fields_to_rename: dict +11771 :param table: The `table` parameter in the `calculation_rename_info_fields` method is used to +11772 specify the name of the table for which the fields are to be renamed. It is a string type +11773 parameter +11774 :type table: str +11775 :param operation_name: The `operation_name` parameter in the `calculation_rename_info_fields` +11776 method is a string that specifies the name of the operation being performed. In this context, it +11777 is used as a default value for the operation name if not explicitly provided when calling the +11778 function, defaults to RENAME_INFO_FIELDS +11779 :type operation_name: str (optional) +11780 """ +11781 +11782 # Param +11783 param = self.get_param() +11784 +11785 # Get param fields to rename +11786 param_fields_to_rename = ( +11787 param.get("calculation", {}) +11788 .get("calculations", {}) +11789 .get(operation_name, {}) +11790 .get("fields_to_rename", None) +11791 ) +11792 +11793 # Get param table +11794 param_table = ( +11795 param.get("calculation", {}) +11796 .get("calculations", {}) +11797 .get(operation_name, {}) +11798 .get("table", None) +11799 ) +11800 +11801 # Init fields_to_rename +11802 if fields_to_rename is None: +11803 fields_to_rename = param_fields_to_rename +11804 +11805 # Init table +11806 if table is None: +11807 table = param_table +11808 +11809 renamed_fields = self.rename_info_fields( +11810 fields_to_rename=fields_to_rename, table=table +11811 ) +11812 +11813 log.debug(f"renamed_fields:{renamed_fields}") @@ -23896,9 +23901,9 @@

11714 del header.infos[field_to_rename] 11715 11716 # Rename INFO patterns -11717 field_pattern = rf'(^|;)({field_to_rename})=([^;]*)' +11717 field_pattern = rf'(^|;)({field_to_rename})($|;|=[^;]*)' 11718 if field_renamed is not None: -11719 field_renamed_pattern = rf'\1{field_renamed}=\3' +11719 field_renamed_pattern = rf'\1{field_renamed}\3' 11720 else: 11721 field_renamed_pattern = '' 11722 @@ -23919,76 +23924,81 @@

11737 else: 11738 log.info(f"Rename or remove fields - field '{field_to_rename}' removed") 11739 -11740 # Rename INFO -11741 for regex_replace_key, regex_replace in regex_replace_dict.items(): -11742 log.info(f"Rename or remove fields - Process [{regex_replace_key+1}/{len(regex_replace_dict)}]...") -11743 query = f""" -11744 UPDATE {table} -11745 SET -11746 INFO = {regex_replace} -11747 """ -11748 log.debug(f"query={query}") -11749 self.execute_query(query=query) -11750 -11751 return fields_renamed -11752 -11753 def calculation_rename_info_fields( -11754 self, -11755 fields_to_rename: dict = None, -11756 table: str = None, -11757 operation_name: str = "RENAME_INFO_FIELDS", -11758 ) -> None: -11759 """ -11760 The `calculation_rename_info_fields` function retrieves parameters from a dictionary, updates -11761 fields to rename and table if provided, and then calls another function to rename the fields. -11762 -11763 :param fields_to_rename: `fields_to_rename` is a dictionary that contains the fields to be -11764 renamed in a table. Each key-value pair in the dictionary represents the original field name as -11765 the key and the new field name as the value -11766 :type fields_to_rename: dict -11767 :param table: The `table` parameter in the `calculation_rename_info_fields` method is used to -11768 specify the name of the table for which the fields are to be renamed. It is a string type -11769 parameter -11770 :type table: str -11771 :param operation_name: The `operation_name` parameter in the `calculation_rename_info_fields` -11772 method is a string that specifies the name of the operation being performed. In this context, it -11773 is used as a default value for the operation name if not explicitly provided when calling the -11774 function, defaults to RENAME_INFO_FIELDS -11775 :type operation_name: str (optional) -11776 """ -11777 -11778 # Param -11779 param = self.get_param() -11780 -11781 # Get param fields to rename -11782 param_fields_to_rename = ( -11783 param.get("calculation", {}) -11784 .get("calculations", {}) -11785 .get(operation_name, {}) -11786 .get("fields_to_rename", None) -11787 ) -11788 -11789 # Get param table -11790 param_table = ( -11791 param.get("calculation", {}) -11792 .get("calculations", {}) -11793 .get(operation_name, {}) -11794 .get("table", None) -11795 ) -11796 -11797 # Init fields_to_rename -11798 if fields_to_rename is None: -11799 fields_to_rename = param_fields_to_rename -11800 -11801 # Init table -11802 if table is None: -11803 table = param_table -11804 -11805 renamed_fields = self.rename_info_fields( -11806 fields_to_rename=fields_to_rename, table=table -11807 ) -11808 -11809 log.debug(f"renamed_fields:{renamed_fields}") +11740 else: +11741 +11742 log.warning(f"Rename or remove fields - field '{field_to_rename}' not in header") +11743 +11744 +11745 # Rename INFO +11746 for regex_replace_key, regex_replace in regex_replace_dict.items(): +11747 log.info(f"Rename or remove fields - Process [{regex_replace_key+1}/{len(regex_replace_dict)}]...") +11748 query = f""" +11749 UPDATE {table} +11750 SET +11751 INFO = {regex_replace} +11752 """ +11753 log.debug(f"query={query}") +11754 self.execute_query(query=query) +11755 +11756 return fields_renamed +11757 +11758 def calculation_rename_info_fields( +11759 self, +11760 fields_to_rename: dict = None, +11761 table: str = None, +11762 operation_name: str = "RENAME_INFO_FIELDS", +11763 ) -> None: +11764 """ +11765 The `calculation_rename_info_fields` function retrieves parameters from a dictionary, updates +11766 fields to rename and table if provided, and then calls another function to rename the fields. +11767 +11768 :param fields_to_rename: `fields_to_rename` is a dictionary that contains the fields to be +11769 renamed in a table. Each key-value pair in the dictionary represents the original field name as +11770 the key and the new field name as the value +11771 :type fields_to_rename: dict +11772 :param table: The `table` parameter in the `calculation_rename_info_fields` method is used to +11773 specify the name of the table for which the fields are to be renamed. It is a string type +11774 parameter +11775 :type table: str +11776 :param operation_name: The `operation_name` parameter in the `calculation_rename_info_fields` +11777 method is a string that specifies the name of the operation being performed. In this context, it +11778 is used as a default value for the operation name if not explicitly provided when calling the +11779 function, defaults to RENAME_INFO_FIELDS +11780 :type operation_name: str (optional) +11781 """ +11782 +11783 # Param +11784 param = self.get_param() +11785 +11786 # Get param fields to rename +11787 param_fields_to_rename = ( +11788 param.get("calculation", {}) +11789 .get("calculations", {}) +11790 .get(operation_name, {}) +11791 .get("fields_to_rename", None) +11792 ) +11793 +11794 # Get param table +11795 param_table = ( +11796 param.get("calculation", {}) +11797 .get("calculations", {}) +11798 .get(operation_name, {}) +11799 .get("table", None) +11800 ) +11801 +11802 # Init fields_to_rename +11803 if fields_to_rename is None: +11804 fields_to_rename = param_fields_to_rename +11805 +11806 # Init table +11807 if table is None: +11808 table = param_table +11809 +11810 renamed_fields = self.rename_info_fields( +11811 fields_to_rename=fields_to_rename, table=table +11812 ) +11813 +11814 log.debug(f"renamed_fields:{renamed_fields}") @@ -39111,9 +39121,9 @@

Returns
11714 del header.infos[field_to_rename] 11715 11716 # Rename INFO patterns -11717 field_pattern = rf'(^|;)({field_to_rename})=([^;]*)' +11717 field_pattern = rf'(^|;)({field_to_rename})($|;|=[^;]*)' 11718 if field_renamed is not None: -11719 field_renamed_pattern = rf'\1{field_renamed}=\3' +11719 field_renamed_pattern = rf'\1{field_renamed}\3' 11720 else: 11721 field_renamed_pattern = '' 11722 @@ -39134,18 +39144,23 @@
Returns
11737 else: 11738 log.info(f"Rename or remove fields - field '{field_to_rename}' removed") 11739 -11740 # Rename INFO -11741 for regex_replace_key, regex_replace in regex_replace_dict.items(): -11742 log.info(f"Rename or remove fields - Process [{regex_replace_key+1}/{len(regex_replace_dict)}]...") -11743 query = f""" -11744 UPDATE {table} -11745 SET -11746 INFO = {regex_replace} -11747 """ -11748 log.debug(f"query={query}") -11749 self.execute_query(query=query) -11750 -11751 return fields_renamed +11740 else: +11741 +11742 log.warning(f"Rename or remove fields - field '{field_to_rename}' not in header") +11743 +11744 +11745 # Rename INFO +11746 for regex_replace_key, regex_replace in regex_replace_dict.items(): +11747 log.info(f"Rename or remove fields - Process [{regex_replace_key+1}/{len(regex_replace_dict)}]...") +11748 query = f""" +11749 UPDATE {table} +11750 SET +11751 INFO = {regex_replace} +11752 """ +11753 log.debug(f"query={query}") +11754 self.execute_query(query=query) +11755 +11756 return fields_renamed @@ -39188,63 +39203,63 @@

Returns
-
11753    def calculation_rename_info_fields(
-11754        self,
-11755        fields_to_rename: dict = None,
-11756        table: str = None,
-11757        operation_name: str = "RENAME_INFO_FIELDS",
-11758    ) -> None:
-11759        """
-11760        The `calculation_rename_info_fields` function retrieves parameters from a dictionary, updates
-11761        fields to rename and table if provided, and then calls another function to rename the fields.
-11762
-11763        :param fields_to_rename: `fields_to_rename` is a dictionary that contains the fields to be
-11764        renamed in a table. Each key-value pair in the dictionary represents the original field name as
-11765        the key and the new field name as the value
-11766        :type fields_to_rename: dict
-11767        :param table: The `table` parameter in the `calculation_rename_info_fields` method is used to
-11768        specify the name of the table for which the fields are to be renamed. It is a string type
-11769        parameter
-11770        :type table: str
-11771        :param operation_name: The `operation_name` parameter in the `calculation_rename_info_fields`
-11772        method is a string that specifies the name of the operation being performed. In this context, it
-11773        is used as a default value for the operation name if not explicitly provided when calling the
-11774        function, defaults to RENAME_INFO_FIELDS
-11775        :type operation_name: str (optional)
-11776        """
-11777
-11778        # Param
-11779        param = self.get_param()
-11780
-11781        # Get param fields to rename
-11782        param_fields_to_rename = (
-11783            param.get("calculation", {})
-11784            .get("calculations", {})
-11785            .get(operation_name, {})
-11786            .get("fields_to_rename", None)
-11787        )
-11788
-11789        # Get param table
-11790        param_table = (
-11791            param.get("calculation", {})
-11792            .get("calculations", {})
-11793            .get(operation_name, {})
-11794            .get("table", None)
-11795        )
-11796
-11797        # Init fields_to_rename
-11798        if fields_to_rename is None:
-11799            fields_to_rename = param_fields_to_rename
-11800
-11801        # Init table
-11802        if table is None:
-11803            table = param_table
-11804
-11805        renamed_fields = self.rename_info_fields(
-11806            fields_to_rename=fields_to_rename, table=table
-11807        )
-11808
-11809        log.debug(f"renamed_fields:{renamed_fields}")
+            
11758    def calculation_rename_info_fields(
+11759        self,
+11760        fields_to_rename: dict = None,
+11761        table: str = None,
+11762        operation_name: str = "RENAME_INFO_FIELDS",
+11763    ) -> None:
+11764        """
+11765        The `calculation_rename_info_fields` function retrieves parameters from a dictionary, updates
+11766        fields to rename and table if provided, and then calls another function to rename the fields.
+11767
+11768        :param fields_to_rename: `fields_to_rename` is a dictionary that contains the fields to be
+11769        renamed in a table. Each key-value pair in the dictionary represents the original field name as
+11770        the key and the new field name as the value
+11771        :type fields_to_rename: dict
+11772        :param table: The `table` parameter in the `calculation_rename_info_fields` method is used to
+11773        specify the name of the table for which the fields are to be renamed. It is a string type
+11774        parameter
+11775        :type table: str
+11776        :param operation_name: The `operation_name` parameter in the `calculation_rename_info_fields`
+11777        method is a string that specifies the name of the operation being performed. In this context, it
+11778        is used as a default value for the operation name if not explicitly provided when calling the
+11779        function, defaults to RENAME_INFO_FIELDS
+11780        :type operation_name: str (optional)
+11781        """
+11782
+11783        # Param
+11784        param = self.get_param()
+11785
+11786        # Get param fields to rename
+11787        param_fields_to_rename = (
+11788            param.get("calculation", {})
+11789            .get("calculations", {})
+11790            .get(operation_name, {})
+11791            .get("fields_to_rename", None)
+11792        )
+11793
+11794        # Get param table
+11795        param_table = (
+11796            param.get("calculation", {})
+11797            .get("calculations", {})
+11798            .get(operation_name, {})
+11799            .get("table", None)
+11800        )
+11801
+11802        # Init fields_to_rename
+11803        if fields_to_rename is None:
+11804            fields_to_rename = param_fields_to_rename
+11805
+11806        # Init table
+11807        if table is None:
+11808            table = param_table
+11809
+11810        renamed_fields = self.rename_info_fields(
+11811            fields_to_rename=fields_to_rename, table=table
+11812        )
+11813
+11814        log.debug(f"renamed_fields:{renamed_fields}")
 
diff --git a/docs/tips.pdf b/docs/tips.pdf index 28cdc03..e615578 100644 Binary files a/docs/tips.pdf and b/docs/tips.pdf differ diff --git a/docs/user_guide.pdf b/docs/user_guide.pdf index eaf64ee..c099f38 100644 Binary files a/docs/user_guide.pdf and b/docs/user_guide.pdf differ diff --git a/howard/objects/variants.py b/howard/objects/variants.py index 0718f0d..6bd8a1d 100644 --- a/howard/objects/variants.py +++ b/howard/objects/variants.py @@ -11713,9 +11713,9 @@ def rename_info_fields( del header.infos[field_to_rename] # Rename INFO patterns - field_pattern = rf'(^|;)({field_to_rename})=([^;]*)' + field_pattern = rf'(^|;)({field_to_rename})($|;|=[^;]*)' if field_renamed is not None: - field_renamed_pattern = rf'\1{field_renamed}=\3' + field_renamed_pattern = rf'\1{field_renamed}\3' else: field_renamed_pattern = '' @@ -11736,6 +11736,11 @@ def rename_info_fields( else: log.info(f"Rename or remove fields - field '{field_to_rename}' removed") + else: + + log.warning(f"Rename or remove fields - field '{field_to_rename}' not in header") + + # Rename INFO for regex_replace_key, regex_replace in regex_replace_dict.items(): log.info(f"Rename or remove fields - Process [{regex_replace_key+1}/{len(regex_replace_dict)}]...") diff --git a/plugins/README.pdf b/plugins/README.pdf index 1d66dc1..40f2849 100644 Binary files a/plugins/README.pdf and b/plugins/README.pdf differ diff --git a/tests/data/example.annotation_names.vcf b/tests/data/example.annotation_names.vcf index a53d70e..681ebb0 100644 --- a/tests/data/example.annotation_names.vcf +++ b/tests/data/example.annotation_names.vcf @@ -24,6 +24,7 @@ ##INFO= ##INFO= ##INFO= +##INFO= ##contig= ##contig= ##contig= @@ -57,8 +58,8 @@ #CHROM POS ID REF ALT QUAL FILTER INFO FORMAT sample1 sample2 sample3 sample4 chr1 28736 . A C 100 PASS CLNSIG=pathogenic GT:AD:DP:GQ 0/1:525,204:729:99 0/1:12659,4994:17664:99 1/1:12658,4995:17663:99 1/1:401,175:576:99 chr1 35144 . A C 100 PASS CLNSIG=non-pathogenic GT:AD:DP:GQ ./.:.:.:. 0/1:12659,4994:17664:99 0/1:12658,4995:17663:99 0/1:401,175:576:99 -chr1 69101 . A G 100 PASS DP=50;CLNSIG=non-pathogenic;SIFT=D GT:AD:DP:GQ 0/1:525,204:729:99 ./.:.:.:. 0/1:12658,4995:17663:99 0/1:401,175:576:99 -chr1 768251 . A G 100 PASS CLNSIG=NP;PREFIXCLNSIG=NP;CLNSIGSUFFIX=P GT:AD:DP:GQ 0/1:525,204:729:99 ./.:.:.:. 0/1:12658,4995:17663:99 0/1:401,175:576:99 +chr1 69101 . A G 100 PASS DP=50;CLNSIG=non-pathogenic;SIFT=D;SPiP_Alt GT:AD:DP:GQ 0/1:525,204:729:99 ./.:.:.:. 0/1:12658,4995:17663:99 0/1:401,175:576:99 +chr1 768251 . A G 100 PASS CLNSIG=NP;PREFIXCLNSIG=NP;SPiP_Alt;CLNSIGSUFFIX=P GT:AD:DP:GQ 0/1:525,204:729:99 ./.:.:.:. 0/1:12658,4995:17663:99 0/1:401,175:576:99 chr1 768252 . A G 100 PASS PREFIXCLNSIG=NP GT:AD:DP:GQ 0/1:525,204:729:99 ./.:.:.:. 0/1:12658,4995:17663:99 0/1:401,175:576:99 -chr1 768253 . A G 100 PASS CLNSIGSUFFIX=P GT:AD:DP:GQ 0/1:525,204:729:99 ./.:.:.:. 0/1:12658,4995:17663:99 0/1:401,175:576:99 +chr1 768253 . A G 100 PASS SPiP_Alt;CLNSIGSUFFIX=P GT:AD:DP:GQ 0/1:525,204:729:99 ./.:.:.:. 0/1:12658,4995:17663:99 0/1:401,175:576:99 chr7 55249063 rs1050171 G A 5777 PASS CLNSIG=NP;DP=125;CLNSIG=NP GT:AD:DP:GQ 0/1:525,204:729:99 0/1:12659,4994:17664:99 ./.:.:.:. 0/1:401,175:576:99 diff --git a/tests/test_objects_variants.py b/tests/test_objects_variants.py index 2fd6f27..bf987c0 100644 --- a/tests/test_objects_variants.py +++ b/tests/test_objects_variants.py @@ -2196,13 +2196,16 @@ def test_rename_fields(): "field_not_in_header": "field_not_in_header_renamed", "": "", "SIFT": None, + "SPiP_Alt": "SPiP_alternative", + "SPiP_alternative": None, } # Rename fields fields_renamed = variants.rename_info_fields(fields_to_rename=fields_to_rename) - assert fields_renamed == {'CLNSIG': 'CLNSIG_renamed', 'PREFIXCLNSIG': 'PREFIXCLNSIG_renamed', 'DP': 'depth', 'SIFT': None} + assert fields_renamed == {'CLNSIG': 'CLNSIG_renamed', 'PREFIXCLNSIG': 'PREFIXCLNSIG_renamed', 'DP': 'depth', 'SIFT': None, 'SPiP_Alt': 'SPiP_alternative', 'SPiP_alternative': None} assert len(variants.get_query_to_df("SELECT INFO FROM variants WHERE INFO LIKE '%SIFT%'")) == 0 assert len(variants.get_query_to_df("SELECT INFO FROM variants WHERE INFO LIKE '%None=%'")) == 0 + assert len(variants.get_query_to_df("SELECT INFO FROM variants WHERE INFO LIKE '%SPiP%'")) == 0 # Check if VCF is in correct format with pyVCF remove_if_exists([output_vcf]) @@ -2235,6 +2238,8 @@ def test_rename_fields_to_param_and_export(): "field_not_in_header": "field_not_in_header_renamed", "": "", "SIFT": None, + "SPiP_Alt": "SPiP_alternative", + "SPiP_alternative": None, } } }