<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 Phylogenetics Tutorial
Run a phylogenetics project, all in one place!
This tutorial will cover
Step1:  1. Inititialize a phylogenetics project
This creates a folder in your current working directory (here called 'project1') where your project data will be automatically saved.
This also initializes the project object (you can name it whatever you want).
The project object is a phylopandas dataframe that you can view within the notebook at any point. 
As you proceed, it will house all of your sequence, alignment, tree, and ancestor data.
Step2:  2. Read in your starting sequence(s)
You'll need at least one sequence to start with. In this example, we're reading in a single sequence - a human protein called MD2.
Step3:  3. Use BLAST to search for orthologs similar to your seed sequence(s)
The default search returns 100 hits with an e-value cutoff of 0.01 and default BLAST gap penalties.  
These parameters can be modified as you wish (to view options, run project.compute_blast? cell below or check out Biopython's NCBI BLAST module)
Step4:  4. Build a phylogenetic tree using PhyML
5. Reconstruct ancestral proteins using PAML
####### start working here ######
- add docs to alignment, clustering, tree building, ASR, gblocks, df_editor, etc.
- rd 1 tutorial - blast, align, tree, ancestors
- rd 2 - add in QC
<ASSISTANT_TASK:>
Python Code:
# import packages
import phylogenetics as phy
import phylogenetics.tools as tools
import phylopandas as ph
import pandas as pd
from phylovega import TreeChart
Explanation: Phylogenetics Tutorial
Run a phylogenetics project, all in one place!
This tutorial will cover:
Project initialization and data input/output
BLASTing and aligning sequences
Building a phylogenetic tree
Reconstructing ancestral proteins (ASR)
Quality control and evaluation for each of the steps above
End of explanation
# intitialize project object and create project folder
project = phy.PhylogeneticsProject(project_dir='tutorial', overwrite=True)
Explanation: 1. Inititialize a phylogenetics project
This creates a folder in your current working directory (here called 'project1') where your project data will be automatically saved.
This also initializes the project object (you can name it whatever you want).
The project object is a phylopandas dataframe that you can view within the notebook at any point. 
As you proceed, it will house all of your sequence, alignment, tree, and ancestor data.
End of explanation
# read in seed sequence(s) to project object
project.read_data("md2_seed_sequence.txt", schema="fasta")
Explanation: 2. Read in your starting sequence(s)
You'll need at least one sequence to start with. In this example, we're reading in a single sequence - a human protein called MD2.
End of explanation
# run BLAST search with default settings, returning 100 hits
project.compute_blast(hitlist_size=100)
Explanation: 3. Use BLAST to search for orthologs similar to your seed sequence(s)
The default search returns 100 hits with an e-value cutoff of 0.01 and default BLAST gap penalties.  
These parameters can be modified as you wish (to view options, run project.compute_blast? cell below or check out Biopython's NCBI BLAST module)
End of explanation
project.compute_clusters()
project.compute_alignment()
project.compute_gblocks()
project.compute_tree()
project.compute_reconstruction()
# Visualize tree and ancestors using phylovega
from phylovega import TreeChart
# Construct Vega Specification
chart = TreeChart.from_phylopandas(
    project.data,
    height_scale=300,
    # Node attributes
    node_size=300,
    node_color="#ccc",
    # Leaf attributes
    leaf_labels="id",
    # Edge attributes
    edge_width=2,
    edge_color="#000",
)
chart
Explanation: 4. Build a phylogenetic tree using PhyML
5. Reconstruct ancestral proteins using PAML
####### start working here ######
- add docs to alignment, clustering, tree building, ASR, gblocks, df_editor, etc.
- rd 1 tutorial - blast, align, tree, ancestors
- rd 2 - add in QC:
1) look at alignment (outsource to aliview)
- remove bad seqs (df_editor)
3) look at tree (outsource to figtree? use viewer?)
- remove long branches (df_editor)
4) ancestors - look at PP, compare before and after QC
End of explanation
<END_TASK>