changeset 4:53eff7c08ad3 draft

Uploaded
author mcharles
date Mon, 16 Jun 2014 06:15:32 -0400
parents e29e077a1674
children 26d2c851d48e
files filtersamunique/filtersamunique.pl filtersamunique/filtersamunique.xml listfiltering/listfiltering.pl listfiltering/listfiltering.xml
diffstat 4 files changed, 81 insertions(+), 38 deletions(-) [+]
line wrap: on
line diff
--- a/filtersamunique/filtersamunique.pl	Mon Jun 16 06:11:29 2014 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,20 +0,0 @@
-#!/usr/bin/perl
-use strict;
-use warnings;
-
-open(IN, $ARGV[0]) or die ("Can't open $ARGV[0]\n");
-while (my $line=<IN>){
-	if ($line =~ /^\@/){
-		#Header conservation
-		print $line;
-	}
-	else {
-		#Optionnal flag verification
-		if (($line =~ /XT\:A\:U/)&&($line =~ /X0\:i\:1/)&&($line =~ /X1\:i\:0\s/)){
-			print $line;
-		}
-	}
-}
-
-
-close (IN);
\ No newline at end of file
--- a/filtersamunique/filtersamunique.xml	Mon Jun 16 06:11:29 2014 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,18 +0,0 @@
-<tool id="filtersamunique" name="filtersamunique" version="0.01">
-<description>Filter SAM file for uniquelly match reads</description>
-<command interpreter="perl">
-    filtersamunique.pl $input_sam_file > $output_file 
-</command>
-<inputs>
-<param name="input_sam_file"  type="data" format="sam" label="Select a suitable input SAM file from your history"/>
-</inputs>
-<outputs>
- <data name="output_file" format="sam" label="${tool.name} on ${on_string}"/>
-</outputs>
-
-<help>
-
-
-
-</help>
-</tool>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/listfiltering/listfiltering.pl	Mon Jun 16 06:15:32 2014 -0400
@@ -0,0 +1,61 @@
+#!/usr/bin/perl
+use strict;
+use Getopt::Long;
+
+my $inputfile;
+my $headerfile;
+my $nb_col=1;
+my %header;
+
+if ($#ARGV<0){
+	print "\n";
+	print "perl 021_ListFiltering.pl -input_file <file> -header_file <file> -nb_col <integer>[1]\n";
+	exit(0);
+}
+
+GetOptions (
+"input_file=s" => \$inputfile,
+"header_file=s" => \$headerfile,
+"nb_col=i" => \$nb_col
+) or die("Error in command line arguments\n");
+
+open(HF, $headerfile)  or die("Can't open $headerfile\n");
+while (my $line=<HF>){
+	chomp($line);
+	my @fields = split(/\s+/,$line);
+	my $ref="";
+	my $compt=0;
+	while ($compt<$nb_col){
+		if ($ref){$ref.="\t";}
+		$ref.=$fields[$compt];
+		$compt++;
+	}
+	# my $ref = "$fields[0]\t$fields[1]";
+	$header{$ref}=$line;
+}
+close (HF);
+
+
+open(IF, $inputfile)  or die("Can't open $inputfile\n");
+while (my $line=<IF>){
+	my @fields = split(/\s+/,$line);
+	my $ref="";
+	my $compt=0;
+	while ($compt<$nb_col){
+		if ($ref){$ref.="\t";}
+		$ref.=$fields[$compt];
+		$compt++;
+	}
+	# my $ref = "$fields[0]\t$fields[1]";
+
+	if ($header{$ref}){
+		# print $line;
+		# print $header{$ref},"\n";
+	}
+	else {
+		print $line;
+	}
+	
+}
+close(IF);
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/listfiltering/listfiltering.xml	Mon Jun 16 06:15:32 2014 -0400
@@ -0,0 +1,20 @@
+<tool id="listfiltering" name="listfiltering" version="0.01">
+<description>Compare listA and listB first X column and remove from listA the elements present in listB</description>
+<command interpreter="perl">
+    listfiltering.pl -input_file $input_listA -header_file $input_listB -nb_col $nb_col > $output_file 
+</command>
+<inputs>
+<param name="input_listA"  type="data" format="pileup" label="Select a suitable input file from your history"/>
+<param name="input_listB"  type="data" format="txt" label="Select a suitable input file from your history"/>
+<param name="nb_col" type="integer" value="2" label="Number of column to compare"/>
+</inputs>
+<outputs>
+ <data name="output_file" format="pileup" label="${tool.name} on ${on_string}"/>
+</outputs>
+
+<help>
+
+
+
+</help>
+</tool>