def load_phenofile(self, file, indices=[], names=[], sample_file=False):
        """Load phenotype data from phenotype file

        Whitespace delimited, FAMID, INDID, VAR1, [VAR2], etc

        Users can specify phenotypes of interest via indices and names.
        Indices are 1 based and start with the first variable. names
        must match name specified in the header (case is ignored). """

        file.seek(0)
        self.phenotype_names = []
        if file:
            header = ["", "", ""]
            header = file.readline().strip().upper().split()
            line_number = 0
            valid_indices = [int(x) for x in indices]
            valid_names  = []

            for name in names:
                if name.strip() != "":
                    valid_names.append(name)

            # Rows ignored because family/individual missing from our pedigree data
            ignored_data = []
            # We can accept a default phenotype column if we only have 3 columns
            if len(header) == 3:
                if len(valid_names) + len(valid_indices) == 0:
                    valid_indices.append(1)
            if header[0].upper() == "FID":
                phenotype_names = header[2:]
                for name in valid_names:
                    try:
                        valid_indices.append(phenotype_names.index(name.upper()) + 1)
                    except:
                        raise InvalidSelection(
                            "The name, %s, was not found in %s" % (name, file.name)
                        )
                line_number = 1

                if len(valid_indices) > 0 and max(valid_indices) > (len(header)-2):
                    raise InvalidSelection(
                        "The index, %s, is larger than the number of entries in the file, %s:%s" %
                        (max(valid_indices), file.name, line_number)
                    )

                for i in xrange(0, len(valid_indices)):
                    self.phenotype_names.append(phenotype_names[valid_indices[i]-1])
                # Dump the second line for sample_file==True
                if sample_file:
                    file.readline()
                    line_number += 1
            # if we don't have a header, we'll create dummy names
            else:
                file.seek(0)
                if len(valid_names) > 0:
                    raise MalformedInputFile(
                        "Names only work with phenotype files with headers: %s for file %s" %
                        (",".join(names), file.name)
                    )
                if len(valid_indices) > 0 and max(valid_indices) > (len(header)-2):
                    raise InvalidSelection(
                        "The index, %s, is larger than the number of entries in the file, %s:%s" %
                        (max(valid_indices), file.name, line_number)
                    )

                self.phenotype_names = []
                for i in xrange(0, len(valid_indices)):
                    self.phenotype_names.append("Pheno-%s" % (valid_indices[i]))

            pheno_count = len(valid_indices)
            self.phenotype_data = numpy.empty((pheno_count, len(self.pedigree_data)))
            self.phenotype_data.fill(PhenoCovar.missing_encoding)

            for line in file:
                line_number += 1
                words   = line.split()
                iid = ":".join(words[0:2])

                # Indexes are 1 based...silly humans
                if len(valid_indices) > 0 and max(valid_indices) > (len(words)-2):
                    raise InvalidSelection(
                        "The index, %s, is larger than the number of entries in the file, %s:%s" %
                        (max(valid_indices), file.name, line_number)
                    )


                pidx = 0
                for idx in valid_indices:
                    try:
                        pheno = float(words[1+idx])
                        if iid not in self.pedigree_data:
                            ignored_data.append(iid)
                        else:
                            self.phenotype_data[pidx][self.pedigree_data[iid]] = pheno
                        pidx += 1
                    except:
                        raise MalformedInputFile(
                            ("Invalid input found in phenotype file on line: %s:%d. \n"+
                            "The line in question looks like this: \n--> %s") %
                            (file.name, line_number, line.strip())
                        )
        if self.phenotype_data.shape[1] == len(ignored_data):
            raise NoMatchedPhenoCovars("No matching individuals were found in the phenotype file")
Load phenotype data from phenotype file

        Whitespace delimited, FAMID, INDID, VAR1, [VAR2], etc

        Users can specify phenotypes of interest via indices and names.
        Indices are 1 based and start with the first variable. names
        must match name specified in the header (case is ignored).