Пример #1
0
     // het (ref A -> C/G)
     $taf = NULL;
 }
 if ($gene && $aa_change) {
     $variant_name = "{$gene} {$aa_change}";
 } else {
     if ($rsid) {
         $variant_name = $rsid;
     } else {
         continue;
     }
 }
 $variant_id = evidence_get_variant_id($variant_name);
 if (!$variant_id) {
     // create the variant, and an "initial edit/add" row in edits table
     $variant_id = evidence_get_variant_id($variant_name, false, false, false, true);
     $edit_id = evidence_get_latest_edit($variant_id, 0, 0, 0, true);
 }
 if (ereg("^(rs?)([0-9]+)\$", $rsid, $regs)) {
     $rsid = $regs[2];
 } else {
     $rsid = null;
 }
 if (isset($job2genome[$job_id])) {
     $genome_id = $job2genome[$job_id];
 } else {
     $genome_id = evidence_get_genome_id($global_human_id);
 }
 theDb()->query("INSERT INTO import_genomes_tmp SET variant_id=?, genome_id=?, chr=?, chr_pos=?, trait_allele=?, taf=?, rsid=?, dataset_id=?, zygosity='{$zygosity[$hom_or_het]}'", array($variant_id, $genome_id, $chr, $chr_pos, $trait_allele, $taf, $rsid, "T/snp/{$job_id}"));
 if (!isset($job2genome[$job_id])) {
     theDb()->query("UPDATE genomes SET name=? WHERE genome_id=?", array($human_name, $genome_id));
Пример #2
0
$n = 0;
$n_marked_pharma = 0;
$did = array();
while ($row =& $q->fetchRow()) {
    // create the variant, and an "initial edit/add" row in edits table
    $gene_aa = $row["gene_aa"];
    if (eregi('([a-z0-9]+):([0-9]+) ?([a-z][a-z][a-z])>([a-z][a-z][a-z])', $gene_aa, $r)) {
        $gene_aa = "{$r['1']} {$r['3']}{$r['2']}{$r['4']}";
    } else {
        if (eregi('([a-z0-9]+):([a-z]+)([0-9]+)([a-z]+)', $gene_aa, $r)) {
            $gene_aa = "{$r['1']} {$r['2']}{$r['3']}{$r['4']}";
        }
    }
    $variant_id = evidence_get_variant_id($gene_aa, false, false, false, true);
    if (!$variant_id && $row["rsid"]) {
        $variant_id = evidence_get_variant_id("rs" . $row["rsid"], false, false, false, true);
    }
    $edit_id = evidence_get_latest_edit($variant_id, 0, 0, 0, true, array("variant_impact" => "pharmacogenetic"));
    $latestrow = evidence_get_edit($edit_id);
    if (in_array($latestrow["variant_impact"], array("not reviewed", "none", "unknown"))) {
        $newrow = evidence_generate_edit(null, null, $latestrow);
        $newrow["variant_impact"] = "pharmacogenetic";
        $new_edit_id = evidence_save_draft(null, $newrow);
        evidence_submit($new_edit_id);
        ++$n_marked_pharma;
    }
    if (ereg('^[0-9]+$', $row["pmid"])) {
        evidence_get_latest_edit($variant_id, $row["pmid"], 0, 0, true);
    }
    $did[$variant_name] = $variant_id;
    theDb()->query("UPDATE pharmgkb SET variant_id=? WHERE pharmgkb_id=?", array($variant_id, $row["pharmgkb_id"]));
Пример #3
0
if (ereg("^[0-9]+\$", $_GET["q"])) {
    $variant_id = $_GET["q"];
} else {
    if (ereg("^(rs[0-9]+)(;([0-9]+))?\$", $_GET["q"], $regs)) {
        $variant_id = evidence_get_variant_id($regs[1]);
        $variant_name = evidence_get_variant_name($variant_id, "-", true);
        if ($regs[1] != $variant_name) {
            header("Location: {$variant_name}");
            exit;
        }
        $max_edit_id = $regs[3];
    } else {
        if (ereg("^([A-Za-z0-9_-]+)[- \t\n]+([A-Za-z]+[0-9]+[A-Za-z\\*]+)(;([0-9]+))?\$", $_GET["q"], $regs) && aa_sane($aa = $regs[2])) {
            $gene = strtoupper($regs[1]);
            $max_edit_id = $regs[4];
            $variant_id = evidence_get_variant_id($variant_name = "{$gene} {$aa}");
        }
    }
}
if (!$variant_id && $aa) {
    $aa_long = aa_long_form($aa);
    $aa_short = aa_short_form($aa_long);
    header("HTTP/1.1 404 Not found");
    $gOut["title"] = "{$gene} {$aa_short}";
    $gOut["content"] = <<<EOF
<H1>{$gene} {$aa_short}</H1>

<P>({$gene} {$aa_long})</P>

<P>There is no GET-Evidence entry for this variant.</P>
Пример #4
0
<?php

include "lib/setup.php";
include "lib/openid.php";
evidence_create_tables();
openid_create_tables();
if ($_REQUEST["test-insert"]) {
    if (!getCurrentUser("is_admin")) {
        die("yours is not an admin account.");
    }
    header("Content-type: text/plain");
    $variant_id = evidence_get_variant_id("NPHP4", 848, "Arg", "Trp", true);
    $e = evidence_edit_id_generate(null, $variant_id);
    evidence_save_draft($e, array("variant_impact" => "unknown", "variant_dominance" => "unknown", "summary_short" => "This variant has been found together with R682X as a compound heterozygote in three nephronophthisis and retinitis pigmentosa, (Senior-Loken syndrome) patients from one family."));
    print "after evidence_save_draft\n";
    print_r(theDb()->getRow("SELECT * FROM edits WHERE edit_id=?", array($e)));
    evidence_submit($e);
    print "after evidence_submit\n";
    print_r(evidence_get_report("latest", $variant_id));
    evidence_signoff($e);
    $a = evidence_edit_id_generate(null, $variant_id);
    evidence_save_draft($a, array("article_pmid" => 12205563, "summary_short" => "Otto, E. et al. A gene mutated in nephronophthisis and retinitis pigmentosa encodes a novel protein, nephroretinin, conserved in evolution. Am J Hum Genet 71, 1161-1167, doi:S0002-9297(07)60408-X [pii]"));
    evidence_submit($a);
    evidence_signoff($a);
    $a = evidence_edit_id_generate(null, $variant_id);
    evidence_save_draft($a, array("article_pmid" => 9734597, "summary_short" => "Lemmink, H. H. et al. Novel mutations in the thiazide-sensitive NaCl cotransporter gene in patients with Gitelman syndrome with predominant localization to the C-terminal domain. Kidney Int 54, 720-730, doi:10.1046/j.1523-1755.1998.00070.x (1998)."));
    evidence_submit($a);
    print "release:\n";
    print_r(evidence_get_report("release", $variant_id));
    print "latest:\n";
    print_r(evidence_get_report("latest", $variant_id));
Пример #5
0
}
print theDb()->affectedRows();
print "\n";
print "Looking up gene,aa -> variant_id...";
theDb()->query("ALTER TABLE counsyl_a ADD variant_id BIGINT UNSIGNED, ADD INDEX(variant_id)");
$q = theDb()->query("UPDATE counsyl_a c\n LEFT JOIN variants v\n  ON v.variant_gene=c.gene\n  AND v.variant_aa_from=c.aa_from\n  AND v.variant_aa_pos=c.aa_pos\n  AND v.variant_aa_to=c.aa_to\n set c.variant_id=v.variant_id");
print theDb()->affectedRows();
print "\n";
print "Adding new variants...";
theDb()->query("ALTER TABLE counsyl_a ADD rownumber SERIAL");
$q = theDb()->query("SELECT DISTINCT * FROM counsyl_a WHERE variant_id IS NULL");
$added = 0;
while ($row = $q->fetchRow()) {
    ++$added;
    if ($added % 10 == 0) {
        print "{$added}...";
    }
    $variant_id = evidence_get_variant_id($row["gene"], $row["aa_pos"], $row["aa_from"], $row["aa_to"], true);
    theDb()->query("UPDATE counsyl_a SET variant_id=? WHERE rownumber=?", array($variant_id, $row["rownumber"]));
    $edit_id = evidence_get_latest_edit($variant_id, 0, 0, 0, true);
}
print $added;
print "\n";
print "Creating counsyl_autoscore table...";
$q = theDb()->query("DROP TABLE IF EXISTS counsyl_autoscore");
$q = theDb()->query("CREATE TABLE counsyl_autoscore AS\n SELECT gene, aa_from, aa_pos, aa_to, counsyl_a.variant_id, IF(0<LOCATE('\"autoscore\":',flat_summary),substr(flat_summary,locate('\"autoscore\":',flat_summary)+12,1),NULL) autoscore\n FROM counsyl_a\n LEFT JOIN flat_summary ON counsyl_a.variant_id=flat_summary.variant_id");
if (theDb()->isError($q)) {
    print $q->userinfo;
}
print theDb()->affectedRows();
print "\n";
Пример #6
0
 if (ereg("^[0-9]+\$", $_POST["disease_id"], $regs)) {
     $disease_id = $regs[0];
 } else {
     $disease_id = 0;
 }
 if (ereg("^[0-9]+\$", $_POST["variant_id"], $regs)) {
     $variant_id = $regs[0];
 } else {
     if (aa_sane($_POST["variant_aa_change"])) {
         if (ereg("^([^0-9]+)([0-9]+)([^0-9]+)\$", aa_long_form($_POST["variant_aa_change"]), $regs)) {
             $aa_from = $regs[1];
             $aa_pos = $regs[2];
             $aa_to = $regs[3];
         }
         $gene = strtoupper($_POST["variant_gene"]);
         $variant_id = evidence_get_variant_id($gene, $aa_pos, $aa_from, $aa_to, true);
         $edit_id = evidence_get_latest_edit($variant_id, 0, 0, 0, true);
         $response["latest_edit_v{$variant_id}a0g0"] = $edit_id;
         $response["latest_edit_id"] = $edit_id;
         $response["variant_id"] = $variant_id;
         $response["please_reload"] = true;
         $response["variant_key"] = "{$gene} " . aa_short_form("{$aa_from}{$aa_pos}{$aa_to}");
     } else {
         die("Invalid variant specified");
     }
 }
 if ($article_pmid || $genome_id || $disease_id) {
     $latest_edit_id = evidence_get_latest_edit($variant_id, $article_pmid, $genome_id, $disease_id, true);
     $response["latest_edit_v{$variant_id}a{$article_pmid}g{$genome_id}"] = $latest_edit_id;
     $response["latest_edit_id"] = $latest_edit_id;
     $renderer = new evidence_row_renderer();
Пример #7
0
print theDb()->affectedRows();
print "\n";
print "Looking up variant ids...";
theDb()->query($update_variant_id_sql = "\nUPDATE omim_a, variants\nSET omim_a.variant_id=variants.variant_id\nWHERE variants.variant_gene = omim_a.gene\n AND variants.variant_aa_from = omim_a.aa_from\n AND variants.variant_aa_to = omim_a.aa_to\n AND variants.variant_aa_pos = omim_a.codon\n");
print theDb()->affectedRows();
print "\n";
print "Adding variants...";
$q = theDb()->query("\nSELECT concat(gene,' ',aa_from,codon,aa_to) AS gene_aa_change\nFROM omim_a\nWHERE variant_id IS NULL\nGROUP BY gene,aa_from,codon,aa_to");
$n = 0;
$did = array();
while ($row =& $q->fetchRow()) {
    if (isset($did[$row["gene_aa_change"]])) {
        continue;
    }
    // create the variant, and an "initial edit/add" row in edits table
    $variant_id = evidence_get_variant_id($row["gene_aa_change"], false, false, false, true);
    $edit_id = evidence_get_latest_edit($variant_id, 0, 0, 0, true);
    $did[$row["gene_aa_change"]] = 1;
    ++$n;
    if ($n % 100 == 0) {
        print "{$n}...";
    }
}
print "{$n}\n";
print "Looking up variant ids again...";
theDb()->query($update_variant_id_sql);
print theDb()->affectedRows();
print "\n";
print "Editing \"unknown\" variants to \"likely pathogenic\"...";
$timestamp = theDb()->getOne("SELECT NOW()");
$q = theDb()->query("INSERT INTO edits\n\t(variant_id, genome_id, article_pmid, is_draft,\n\t previous_edit_id, variant_dominance, variant_impact,\n\t summary_short, summary_long,\n\t edit_oid, edit_timestamp)\n\tSELECT DISTINCT s.variant_id, 0, 0, 0,\n\t edit_id, variant_dominance, ?,\n\t summary_short, summary_long,\n\t ?, ?\n\tFROM omim_a\n\tLEFT JOIN snap_latest s ON omim_a.variant_id=s.variant_id AND s.article_pmid=0 AND s.genome_id=0\n\tWHERE s.variant_impact='none'", array('likely pathogenic', getCurrentUser("oid"), $timestamp));