Return names of all genes which overlap this variant. Calling
        this method is significantly cheaper than calling `Variant.genes()`,
        which has to issue many more queries to construct each Gene object.
760098
def gene_names(self):
        
        return self.ensembl.gene_names_at_locus(
            self.contig, self.start, self.end)
270281
def getGenomeList() :
	""""""
	import rabaDB.filters as rfilt
	f = rfilt.RabaQuery(Genome_Raba)
	names = []
	for g in f.iterRun() :
		names.append(g.name)
	return names
1061549
def getAllVariantSets(self):
        
        for dataset in self.getAllDatasets():
            iterator = self._client.search_variant_sets(
                dataset_id=dataset.id)
            for variantSet in iterator:
                yield variantSet
1331621
def get_search_names(name):
    
    parts = re.split('[-_.]', name)
    if len(parts) == 1:
        return parts

    result = set()
    for i in range(len(parts) - 1, 0, -1):
        for s1 in '-_.':
            prefix = s1.join(parts[:i])
            for s2 in '-_.':
                suffix = s2.join(parts[i:])
                for s3 in '-_.':
                    result.add(s3.join([prefix, suffix]))
    return list(result)
91845
def get_variants(data, include_germline=False):
    
    data = utils.deepish_copy(data)
    supported = ["precalled", "vardict", "vardict-java", "vardict-perl",
                 "freebayes", "octopus", "strelka2"]
    # Right now mutect2 and mutect do not provide heterozygous germline calls
    # to be useful https://github.com/bcbio/bcbio-nextgen/issues/2464
    # supported += ["mutect2", "mutect"]
    if include_germline:
        supported.insert(1, "gatk-haplotype")
    out = []
    # CWL based input
    if isinstance(data.get("variants"), dict) and "samples" in data["variants"]:
        cur_vs = []
        # Unpack single sample list of files
        if (isinstance(data["variants"]["samples"], (list, tuple)) and
              len(data["variants"]["samples"]) == 1 and isinstance(data["variants"]["samples"][0], (list, tuple))):
            data["variants"]["samples"] = data["variants"]["samples"][0]
        for fname in data["variants"]["samples"]:
            variantcaller = utils.splitext_plus(os.path.basename(fname))[0]
            variantcaller = variantcaller.replace(dd.get_sample_name(data) + "-", "")
            for batch in dd.get_batches(data):
                variantcaller = variantcaller.replace(batch + "-", "")
            cur_vs.append({"vrn_file": fname, "variantcaller": variantcaller})
        data["variants"] = cur_vs
    for v in data.get("variants", []):
        if v["variantcaller"] in supported and v.get("vrn_file"):
            out.append((supported.index(v["variantcaller"]), v))
    out.sort()
    return [xs[1] for xs in out]
533208
def reads_supporting_variants(variants, samfile, **kwargs):
    
    for variant, allele_reads in reads_overlapping_variants(
            variants=variants,
            samfile=samfile,
            **kwargs):
        yield variant, filter_non_alt_reads_for_variant(variant, allele_reads)
785655
def gene_names(self, contig=None, strand=None):
        
        return self._all_feature_values(
            column="gene_name",
            feature="gene",
            contig=contig,
            strand=strand)
52409
def variants(self, case_id, skip=0, count=1000, filters=None):
        """"""
        filters = filters or {}
        logger.debug("Fetching case with case_id: {0}".format(case_id))
        case_obj = self.case(case_id)
        plugin, case_id = self.select_plugin(case_obj)
        self.filters = plugin.filters

        gene_lists = (self.gene_list(list_id) for list_id
                      in filters.get('gene_lists', []))
        nested_geneids = (gene_list.gene_ids for gene_list in gene_lists)
        gene_ids = set(itertools.chain.from_iterable(nested_geneids))

        if filters.get('gene_ids'):
            filters['gene_ids'].extend(gene_ids)
        else:
            filters['gene_ids'] = gene_ids
        variants = plugin.variants(case_id, skip, count, filters)
        return variants
281637
def iter_variants(self):
        """"""
        if not self.has_index:
            raise NotImplementedError("Not implemented when IMPUTE2 file is "
                                      "not indexed (see genipe)")

        for name, row in self._impute2_index.iterrows():
            # Seeking to the right place in the file
            f = self._impute2_file
            f.seek(int(row.seek))
            chrom, name, pos, a1, a2 = f.read(1024).split(" ")[:5]
            pos = int(pos)

            yield Variant(name, CHROM_STR_ENCODE.get(chrom, chrom), pos,
                          [a1, a2])
782965
def genes(self):
        """"""
        return [ExpGene.from_series(g)
                for i, g in self.reset_index().iterrows()]
1167857
def get_other_gene_names(cls, entry):
        
        alternative_gene_names = []

        for alternative_gene_name in entry.iterfind("./gene/name"):

            if alternative_gene_name.attrib['type'] != 'primary':

                alternative_gene_name_dict = {
                    'type_': alternative_gene_name.attrib['type'],
                    'name': alternative_gene_name.text
                }

                alternative_gene_names.append(models.OtherGeneName(**alternative_gene_name_dict))

        return alternative_gene_names
572992
def genes_with_a_representative_structure(self):
        """"""
        tmp = DictList(x for x in self.genes if x.protein.representative_structure)
        return DictList(y for y in tmp if y.protein.representative_structure.structure_file)
142348
def variants(case_id):
    """"""
    filters = parse_filters()
    values = [value for key, value in iteritems(filters)
              if not isinstance(value, dict) and key != 'skip']
    is_active = any(values)
    variants, nr_of_variants = app.db.variants(
        case_id,
        skip=filters['skip'],
        filters={
            'gene_ids': filters['gene_symbols'],
            'frequency': filters.get('frequency'),
            'cadd': filters.get('cadd'),
            'sv_len': filters.get('sv_len'),
            'consequence': filters['selected_consequences'],
            'genetic_models': filters['selected_models'],
            'sv_types': filters['selected_sv_types'],
            'gene_lists': filters['gene_lists'],
            'impact_severities': filters['impact_severities'],
            'gemini_query': filters['gemini_query'],
            'range': filters['range'],
        }
    )
    gene_lists = ([gene_list.list_id for gene_list in app.db.gene_lists()]
                  if app.config['STORE_ENABLED'] else [])
    queries = ([(query.name or query.query, query.query) for query
                in app.db.gemini_queries()]
               if app.config['STORE_ENABLED'] else [])
    kwargs = dict(variants=variants, case_id=case_id, db=app.db,
                  filters=filters, consequences=SO_TERMS,
                  inheritance_models=INHERITANCE_MODELS_SHORT,
                  gene_lists=gene_lists, impact_severities=IMPACT_LEVELS,
                  is_active=is_active, nr_of_variants=nr_of_variants,
                  queries=queries)

    if app.db.variant_type == 'sv':
        return render_template('sv_variants.html', sv_types=SV_TYPES, **kwargs)
    else:
        return render_template('variants.html', **kwargs)
892685
def reads_to_dataframe(variants_and_allele_reads):
    
    df_builder = DataFrameBuilder(
        AlleleRead,
        extra_column_fns={
            "gene": lambda variant, _: ";".join(variant.gene_names),
        })
    for variant, allele_reads in variants_and_allele_reads:
        df_builder.add_many(variant, allele_reads)
    return df_builder.to_dataframe()
114154
def missing_homology_models(self):
        """"""
        return [x.id for x in self.genes if not self.genes_with_homology_models.has_id(x.id)]
334077
def get_proteininfo_fields(poolnames=False, genecentric=False):
    """"""
    allfields = OrderedDict()
    basefields = {
            False: [
                prottabledata.HEADER_GENEID, prottabledata.HEADER_GENENAME,
                prottabledata.HEADER_DESCRIPTION, prottabledata.HEADER_COVERAGE,
                prottabledata.HEADER_NO_PROTEIN, prottabledata.HEADER_CONTENTPROT,
                ],
            'genes': [
                prottabledata.HEADER_GENENAME, prottabledata.HEADER_PROTEINS,
                prottabledata.HEADER_DESCRIPTION],
            'assoc': [
                prottabledata.HEADER_GENEID, prottabledata.HEADER_PROTEINS,
                prottabledata.HEADER_DESCRIPTION],
            }[genecentric]
    poolfields = [prottabledata.HEADER_NO_UNIPEP,
                  prottabledata.HEADER_NO_PEPTIDE,
                  prottabledata.HEADER_NO_PSM,
                  ]
    for field in basefields:
        allfields[field] = False
    for field in poolfields:
        allfields[field] = poolnames
    return allfields
989011
def gene_by_id(self, gene_id):
        
        if gene_id not in self._genes:
            field_names = [
                "seqname",
                "start",
                "end",
                "strand",
            ]
            optional_field_names = [
                "gene_name",
                "gene_biotype",
            ]
            # Do not look for gene_name and gene_biotype if they are
            # not in the database.
            field_names.extend([
                name for name in optional_field_names
                if self.db.column_exists("gene", name)
            ])
            result = self.db.query_one(
                field_names,
                filter_column="gene_id",
                filter_value=gene_id,
                feature="gene")
            if not result:
                raise ValueError("Gene not found: %s" % (gene_id,))

            gene_name, gene_biotype = None, None
            assert len(result) >= 4 and len(result) <= 6, \
                "Result is not the expected length: %d" % len(result)
            contig, start, end, strand = result[:4]
            if len(result) == 5:
                if "gene_name" in field_names:
                    gene_name = result[4]
                else:
                    gene_biotype = result[4]
            elif len(result) == 6:
                gene_name, gene_biotype = result[4:]

            self._genes[gene_id] = Gene(
                gene_id=gene_id,
                gene_name=gene_name,
                contig=contig,
                start=start,
                end=end,
                strand=strand,
                biotype=gene_biotype,
                genome=self)

        return self._genes[gene_id]