merenlab / oligotyping

Exploring microbial patterns through subtle nucleotide variation within 16S rRNA gene tag sequences of closely related taxa
GNU General Public License v2.0
40 stars 22 forks source link

check for no root decomposition when updating toplogy #35

Closed didillysquat closed 3 years ago

didillysquat commented 3 years ago

Hi @meren,

I've made 3 minor changes.

1 - I moved the self.decomposition_depth += 1 to after the if not len(self.node_ids_to_analyze): so that the decomposition depth is not incremented before this check has been made (else, upon exiting after no decomposition, it looks as though one round of decomposition was completed).

2 and 3 - I pass in the decomposition depth to the update_final_nodes method so that we can check for the specific instance where the nodes considered to be final nodes may be the root node, when no decomposition has occurred.

N.B. I have only run two tests and these tests only involve the actual decomposition and output of count tables. They do not include figure generation etc. I ran on a set of sequences that undergo decomposition in the expected manner. And I ran on a set of sequences that were causing me trouble (i.e. 0 decomposition of the root node). For the former, the results are exactly the same before and after my changes. For the latter, the changes fix the problem and the root node is included in the final nodes.

Given that I haven't tested the creation of figures etc., I'm more than happy for you not to include this commit - as you like. I run a stripped down version of your code in SymPortal to which I will make these changes so that I can keep running MED.

Thanks again for your help.

Ben

Command run for testing:

oligotyping/decompose -M 12 -T --skip-gen-html --skip-gen-figures -R --skip-check-input-file -o results/  seqs_for_med_MesoF_ID469_clade_C.redundant.padded.fasta
meren commented 3 years ago

This is brilliant, @didillysquat! Thank you very much!