-
Notifications
You must be signed in to change notification settings - Fork 0
/
eliminate_islands.pl
executable file
·49 lines (46 loc) · 1.13 KB
/
eliminate_islands.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
#! /usr/bin/perl -w
# script to eliminated micrographs completely where relion warns too few particles
# run in directory containine particles.star and run.out
# wjr 062617
#
my $logfile = 'run.err';
my $partfile = 'particles.star';
my $edited = 'particles_edited.star';
open (IN,$logfile) or die "cannot read $logfile\n";
while (<IN>) {
<<<<<<< Updated upstream
if ($_ =~ m/Warning: .*\s(.*\.mrc)\./) {
=======
if ($_ =~ m/Warning: .*\s+(.*\.mrc)\./) {
>>>>>>> Stashed changes
push @list,$1;
print "match $1\n";
}
}
close (IN);
open (IN,$partfile) or die "cannot open $partfile\n";
open (OUT,">$edited") or die "cannot write $edited\n";
while (<IN>) {
@data = split (" ",$_);
if ($#data<6) {
print OUT $_;
next;
}
else {
$skip=0;
foreach $bad (@list) {
if ($_ =~ m/$bad/) {
$skip=1;
$deleted++;
last;
}
}
unless ($skip) {
print OUT $_;
$saved++;
}
}
}
my $badmic = $#list+1;
print "\nNumber of micrographs to eliminate: $badmic\n";
print "Eliminated $deleted paticles, saved $saved in file $edited\n";