Pin a variant as a suspect for a given case.
773878
def suspects(case_id, variant_id):
    """"""
    case_obj = app.db.case(case_id)
    variant_obj = app.db.variant(case_id, variant_id)
    app.db.add_suspect(case_obj, variant_obj)
    return redirect(request.referrer)
184968
def _get_update(self, variant):
        
        update = {
                '$inc': {
                    'homozygote': variant.get('homozygote', 0),
                    'hemizygote': variant.get('hemizygote', 0),
                    'observations': 1
                },
                '$set': {
                    'chrom': variant.get('chrom'),
                    'start': variant.get('pos'),
                    'end': variant.get('end'),
                    'ref': variant.get('ref'),
                    'alt': variant.get('alt'),
                }
             }
        if variant.get('case_id'):
            update['$push'] = {
                                'families': {
                                '$each': [variant.get('case_id')],
                                '$slice': -50
                                }
                            }
        return update
1199183
def filter_ignoring_case(self, pattern):
        
        return self.filter(re.compile(pattern, re.I))
976324
def bin_case_insensitive(self):
        
        if "--case-ins" in self.flag:
            data_dict = Utils().case_sensitive(self.names)
            for key, value in data_dict.iteritems():
                if key == self.name.lower():
                    self.name = value
13810
def p_case_list(p):
    ''''''
    if len(p) == 6:
        p[0] = p[1] + [ast.Case(p[3], p[5], lineno=p.lineno(2))]
    elif len(p) == 5:
        p[0] = p[1] + [ast.Default(p[4], lineno=p.lineno(2))]
    else:
        p[0] = []
1309403
def p_lconst_case_list(self, p):
        ''''''
        if len(p) == 4:
            p[0] = [('lconst', (p[1], p[3]))]
        elif len(p) == 6:
            p[1].append(('lconst', (p[3], p[5])))
            p[0] = p[1]
320113
private void checkForDuplicateDefault(List<Stmt.Case> cases) {
		boolean hasDefault = false;
		for(int i=0;i!=cases.size();++i) {
			Stmt.Case c = cases.get(i);
			if (c.getConditions().size() > 0 && hasDefault) {
				syntaxError("unreachable code", c);
			} else if (c.getConditions().size() == 0 && hasDefault) {
				syntaxError("duplicate default label", c);
			} else {
				hasDefault = c.getConditions().size() == 0;
			}
		}
	}
524206
def cases(ctx, case_id, to_json):
    """"""

    adapter = ctx.obj['adapter']
    cases = []

    if case_id:
        case_obj = adapter.case({'case_id':case_id})
        if not case_obj:
            LOG.info("Case {0} does not exist in database".format(case_id))
            return
        case_obj['_id'] = str(case_obj['_id'])
        cases.append(case_obj)
    else:
        cases = adapter.cases()
        if cases.count() == 0:
            LOG.info("No cases found in database")
            ctx.abort()

    if to_json:
        click.echo(json.dumps(cases))
        return

    click.echo("#case_id\tvcf_path")

    for case_obj in cases:
        click.echo("{0}\t{1}".format(case_obj.get('case_id'), case_obj.get('vcf_path')))
358621
def comments(case_id):
    """"""
    text = request.form['text']
    variant_id = request.form.get('variant_id')
    username = request.form.get('username')
    case_obj = app.db.case(case_id)
    app.db.add_comment(case_obj, text, variant_id=variant_id, username=username)
    return redirect(request.referrer)
1199791
private void addHomozygousGenotype(Variant variant, int numAllele, String[] alternateAlleles, VariantStats stats, String[] homCounts) {
        if (homCounts.length == alternateAlleles.length) {
            for (int i = 0; i < homCounts.length; i++) {
                Integer alleles[] = new Integer[2];
                getHomozygousGenotype(i + 1, alleles);
                String gt = VariantVcfFactory.mapToMultiallelicIndex(alleles[0], numAllele) + "/" + VariantVcfFactory.mapToMultiallelicIndex(alleles[1], numAllele);
                Genotype genotype = new Genotype(gt, variant.getReference(), alternateAlleles[numAllele]);
                stats.addGenotype(genotype, Integer.parseInt(homCounts[i]));
            }
        }
    }
526149
def build_profile_variant(variant):
    

    chrom = variant.CHROM
    if chrom.startswith(('chr', 'CHR', 'Chr')):
        chrom = chrom[3:]

    pos = int(variant.POS)

    variant_id = get_variant_id(variant)

    ref = variant.REF
    alt = variant.ALT[0]

    maf = get_maf(variant)

    profile_variant = ProfileVariant(
        variant_id=variant_id,
        chrom=chrom,
        pos=pos,
        ref=ref,
        alt=alt,
        maf=maf,
        id_column = variant.ID
    )

    return profile_variant
556717
private void removeSTV(String source,
                           String target,
                           String variant) {
        // assert(source.length() > 0);
        // assert(target.length() > 0);
        CaseInsensitiveString cisrc = new CaseInsensitiveString(source);
        CaseInsensitiveString citrg = new CaseInsensitiveString(target);
        CaseInsensitiveString civar = new CaseInsensitiveString(variant);
        Map<CaseInsensitiveString, List<CaseInsensitiveString>> targets = specDAG.get(cisrc);
        if (targets == null) {
            return; // should never happen for valid s-t/v
        }
        List<CaseInsensitiveString> variants = targets.get(citrg);
        if (variants == null) {
            return; // should never happen for valid s-t/v
        }
        variants.remove(civar);
        if (variants.size() == 0) {
            targets.remove(citrg); // should delete variants
            if (targets.size() == 0) {
                specDAG.remove(cisrc); // should delete targets
            }
        }
    }
1330538
def _preprocess(argument, casesensitive):
        """"""
        pattern_set = PatternSet()
        if argument is not None:
            if isinstance(argument, STRING_TYPES):
                argument = [argument, ]

            for glob in argument:
                if isinstance(glob, str):
                    patterns = Pattern.create(glob, casesensitive)
                    pattern_set.extend(patterns)

                elif isinstance(glob, Pattern):
                    pattern_set.append(glob)

        return pattern_set
137212
def span_case(self, i, case):
        """"""

        # A new \L, \C or \E should pop the last in the stack.
        if self.span_stack:
            self.span_stack.pop()
        if self.single_stack:
            self.single_stack.pop()
        self.span_stack.append(case)
        count = len(self.span_stack)
        self.end_found = False
        try:
            while not self.end_found:
                t = next(i)
                if self.use_format and t in _CURLY_BRACKETS:
                    self.handle_format(t, i)
                elif t == '\\':
                    try:
                        t = next(i)
                        self.reference(t, i)
                    except StopIteration:
                        self.result.append(t)
                        raise
                else:
                    self.result.append(self.convert_case(t, case))
                if self.end_found or count > len(self.span_stack):
                    self.end_found = False
                    break
        except StopIteration:
            pass
        if count == len(self.span_stack):
            self.span_stack.pop()
132313
def ismatch(text, pattern):
    """"""

    if hasattr(pattern, 'search'):
        return pattern.search(text) is not None
    else:
        return pattern in text if Config.options.case_sensitive \
            else pattern.lower() in text.lower()
747613
def ILIKE(pattern):
    """"""
    return P(lambda x: fnmatch.fnmatch(x.lower(), pattern.lower()))
593618
function variants(sequence, cb) {
        if (sequence.length === 2) {
            cb(sequence);
            cb(sequence[1] + sequence[0]);
        } else if (sequence.length > 2) {
            for(var i = 0; i < sequence.length; i++) {
                (function(sequence, ch) {
                    variants(sequence, function(v) {
                        cb(ch + v);
                    });
                })(sequence.substring(0, i) + sequence.substring(i+1), sequence[i]);
            }
        } else {
            cb(sequence);
        }
    }