comparison selectproteinids.pl @ 0:ba070efb6f78 draft

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