<commit_before>"""
This file can be downloaded and used to create a .txt file containing only
the accession numbers from the ghost-tree.nwk that you plan to use for your
analyses.

You must have skbio installed. http://scikit-bio.org/

You will then use "ghost_tree_tips.txt" output file containing the accession
numbers to filter your .biom table so that it contains only the OTUs that
are in the ghost-tree.nwk that you are using.

http://qiime.org/scripts/filter_otus_from_otu_table.html

Use the required arguments and the following two optional arguments:
-e, --otu_ids_to_exclude_fp
(provide the text file containing OTU ids to exclude)
--negate_ids_to_exclude
(this will keep OTUs in otu_ids_to_exclude_fp, rather than discard them)
"""
from skbio import TreeNode

ghosttree = TreeNode.read("ghost_tree_97_80clusters_from_alpha_release.nwk")  # insert your ghost-tree name here
output = open("ghost_tree_tips.txt", "w")

for node in ghosttree.tips():
    output.write(str(node.name)+"\n")

output.close()<commit_msg>fix #56 fix #67 underscore preservation<commit_after>"""
This file can be downloaded and used to create a .txt file containing only
the accession numbers from the ghost-tree.nwk that you plan to use for your
analyses.

You must have skbio installed. http://scikit-bio.org/
If you aren't familiar with skbio, make sure to check it out on its own, too!

You will then use "ghost_tree_tips.txt" output file containing the accession
numbers to filter your .biom table so that it contains only the OTUs that
are in the ghost-tree.nwk that you are using.

http://qiime.org/scripts/filter_otus_from_otu_table.html

Use the required arguments and the following two optional arguments:
-e, --otu_ids_to_exclude_fp
(provide the text file containing OTU ids to exclude)
--negate_ids_to_exclude
(this will keep OTUs in otu_ids_to_exclude_fp, rather than discard them)
"""
from skbio import TreeNode

ghosttree = TreeNode.read("ghost_tree_97_80clusters_from_alpha_release.nwk",
                          convert_underscores=False)  # your file goes here
output = open("ghost_tree_tips_underscore_fix.txt", "w")

for node in ghosttree.tips():
    output.write(str(node.name)+"\n")

output.close()
{'fraction_non_alphanumeric': 0.07664399092970521, 'fraction_numerical': 0.005442176870748299, 'mean_word_length': 4.700258397932816, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5923643', 'n_tokens_mistral': 728, 'n_tokens_neox': 678, 'n_words': 260}