Looks for a variant board class by variant name.
186211
def find_variant(name: str) -> Type[chess.Board]:
    """"""
    for variant in VARIANTS:
        if any(alias.lower() == name.lower() for alias in variant.aliases):
            return variant
    raise ValueError("unsupported variant: {}".format(name))
323331
def search_variants(self, variant_ids):
        
        query = {'_id': {'$in': variant_ids}}
        
        return self.db.variant.find(query)
25299
def runSearchVariants(self, request):
        
        return self.runSearchRequest(
            request, protocol.SearchVariantsRequest,
            protocol.SearchVariantsResponse,
            self.variantsGenerator)
164584
def get_variant_by_name(self, name):
        
        results = []

        try:
            for info, dosage in self._bgen.get_variant(name):
                results.append(Genotypes(
                    Variant(
                        info.name,
                        CHROM_STR_ENCODE.get(info.chrom, info.chrom),
                        info.pos,
                        [info.a1, info.a2],
                    ),
                    dosage,
                    reference=info.a1,
                    coded=info.a2,
                    multiallelic=False,
                ))

        except ValueError:
            logging.variant_name_not_found(name)

        return results
682110
def get_variants_in_region(self, chrom, start, end):
        """"""
        region = self.get_vcf()(
            "{}:{}-{}".format(chrom, start, end)
        )
        for v in region:
            for coded_allele, g in self._make_genotypes(v.ALT, v.genotypes):
                variant = Variant(
                    v.ID, v.CHROM, v.POS, [v.REF, coded_allele]
                )
                yield Genotypes(variant, g, v.REF, coded_allele,
                                multiallelic=len(v.ALT) > 1)
842874
def _check_variantcaller(item):
    
    allowed = set(list(genotype.get_variantcallers().keys()) + [None, False])
    vcs = item["algorithm"].get("variantcaller")
    if not isinstance(vcs, dict):
        vcs = {"variantcaller": vcs}
    for vc_set in vcs.values():
        if not isinstance(vc_set, (tuple, list)):
            vc_set = [vc_set]
        problem = [x for x in vc_set if x not in allowed]
        if len(problem) > 0:
            raise ValueError("Unexpected algorithm 'variantcaller' parameter: %s\n"
                             "Supported options: %s\n" % (problem, sorted(list(allowed))))
    # Ensure germline somatic calling only specified with tumor/normal samples
    if "germline" in vcs or "somatic" in vcs:
        paired = vcfutils.get_paired_phenotype(item)
        if not paired:
            raise ValueError("%s: somatic/germline calling in 'variantcaller' "
                             "but tumor/normal metadata phenotype not specified" % dd.get_sample_name(item))
325194
def name_variants(self):
        
        out = []
        variant = namedtuple('Variant', 'name doc_count')
        for var in chained_get(self._json, ['name-variants', 'name-variant'], []):
            new = variant(name=var['$'], doc_count=var.get('@doc-count'))
            out.append(new)
        return out
89495
def get_variants_in_region(self, chrom, start, end):
        """"""
        bim = self.bim.loc[
            (self.bim["chrom"] == CHROM_STR_TO_INT[chrom]) &
            (start <= self.bim["pos"]) &
            (self.bim["pos"] <= end)
        ]
        for i, g in enumerate(self.bed.iter_geno_marker(bim.index)):
            info = bim.iloc[i, :]
            name, geno = g
            yield Genotypes(
                Variant(info.name, CHROM_INT_TO_STR[info.chrom],
                        info.pos, [info.a1, info.a2]),
                self._normalize_missing(geno),
                reference=info.a2,
                coded=info.a1,
                multiallelic=info.multiallelic
            )
132642
def iter_variants(self):
        """"""
        for v in self.get_vcf():
            yield Variant(v.ID, v.CHROM, v.POS, {v.REF} | set(v.ALT))
593742
def variants_in_coords(nucmer_matches, vcf_file):
        ''''''
        found_variants = {}
        f = pyfastaq.utils.open_file_read(vcf_file)
        for line in f:
            if line.startswith('#'):
                continue

            data = line.rstrip().split('\t')
            scaff = data[0]

            if scaff in nucmer_matches:
                position = int(data[1]) - 1
                i = pyfastaq.intervals.Interval(position, position)
                intersects = len([x for x in nucmer_matches[scaff] if x.intersects(i)]) > 0
                if intersects:
                    if scaff not in found_variants:
                        found_variants[scaff] = set()
                    found_variants[scaff].add(position)

        pyfastaq.utils.close(f)
        return found_variants
447360
def has_variantcalls(data):
    
    analysis = get_analysis(data).lower()
    variant_pipeline = analysis.startswith(("standard", "variant", "variant2"))
    variantcaller = get_variantcaller(data)
    return variant_pipeline or variantcaller
316444
async def variant(self, elem=None, elem_type=None, params=None, obj=None):
        
        elem_type = elem_type if elem_type else elem.__class__

        if hasattr(elem_type, 'kv_serialize'):
            elem = elem_type() if elem is None else elem
            return await elem.kv_serialize(self, elem=elem, elem_type=elem_type, params=params, obj=obj)

        if self.writing:
            return await self.dump_variant(elem=elem,
                                           elem_type=elem_type if elem_type else elem.__class__, params=params, obj=obj)
        else:
            return await self.load_variant(elem_type=elem_type if elem_type else elem.__class__,
                                           params=params, elem=elem, obj=obj)
358617
def _define_variant(self):
        """"""
        space = None
        variants = {
            # to be expanded once addtional spaces are supported
            'space1': ['fsaverage5', 'MNI152NLin2009cAsym'],
            'space2': ['fsaverage6', 'MNI152NLin2009cAsym'],
        }
        for sp, targets in variants.items():
            if all(target in targets for target in
                    [self.inputs.surface_target, self.inputs.volume_target]):
                space = sp
        if space is None:
            raise NotImplementedError

        variant_key = os.path.abspath('dtseries_variant.json')
        with open(variant_key, 'w') as fp:
            json.dump({space: variants[space]}, fp)
        return variant_key, space
456220
private static List<String> getVariantKeys(String variantKeyPrefix, Collection<String> variants) {

		List<String> variantKeys = new ArrayList<>();
		for (String variant : variants) {
			if (variant == null) {
				variant = "";
			}
			if (variantKeyPrefix == null) {
				variantKeys.add(variant);
			} else {
				variantKeys.add(variantKeyPrefix + variant);
			}
		}

		return variantKeys;
	}
765414
public static Class<?> classFind(String name) {
        try {
            return Class.forName(name);
        } catch (ClassNotFoundException e) {
            return findType(name).type;
        }
    }
235728
public static String getVariantBundleName(String bundleName, String variantKey, boolean iGeneratedResource) {

		String newName = bundleName;
		if (StringUtils.isNotEmpty(variantKey)) {
			int idxSeparator = bundleName.lastIndexOf('.');
			if (!iGeneratedResource && idxSeparator != -1) {
				newName = bundleName.substring(0, idxSeparator);
				newName += JawrConstant.VARIANT_SEPARATOR_CHAR + variantKey;
				newName += bundleName.substring(idxSeparator);
			} else {
				newName += JawrConstant.VARIANT_SEPARATOR_CHAR + variantKey;
			}
		}

		return newName;
	}
336069
function variants(name, initial) {
  const map = initial ? initStars : bubbleStars;
  if (map[name]) return map[name];

  const parts = name.split('.');
  const result = [];
  let base = false;

  // initial events the implicit namespace of 'this'
  if (initial) {
    parts.unshift('this');
    base = true;
  }

  // use max - 1 bits as a bitmap to pick a part or a *
  // need to skip the full star case if the namespace is synthetic
  const max = Math.pow(2, parts.length) - (initial ? 1 : 0);
  for (let i = 0; i < max; i++) {
    const join = [];
    for (let j = 0; j < parts.length; j++) {
      join.push(1 & (i >> j) ? '*' : parts[j]);
    }
    result.unshift(join.join('.'));
  }

  if (base) {
    // include non-this-namespaced versions
    if (parts.length > 2) {
      result.push.apply(result, variants(name, false));
    } else {
      result.push('*');
      result.push(name);
    }
  }

  map[name] = result;
  return result;
}