Created
March 26, 2009 17:03
-
-
Save masak/86206 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Ok, say I want the target(s) involved with compound 5555. You can follow | |
along at home by getting the files compounds.n3 activities.n3 | |
assay2target.n3 target_dictionary.n3 from pele:/tmp/masak-can-haz-n3-files/. | |
Keep in mind that activities.n3 isn't complete. | |
$ grep -B4 MOLREGNO activities.n3 | grep -B4 'MOLREGNO "5555"' | |
<star:activities/207697> a staro:ACTIVITIES; | |
staro:ACTIVITY_ID "1038792"; | |
staro:ASSAY_ID "207697"; | |
staro:DOC_ID "15844"; | |
staro:MOLREGNO "5555"; | |
-- | |
<star:activities/204029> a staro:ACTIVITIES; | |
staro:ACTIVITY_ID "1038786"; | |
staro:ASSAY_ID "204029"; | |
staro:DOC_ID "15844"; | |
staro:MOLREGNO "5555"; | |
$ grep -A1 'staro:ASSAY_ID "207697";' assay2target.n3 | |
$ grep -A1 'staro:ASSAY_ID "204029";' assay2target.n3 | |
staro:ASSAY_ID "204029"; | |
staro:TID "50185"; | |
$ grep -B1 -A13 'staro:TID "50185";' target_dictionary.n3 | |
<star:target_dictionary/50185> a staro:TARGET_DICTIONARY; | |
staro:TID "50185"; | |
staro:TARGET_TYPE "ORGANISM"; | |
staro:DB_SOURCE ""; | |
staro:DESCRIPTION ""; | |
staro:GENE_NAMES ""; | |
staro:PREF_NAME "Staphylococcus aureus"; | |
staro:SYNONYMS ""; | |
staro:KEYWORDS ""; | |
staro:PROTEIN_MD5SUM ""; | |
staro:TAX_ID "1280"; | |
staro:IN_DRUGSTORE "0"; | |
staro:IN_STARLITE "1"; | |
staro:PROTEIN_ACCESSION ""; | |
staro:PROTEIN_SEQUENCE "". | |
I'll now turn this into a Perl script that does all this automatically. | |
Update: And here's that script: | |
$ ./find-targets 5555 | |
<star:target_dictionary/50185> a staro:TARGET_DICTIONARY; | |
staro:TID "50185"; | |
staro:TARGET_TYPE "ORGANISM"; | |
staro:DB_SOURCE ""; | |
staro:DESCRIPTION ""; | |
staro:GENE_NAMES ""; | |
staro:PREF_NAME "Staphylococcus aureus"; | |
staro:SYNONYMS ""; | |
staro:KEYWORDS ""; | |
staro:PROTEIN_MD5SUM ""; | |
staro:TAX_ID "1280"; | |
staro:IN_DRUGSTORE "0"; | |
staro:IN_STARLITE "1"; | |
staro:PROTEIN_ACCESSION ""; | |
staro:PROTEIN_SEQUENCE "". | |
$ cat find-targets | |
#!/usr/bin/perl -w | |
use strict; | |
die "Usage: find-targets <target-num>\n" | |
if @ARGV != 1; | |
my $molregno = shift @ARGV; | |
my $activities = `grep -B4 MOLREGNO activities.n3 | grep -B4 'MOLREGNO "$molregno"'`; | |
my @assay_ids; | |
while ($activities =~ /ASSAY_ID\s+"(\d+)"/g) { | |
push @assay_ids, $1; | |
} | |
my @targets; | |
for my $assay_id (@assay_ids) { | |
my $targets = `grep -A1 'ASSAY_ID "$assay_id"' assay2target.n3`; | |
while ($targets =~ /TID\s+"(\d+)"/g) { | |
push @targets, $1; | |
} | |
} | |
for my $target (@targets) { | |
system("grep -B1 -A13 'staro:TID \"$target\";' target_dictionary.n3"); | |
} | |
--- | |
My work here is done. Hope it can be of some use. Checking out for the day. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment