# HG changeset patch # User mcharles # Date 1402913732 14400 # Node ID 53eff7c08ad3a2bd8dc424e9d8b35b3b9bab015f # Parent e29e077a1674c557135b7744cc6ae647371c4e97 Uploaded diff -r e29e077a1674 -r 53eff7c08ad3 filtersamunique/filtersamunique.pl --- 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=){ - 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 diff -r e29e077a1674 -r 53eff7c08ad3 filtersamunique/filtersamunique.xml --- 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 @@ - -Filter SAM file for uniquelly match reads - - filtersamunique.pl $input_sam_file > $output_file - - - - - - - - - - - - - - diff -r e29e077a1674 -r 53eff7c08ad3 listfiltering/listfiltering.pl --- /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 -header_file -nb_col [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=){ + 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=){ + 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); + diff -r e29e077a1674 -r 53eff7c08ad3 listfiltering/listfiltering.xml --- /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 @@ + +Compare listA and listB first X column and remove from listA the elements present in listB + + listfiltering.pl -input_file $input_listA -header_file $input_listB -nb_col $nb_col > $output_file + + + + + + + + + + + + + + + +