Check if the family members break the structure of the family. 
        
        eg. nonexistent parent, wrong sex on parent etc. 
        
        Also extracts all trios found, this is of help for many at the moment 
        since GATK can only do phasing of trios and duos.

def family_check(self):
        """
        Check if the family members break the structure of the family. 
        
        eg. nonexistent parent, wrong sex on parent etc. 
        
        Also extracts all trios found, this is of help for many at the moment 
        since GATK can only do phasing of trios and duos.
        """
        #TODO Make some tests for these
        self.logger.info("Checking family relations for {0}".format(
            self.family_id)
        )
        for individual_id in self.individuals:
            
            self.logger.debug("Checking individual {0}".format(individual_id))
            individual = self.individuals[individual_id]
            
            self.logger.debug("Checking if individual {0} is affected".format(
                individual_id))
            
            if individual.affected:
                self.logger.debug("Found affected individual {0}".format(
                    individual_id)
                )
                self.affected_individuals.add(individual_id)
            
            father = individual.father
            mother = individual.mother
            
            if individual.has_parents:
                self.logger.debug("Individual {0} has parents".format(
                    individual_id))
                self.no_relations = False
                try:
                    self.check_parent(father, father=True)
                    self.check_parent(mother, father=False)
                except PedigreeError as e:
                    self.logger.error(e.message)
                    raise e
                
                # Check if there is a trio
                if individual.has_both_parents:
                    self.trios.append(set([individual_id, father, mother]))
                elif father != '0':
                    self.duos.append(set([individual_id, father]))
                else:
                    self.duos.append(set([individual_id, mother]))
                
                ##TODO self.check_grandparents(individual)
            
            # Annotate siblings:
            for individual_2_id in self.individuals:
                if individual_id != individual_2_id:
                    if self.check_siblings(individual_id, individual_2_id):
                        individual.siblings.add(individual_2_id)