forked from qfo/benchmark-webservice
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ComputeRelMapping.drw
55 lines (49 loc) · 2.02 KB
/
ComputeRelMapping.drw
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#
# this script receives resDBfn, relsinfn, seqmapfn, orgMap, lock, PID
#
WriteLock(lock,'initializing computation');
#ReadProgram('/local/BenchmarkService/lib/darwinit');
LogMessage := proc(msg)
OpenAppending(logFn);
prints(msg);
OpenAppending(previous);
end:
CallSystem('rm -f '.logFn);
LogMessage('*** Starting mapping of uploaded relations ***');
pKey := GetPKeyData(PID);
referenceDatSet := pKey['ref'];
mapping_data_filename := eval(symbol(lowercase(referenceDatSet).'DBpath')) . 'mapping.json.gz';
converter_script := cdir . '/map_relations.py';
rels_filename := trim(TimedCallSystem('ls -t '.relsinfn.'* | head -n 1')[2]);
cmd := ['python3', converter_script, '--log', logFn, '--out', resDBfn, mapping_data_filename, rels_filename];
cmd := ConcatStrings(cmd, ' ');
CallSystem(cmd);
WriteLock(lock, 'Storing final project data');
LogMessage('\n*** Storing data and update project summary information ***');
ReadDb(resDBfn):
relMapped := NM := 0; lst_gNr := -1; covered_genomes := []:
for i to DB[TotEntries] do
nr_vps := length(parse(SearchTag('VP', Entry(i)))):
if nr_vps > 0 then
NM := NM + 1;
relMapped := relMapped + nr_vps;
gNr := GenomeNrFromENr(i, referenceDatSet);
if gNr<>lst_gNr then
lst_gNr := gNr;
covered_genomes := append(covered_genomes, GenomeCodeFromENr(i, referenceDatSet));
fi:
fi:
od:
pKey['NSeqMap'] := NM; pKey['NOrthMap'] := relMapped;
orgs := {op(covered_genomes)}:
pKey['OrgsCovered'] := orgs:
UpdatePKeyDataPermanent(pKey);
missing_orthologs_for_genomes := minus({op(KnownSpecies(referenceDatSet))}, orgs);
if length(missing_orthologs_for_genomes) > 0 then
LogMessage(sprintf('Warning: no orthologs for these %d species have been uploaded:'.
'\n %a\n Missing genomes are treated as false negatives',
length(missing_orthologs_for_genomes), missing_orthologs_for_genomes));
fi:
LogMessage('\n*** Successfully finished project upload and integration ***');
CallSystem('rm -f '.lock);
done