
import os
import shutil
import datetime
import sys
import argparse

from ete3 import Tree

import logging

DEFAULT_FORMAT = 1

class TreeIndex:

	def __init__(self,tree_newick_fn,format=DEFAULT_FORMAT):
		self.tree_newick_fn=tree_newick_fn
		self.tree=read_newick(tree_newick_fn,format=format)

	def process_node(self,node):
		if node.is_leaf():
			if hasattr(node,"fastapath"):
				fastas_fn=node.fastapath.split("@")
				for fasta_fn in fastas_fn:
					print(fasta_fn)

		else:
			children=node.get_children()

			for child in children:
				self.process_node(child)



if __name__ == "__main__":

	assert(len(sys.argv)==2)
	newick_fn=sys.argv[1]

	ti=TreeIndex(
			tree_newick_fn=newick_fn,
		)
	ti.process_node(ti.tree.get_tree_root())


import os
import shutil
import datetime
import sys

from ete3 import Tree

DEFAULT_FORMAT = 1

class TreeIndex:

	def __init__(self,tree_newick_fn,format=DEFAULT_FORMAT):
		self.tree_newick_fn=tree_newick_fn
		self.tree=Tree(tree_newick_fn,format=format)

	def process_node(self,node):
		if node.is_leaf():
			if hasattr(node,"fastapath"):
				fastas_fn=node.fastapath.split("@")
				for fasta_fn in fastas_fn:
					print(fasta_fn)

		else:
			children=node.get_children()

			for child in children:
				self.process_node(child)



if __name__ == "__main__":

	assert(len(sys.argv)==2)
	newick_fn=sys.argv[1]

	ti=TreeIndex(
			tree_newick_fn=newick_fn,
		)
	ti.process_node(ti.tree.get_tree_root())

Fix error in loading trees
Fix error in loading trees


Former-commit-id: 6fda03a47c5fa2d65c143ebdd81e158ba5e1ccda
  
  import os
  import shutil
  import datetime
  import sys
- import argparse
  
  from ete3 import Tree
- 
- import logging
  
  DEFAULT_FORMAT = 1
  
  class TreeIndex:
  
  	def __init__(self,tree_newick_fn,format=DEFAULT_FORMAT):
  		self.tree_newick_fn=tree_newick_fn
- 		self.tree=read_newick(tree_newick_fn,format=format)
+ 		self.tree=Tree(tree_newick_fn,format=format)
  
  	def process_node(self,node):
  		if node.is_leaf():
  			if hasattr(node,"fastapath"):
  				fastas_fn=node.fastapath.split("@")
  				for fasta_fn in fastas_fn:
  					print(fasta_fn)
  
  		else:
  			children=node.get_children()
  
  			for child in children:
  				self.process_node(child)
  
  
  
  if __name__ == "__main__":
  
  	assert(len(sys.argv)==2)
  	newick_fn=sys.argv[1]
  
  	ti=TreeIndex(
  			tree_newick_fn=newick_fn,
  		)
  	ti.process_node(ti.tree.get_tree_root())
  
Fix error in loading trees
## Code Before:

import os
import shutil
import datetime
import sys
import argparse

from ete3 import Tree

import logging

DEFAULT_FORMAT = 1

class TreeIndex:

	def __init__(self,tree_newick_fn,format=DEFAULT_FORMAT):
		self.tree_newick_fn=tree_newick_fn
		self.tree=read_newick(tree_newick_fn,format=format)

	def process_node(self,node):
		if node.is_leaf():
			if hasattr(node,"fastapath"):
				fastas_fn=node.fastapath.split("@")
				for fasta_fn in fastas_fn:
					print(fasta_fn)

		else:
			children=node.get_children()

			for child in children:
				self.process_node(child)



if __name__ == "__main__":

	assert(len(sys.argv)==2)
	newick_fn=sys.argv[1]

	ti=TreeIndex(
			tree_newick_fn=newick_fn,
		)
	ti.process_node(ti.tree.get_tree_root())

## Instruction:
Fix error in loading trees
## Code After:

import os
import shutil
import datetime
import sys

from ete3 import Tree

DEFAULT_FORMAT = 1

class TreeIndex:

	def __init__(self,tree_newick_fn,format=DEFAULT_FORMAT):
		self.tree_newick_fn=tree_newick_fn
		self.tree=Tree(tree_newick_fn,format=format)

	def process_node(self,node):
		if node.is_leaf():
			if hasattr(node,"fastapath"):
				fastas_fn=node.fastapath.split("@")
				for fasta_fn in fastas_fn:
					print(fasta_fn)

		else:
			children=node.get_children()

			for child in children:
				self.process_node(child)



if __name__ == "__main__":

	assert(len(sys.argv)==2)
	newick_fn=sys.argv[1]

	ti=TreeIndex(
			tree_newick_fn=newick_fn,
		)
	ti.process_node(ti.tree.get_tree_root())
