示例#1
0
    def ncbiDereplicatedGenomes(self, include_user_reps):
        """Get identifiers from the dereplicated set of NCBI genome.

        Identifiers are return for NCBI representative genomes
        and NCBI genomes without a representative.

        Parameters
        ----------
        include_user_reps : bool
            Flag indicating if NCBI genomes assigned to a
            User representative should be returned.

        Returns
        -------
        list
            List of database genome identifiers.
        """

        try:
            genome_mngr = GenomeManager(self.cur, self.currentUser)
            ncbi_genomes_ids = genome_mngr.ncbiGenomeIds()

            self.cur.execute(
                "SELECT id " + "FROM metadata_taxonomy " +
                "WHERE (gtdb_representative = 'TRUE' " +
                "OR gtdb_genome_representative IS NULL) " + "AND id = ANY(%s)",
                (ncbi_genomes_ids, ))
            derep_genome_ids = [genome_id[0] for genome_id in self.cur]

            if include_user_reps:
                self.cur.execute(
                    "SELECT id " + "FROM metadata_taxonomy " +
                    "WHERE (gtdb_representative = 'FALSE' " +
                    "AND gtdb_genome_representative LIKE %s " +
                    "AND id = ANY(%s))", (
                        'U%',
                        ncbi_genomes_ids,
                    ))
                derep_genome_ids += [genome_id[0] for genome_id in self.cur]

        except GenomeDatabaseError as e:
            raise e

        return derep_genome_ids
    def ncbiDereplicatedGenomes(self, include_user_reps):
        """Get identifiers from the dereplicated set of NCBI genome.

        Identifiers are return for NCBI representative genomes
        and NCBI genomes without a representative.

        Parameters
        ----------
        include_user_reps : bool
            Flag indicating if NCBI genomes assigned to a
            User representative should be returned.

        Returns
        -------
        list
            List of database genome identifiers.
        """

        try:
            genome_mngr = GenomeManager(self.cur, self.currentUser)
            ncbi_genomes_ids = genome_mngr.ncbiGenomeIds()

            self.cur.execute("SELECT id " +
                             "FROM metadata_taxonomy " +
                             "WHERE (gtdb_representative = 'TRUE' " +
                             "OR gtdb_genome_representative IS NULL) " +
                             "AND id = ANY(%s)", (ncbi_genomes_ids,))
            derep_genome_ids = [genome_id[0] for genome_id in self.cur]

            if include_user_reps:
                self.cur.execute("SELECT id " +
                                 "FROM metadata_taxonomy " +
                                 "WHERE (gtdb_representative = 'FALSE' " +
                                 "AND gtdb_genome_representative LIKE %s " +
                                 "AND id = ANY(%s))", ('U%', ncbi_genomes_ids,))
                derep_genome_ids += [genome_id[0] for genome_id in self.cur]

        except GenomeDatabaseError as e:
            raise e

        return derep_genome_ids
示例#3
0
    def ncbiRepresentativeGenomes(self):
        """Get genome identifiers for all NCBI representative genomes.

        Returns
        -------
        list
            List of database identifiers for NCBI representative genomes.
        """

        try:
            genome_mngr = GenomeManager(self.cur, self.currentUser)
            ncbi_genomes_ids = genome_mngr.ncbiGenomeIds()

            self.cur.execute("SELECT id " +
                             "FROM metadata_taxonomy " +
                             "WHERE gtdb_representative = 'TRUE' " +
                             "AND id = ANY(%s)", (ncbi_genomes_ids,))
            rep_genome_ids = [genome_id[0] for genome_id in self.cur]

        except GenomeDatabaseError as e:
            raise e

        return rep_genome_ids
    def ncbiRepresentativeGenomes(self):
        """Get genome identifiers for all NCBI representative genomes.

        Returns
        -------
        list
            List of database identifiers for NCBI representative genomes.
        """

        try:
            genome_mngr = GenomeManager(self.cur, self.currentUser)
            ncbi_genomes_ids = genome_mngr.ncbiGenomeIds()

            self.cur.execute("SELECT id " +
                             "FROM metadata_taxonomy " +
                             "WHERE gtdb_representative = 'TRUE' " +
                             "AND id = ANY(%s)", (ncbi_genomes_ids,))
            rep_genome_ids = [genome_id[0] for genome_id in self.cur]

        except GenomeDatabaseError as e:
            raise e

        return rep_genome_ids