-
Notifications
You must be signed in to change notification settings - Fork 1
/
updateDoctype.pl
executable file
·56 lines (35 loc) · 1.17 KB
/
updateDoctype.pl
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
56
#!/usr/bin/perl
my $solrServer = $ENV{PATRIC_SOLR};
my $solrFormat="&wt=csv&csv.separator=%09&csv.mv.separator=;&rows=100000";
my $core = "/genome";
my $query = "/select?q=genome_id:*.*";
my $fields = "&fl=genome_id";
my $sort = "";
my $solrQuery = $solrServer.$core.$query.$fields.$sort.$solrFormat;
push @genomes, `wget -q -O - "$solrQuery"`;
foreach my $genome_id (@genomes){
chomp $genome_id;
next if $genome_id=~/genome_id/;
print "Processing genome_id: $genome_id\n";
my @features;
my $core = "/genome_feature";
my $query = "/select?q=genome_id:$genome_id";
my $fields = "&fl=feature_id";
my $sort = "";
my $solrQuery = $solrServer.$core.$query.$fields.$sort.$solrFormat;
push @features, `wget -q -O - "$solrQuery"`;
open OUT, ">$genome_id.json";
my $count = 0;
print OUT "[\n";
foreach my $feature_id (@features) {
chomp $feature_id;
next if $feature_id=~/feature_id/;
$count++;
print OUT ",\n" unless $count == 1;
print OUT "{\"feature_id\":\"$feature_id\",\"document_type\":{\"set\":\"genome_feature\"}}";
}
print OUT "]";
close OUT;
`time post.update.dayhoff.sh $core $genome_id.json`;
`rm $genome_id.json`;
}