From 15e5012a782246c6b68c525bea42172359b06ebe Mon Sep 17 00:00:00 2001 From: JeremyWesthead Date: Wed, 22 Mar 2023 12:11:51 +0000 Subject: [PATCH] Fix tests... --- gnomonicus/gnomonicus.py | 39 ++++++++++++++++++++------------------- 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/gnomonicus/gnomonicus.py b/gnomonicus/gnomonicus.py index 00456ab..f5adb61 100644 --- a/gnomonicus/gnomonicus.py +++ b/gnomonicus/gnomonicus.py @@ -304,25 +304,26 @@ def populateMutations( mutations = pd.concat([mutations, geneMutations]) else: mutations = geneMutations - #Ensure correct datatypes - mutations = mutations.astype({'MUTATION': 'str', - 'GENE': 'str', - 'NUCLEOTIDE_NUMBER': 'float', - 'NUCLEOTIDE_INDEX': 'float', - 'GENE_POSITION': 'float', - 'ALT': 'str', - 'REF': 'str', - 'CODES_PROTEIN': 'bool', - 'INDEL_LENGTH': 'float', - 'INDEL_NUCLEOTIDES': 'str', - 'IS_CDS': 'bool', - 'IS_HET': 'bool', - 'IS_NULL': 'bool', - 'IS_PROMOTER': 'bool', - 'IS_SNP': 'bool', - 'AMINO_ACID_NUMBER': 'float', - 'AMINO_ACID_SEQUENCE': 'str' - }) + if mutations is not None: + #Ensure correct datatypes + mutations = mutations.astype({'MUTATION': 'str', + 'GENE': 'str', + 'NUCLEOTIDE_NUMBER': 'float', + 'NUCLEOTIDE_INDEX': 'float', + 'GENE_POSITION': 'float', + 'ALT': 'str', + 'REF': 'str', + 'CODES_PROTEIN': 'bool', + 'INDEL_LENGTH': 'float', + 'INDEL_NUCLEOTIDES': 'str', + 'IS_CDS': 'bool', + 'IS_HET': 'bool', + 'IS_NULL': 'bool', + 'IS_PROMOTER': 'bool', + 'IS_SNP': 'bool', + 'AMINO_ACID_NUMBER': 'float', + 'AMINO_ACID_SEQUENCE': 'str' + }) #Add minor mutations (these are stored separately) if reference.minor_populations or sample.minor_populations: #Only do this if they exist