annotate selectproteinids.pl @ 1:f3fa21cda5f5 draft default tip

planemo upload commit 13e72e84c523bda22bda792bbebf4720d28542d5-dirty
author labis-app
date Fri, 10 Aug 2018 15:45:44 -0400
parents ba070efb6f78
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
ba070efb6f78 planemo upload commit 13e72e84c523bda22bda792bbebf4720d28542d5-dirty
labis-app
parents:
diff changeset
1 #!/usr/bin/perl -w
ba070efb6f78 planemo upload commit 13e72e84c523bda22bda792bbebf4720d28542d5-dirty
labis-app
parents:
diff changeset
2
ba070efb6f78 planemo upload commit 13e72e84c523bda22bda792bbebf4720d28542d5-dirty
labis-app
parents:
diff changeset
3 use strict;
ba070efb6f78 planemo upload commit 13e72e84c523bda22bda792bbebf4720d28542d5-dirty
labis-app
parents:
diff changeset
4 use warnings;
ba070efb6f78 planemo upload commit 13e72e84c523bda22bda792bbebf4720d28542d5-dirty
labis-app
parents:
diff changeset
5 use FileHandle;
ba070efb6f78 planemo upload commit 13e72e84c523bda22bda792bbebf4720d28542d5-dirty
labis-app
parents:
diff changeset
6
ba070efb6f78 planemo upload commit 13e72e84c523bda22bda792bbebf4720d28542d5-dirty
labis-app
parents:
diff changeset
7
ba070efb6f78 planemo upload commit 13e72e84c523bda22bda792bbebf4720d28542d5-dirty
labis-app
parents:
diff changeset
8 # open file with the ids and get the lines #
ba070efb6f78 planemo upload commit 13e72e84c523bda22bda792bbebf4720d28542d5-dirty
labis-app
parents:
diff changeset
9 my $in = $ARGV[0];
ba070efb6f78 planemo upload commit 13e72e84c523bda22bda792bbebf4720d28542d5-dirty
labis-app
parents:
diff changeset
10 open INFILE, "<", $in or die $!;
ba070efb6f78 planemo upload commit 13e72e84c523bda22bda792bbebf4720d28542d5-dirty
labis-app
parents:
diff changeset
11 seek(INFILE, 0, 0);
ba070efb6f78 planemo upload commit 13e72e84c523bda22bda792bbebf4720d28542d5-dirty
labis-app
parents:
diff changeset
12
ba070efb6f78 planemo upload commit 13e72e84c523bda22bda792bbebf4720d28542d5-dirty
labis-app
parents:
diff changeset
13 my @lines = <INFILE>;
ba070efb6f78 planemo upload commit 13e72e84c523bda22bda792bbebf4720d28542d5-dirty
labis-app
parents:
diff changeset
14 shift @lines;
ba070efb6f78 planemo upload commit 13e72e84c523bda22bda792bbebf4720d28542d5-dirty
labis-app
parents:
diff changeset
15
ba070efb6f78 planemo upload commit 13e72e84c523bda22bda792bbebf4720d28542d5-dirty
labis-app
parents:
diff changeset
16 # flag to see wheter maintain contaminants or not
ba070efb6f78 planemo upload commit 13e72e84c523bda22bda792bbebf4720d28542d5-dirty
labis-app
parents:
diff changeset
17 my $maintain_contaminants = $ARGV[1];
ba070efb6f78 planemo upload commit 13e72e84c523bda22bda792bbebf4720d28542d5-dirty
labis-app
parents:
diff changeset
18
ba070efb6f78 planemo upload commit 13e72e84c523bda22bda792bbebf4720d28542d5-dirty
labis-app
parents:
diff changeset
19 # output file with table filtered
ba070efb6f78 planemo upload commit 13e72e84c523bda22bda792bbebf4720d28542d5-dirty
labis-app
parents:
diff changeset
20 my $out = $ARGV[2];
ba070efb6f78 planemo upload commit 13e72e84c523bda22bda792bbebf4720d28542d5-dirty
labis-app
parents:
diff changeset
21 open OUTFILE, ">", $out or die $!;
ba070efb6f78 planemo upload commit 13e72e84c523bda22bda792bbebf4720d28542d5-dirty
labis-app
parents:
diff changeset
22
ba070efb6f78 planemo upload commit 13e72e84c523bda22bda792bbebf4720d28542d5-dirty
labis-app
parents:
diff changeset
23 # select first id of first column
ba070efb6f78 planemo upload commit 13e72e84c523bda22bda792bbebf4720d28542d5-dirty
labis-app
parents:
diff changeset
24 foreach(@lines){
ba070efb6f78 planemo upload commit 13e72e84c523bda22bda792bbebf4720d28542d5-dirty
labis-app
parents:
diff changeset
25 my @vec = split ' ', $_;
ba070efb6f78 planemo upload commit 13e72e84c523bda22bda792bbebf4720d28542d5-dirty
labis-app
parents:
diff changeset
26 my @id = split ';', $vec[0];
ba070efb6f78 planemo upload commit 13e72e84c523bda22bda792bbebf4720d28542d5-dirty
labis-app
parents:
diff changeset
27 if($id[0] =~ m/^CON__/ ){
ba070efb6f78 planemo upload commit 13e72e84c523bda22bda792bbebf4720d28542d5-dirty
labis-app
parents:
diff changeset
28 if($maintain_contaminants eq "yes"){
ba070efb6f78 planemo upload commit 13e72e84c523bda22bda792bbebf4720d28542d5-dirty
labis-app
parents:
diff changeset
29 print OUTFILE $id[0] =~ s/^CON__//r, "\n";
ba070efb6f78 planemo upload commit 13e72e84c523bda22bda792bbebf4720d28542d5-dirty
labis-app
parents:
diff changeset
30 }
ba070efb6f78 planemo upload commit 13e72e84c523bda22bda792bbebf4720d28542d5-dirty
labis-app
parents:
diff changeset
31 } else{
ba070efb6f78 planemo upload commit 13e72e84c523bda22bda792bbebf4720d28542d5-dirty
labis-app
parents:
diff changeset
32 print OUTFILE $id[0], "\n";
ba070efb6f78 planemo upload commit 13e72e84c523bda22bda792bbebf4720d28542d5-dirty
labis-app
parents:
diff changeset
33 }
ba070efb6f78 planemo upload commit 13e72e84c523bda22bda792bbebf4720d28542d5-dirty
labis-app
parents:
diff changeset
34 }
ba070efb6f78 planemo upload commit 13e72e84c523bda22bda792bbebf4720d28542d5-dirty
labis-app
parents:
diff changeset
35
ba070efb6f78 planemo upload commit 13e72e84c523bda22bda792bbebf4720d28542d5-dirty
labis-app
parents:
diff changeset
36 close INFILE;
ba070efb6f78 planemo upload commit 13e72e84c523bda22bda792bbebf4720d28542d5-dirty
labis-app
parents:
diff changeset
37 close OUTFILE;
ba070efb6f78 planemo upload commit 13e72e84c523bda22bda792bbebf4720d28542d5-dirty
labis-app
parents:
diff changeset
38