diff selectproteinids.pl @ 0:ba070efb6f78 draft

planemo upload commit 13e72e84c523bda22bda792bbebf4720d28542d5-dirty
author labis-app
date Tue, 03 Jul 2018 17:34:13 -0400
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/selectproteinids.pl	Tue Jul 03 17:34:13 2018 -0400
@@ -0,0 +1,38 @@
+#!/usr/bin/perl -w
+
+use strict;
+use warnings;
+use FileHandle;
+
+
+# open file with the ids and get the lines #
+my $in = $ARGV[0];
+open INFILE, "<", $in or die $!;
+seek(INFILE, 0, 0);
+
+my @lines = <INFILE>;
+shift @lines;
+
+# flag to see wheter maintain contaminants or not
+my $maintain_contaminants = $ARGV[1];
+
+# output file with table filtered
+my $out = $ARGV[2];
+open OUTFILE, ">", $out or die $!;
+
+# select first id of first column
+foreach(@lines){
+    my @vec = split ' ', $_;
+    my @id = split ';', $vec[0];
+    if($id[0] =~ m/^CON__/ ){
+	if($maintain_contaminants eq "yes"){
+	    print OUTFILE $id[0] =~ s/^CON__//r, "\n";
+	}
+    } else{
+	print OUTFILE $id[0], "\n";
+    }
+}
+
+close INFILE;
+close OUTFILE;
+