That's a very interesting question. It seems the gangs have an overt role and an implied role. Their overt roles are their importance to Jack and to the plot of the story.
Warren's gang, the basketball playing gang that will have absolutely nothing to do with drugs or with anyone involved with drugs, has the overt role of protector and rescuer for Jack. From the moment Jack enters their neighborhood, a neighborhood that Jack is ill suited for as a Medical Examiner for the City of New York, Warren has acted as Jack's protector and rescuer by letting him play neighborhood basketball and by keeping a general watch on him and by befriending him. In the last chapters of the story, Warren becomes the ultimate rescuer by saving Jack from another hit-man attack. This rescue actually comes when he and Twin meet to call a truce between the gangs and is finalized when Jack is found shivering in a trunk in a cold barn, all his other enemies being dead or participating in the truce.
Twin's gang has the overt role of being the most overt antagonist of several antagonists in this story. It is Twin's gang whose help is purchased by Richard and through whom the warning to stay away from the nosocomial problem at Manhattan General is delivered. It is Twin's gang that is commissioned with a hit on Jack, with Reginald intending to assassinate Jack in Central Park. It is Twin's gang that Richard turns to when neither he nor Terese has the courage to pull the trigger on Jack once they have him handcuffed to their sink drain pipe (the truce between Twin and Warren was already active so Twin rejected that offer).
The implied roles of the gangs can only be inferred though on good evidence. It seems that Warren's gang's implied role is to show the humanity of gangs and the broad range of ideology undergirding New York gangs: not all gangs are immoral and trading in illegal substances. It seems that Twin's gang implied role is as a representation of the stereotypical gang that trades in illegal drugs, weapons and violence. Yet, Cook seems to break the stereotype by showing the moral and philosophical ideology behind even stereotypical gangs when Twin and Warren agree to a truce and a cessation of violence, including toward the Doc.
"The point is that we have a truce," Warren said.
"Damn straight," Win said. "No more brother shooting brother. We've got enough trouble without that."
"But a truce means you lay off the doc too." warren said.
"You care what happen to that dude?" Twin asked.
"Yeah, I do," Warren said.
"Hey, then it's your call, man," Twin said.