<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 CS446/546 - Class Session 8 - Components
In this class session we are going to find the number of proteins that are in the giant component of the (undirected) protein-protein interaction network, using igraph.
Step1:  Step 1
Step2:  Step 2
Step3:  Step 3
Step4:  Step 4
<ASSISTANT_TASK:>
Python Code:
from igraph import Graph
from igraph import summary
import pandas
import numpy
Explanation: CS446/546 - Class Session 8 - Components
In this class session we are going to find the number of proteins that are in the giant component of the (undirected) protein-protein interaction network, using igraph.
End of explanation
sif_data = pandas.read_csv("shared/pathway_commons.sif",
                           sep="\t", names=["species1","interaction_type","species2"])
Explanation: Step 1:  load in the SIF file (refer to Class 6 exercise) into a data frame sif_data, using the pandas.read_csv function, and name the columns species1, interaction_type, and species2.
End of explanation
interaction_types_ppi = set(["interacts-with",
                             "in-complex-with"])
interac_ppi = sif_data[sif_data.interaction_type.isin(interaction_types_ppi)].copy()
Explanation: Step 2:  restrict the interactions to protein-protein undirected ("in-complex-with", "interacts-with"), by using the isin function and then using [ to index rows into the data frame.  Call the returned ata frame interac_ppi.
End of explanation
boolean_vec = interac_ppi['species1'] > interac_ppi['species2']
interac_ppi.loc[boolean_vec, ['species1', 'species2']] = interac_ppi.loc[boolean_vec, ['species2', 'species1']].values
        
interac_ppi_unique = interac_ppi[["species1","species2"]].drop_duplicates()        
ppi_igraph = Graph.TupleList(interac_ppi_unique.values.tolist(), directed=False)
summary(ppi_igraph)
Explanation: Step 3: restrict the data frame to only the unique interaction pairs of proteins (ignoring the interaction type), and call that data frame interac_ppi_unique. Make an igraph Graph object from interac_ppi_unique using Graph.TupleList, values, and tolist. Call summary on the Graph object. Refer to the notebooks for the in-class exercises in Class sessions 3 and 6.
End of explanation
# call the `clusters` method on the `ppi_igraph` object, and assign the 
# resulting `VertexClustering` object to have object name `ppi_components`
# call the `sizes` method on the `ppi_components` object, and assign the
# resulting list object to have the name `ppi_component_sizes`.
# make a `numpy.array` initialized by `ppi_component_sizes`, and find its 
# maximum value using the `max` method on the `numpy.array` class
Explanation: Step 4: Map the components of the network using the igraph.Graph.clusters method. That method returns a igraph.clustering.VertexClustering object.  Call the sizes method on that VertexClustering object, to get a list of sizes of the components.  What is the giant component size?
End of explanation
<END_TASK>