7dea7c645f8ce8892d6d4d162a3cf8295309062f chmalee Fri Dec 11 11:22:24 2020 -0800 Bringing repo copies of omim scripts up to date with the working versions, refs #18151 diff --git src/hg/utils/otto/omim/buildOmimTracks.sh src/hg/utils/otto/omim/buildOmimTracks.sh index 279d764..a6a952e 100755 --- src/hg/utils/otto/omim/buildOmimTracks.sh +++ src/hg/utils/otto/omim/buildOmimTracks.sh @@ -80,53 +80,50 @@ # If gene symbol (3rd field) is blank, replace it with "-". # Reorganize fields - field 2 moved to the line end; fields 1 and 4 are each # followed by fields with their contents split up. grep -v '^#' ../allelicVariants.txt | tawk \ '$3 == "" {$3 = "-"}; \ {$(NF+1)=$2; $2=$1; sub(/\./, OFS, $2); \ repl=$4; if (sub(/,/, OFS, repl) == 0) repl=repl OFS repl; $4=$4 OFS repl; \ print $0}' > omimAv.tab hgLoadSqlTab -verbose=0 -warn $db omimAvNew $SQLDIR/omimAv.sql omimAv.tab # Remove whitespace; really this should probably be done with the initial processing, # but this works. hgsql $db -e 'update omimAvNew set repl2 = rtrim(ltrim(repl2))' +tawk '{print $1, $8}' omimAv.tab | perl -ne 'chomp; m/^(\S+)/; $avId = $1; while (m/(rs\d+)(,|$)/g) {print "$avId\t$1\n"}' > omimAvLinkTmp.tab if [ "$db" == "hg18" ] then -# hgsql $db -N -e 'select chrom, chromStart, chromEnd, avId from omimAvReplNew r, snp130 s where s.name = dbSnpId order by avId' |sort -u > omimAvSnp.tab snpTbl="snp130"; + hgsql $db -Ne 'drop table if exists omimAvLinkTmp' + hgsql $db -Ne 'create table omimAvLinkTmp (avId text not null, dbSnpId text not null, index(dbSnpId(10)))' + hgsql $db -Ne 'load data local infile "omimAvLinkTmp.tab" into table omimAvLinkTmp' + hgsql $db -N -e "select chrom, chromStart, chromEnd, avId from omimAvLinkTmp l, $snpTbl s where s.name = l.dbSnpId" | bedSort stdin omimAvSnp.tab + hgsql $db -Ne 'drop table omimAvLinkTmp' elif [ "$db" == "hg19" ] then -# hgsql $db -N -e 'select chrom, chromStart, chromEnd, avId from omimAvReplNew r, snp151 s where s.name = dbSnpId order by avId' |sort -u > omimAvSnp.tab - snpTbl="snp151"; + sort -k2 omimAvLinkTmp.tab | join -t$'\t' -1 4 -2 2 ../../../hg19.dbSnp153.bed4 - | cut -f2- > omimAvSnp.tab elif [ "$db" == "hg38" ] then -# hgsql $db -N -e 'select chrom, chromStart, chromEnd, avId from omimAvReplNew r, snp151 s where s.name = dbSnpId order by avId' |sort -u > omimAvSnp.tab - snpTbl="snp151"; + sort -k2 omimAvLinkTmp.tab | join -t$'\t' -1 4 -2 2 ../../../hg38.dbSnp153.bed4 - | cut -f2- > omimAvSnp.tab else echo "Error in buildOmimTracks.csh: unable to construct omimAvSnp for $db. Do not know which SNP table to use." exit 255; fi -tawk '{print $1, $8}' omimAv.tab | perl -ne 'chomp; m/^(\S+)/; $avId = $1; while (m/(rs\d+)(,|$)/g) {print "$avId\t$1\n"}' > omimAvLinkTmp.tab -hgsql $db -Ne 'drop table if exists omimAvLinkTmp' -hgsql $db -Ne 'create table omimAvLinkTmp (avId text not null, dbSnpId text not null, index(dbSnpId(10)))' -hgsql $db -Ne 'load data local infile "omimAvLinkTmp.tab" into table omimAvLinkTmp' -hgsql $db -N -e "select chrom, chromStart, chromEnd, avId from omimAvLinkTmp l, $snpTbl s where s.name = l.dbSnpId" | bedSort stdin omimAvSnp.tab -hgsql $db -Ne 'drop table omimAvLinkTmp' hgLoadBed -verbose=0 -allowStartEqualEnd $db omimAvSnpNew omimAvSnp.tab cd .. ############################################################## # note: doOmimLocation depends on omimGeneMap and omimGene2 and omimPhenotype echo building omimLocation ... mkdir -p location cd location # the new genemap2 file contains cytoband locations that don't exist in hg18, # generally something like p32.33 in genemap2 where hg18 has p32.3, not too serious # but keep the errors just in case ../../../doOmimLocation $db omimLocation.bed 2>omimLocation.errors