Hi,
I am lost in my script, and would need to basic help please.
I have got a file , separated by tabs, and the first column contain a chromosome number, then several other column with different infos. Basically I am trying to created a script that would take a file(see example), parse line by line, and when the first column start by any of the chromosomes I don't want (6,8,14,16,18,Y), go the next line, and if it doesn't start by the bad chromosomes , print all the line to a new output file.
the script below, just reprint the same original file :(
thanks for any clues
Nat



#!/software/bin/perl
use warnings;
use strict;
open(IN, "<example.txt") or die( $! );
open(OUT, ">>removed.txt") or die( $! );
my @bad_chromosome=(6,8,14,16,18,Y);
while(<IN>){
   chomp;
   my @column=split /\t/;
       foreach my $chr_no(@bad_chromosome){
           if ($column[0]==$chr_no){
           next;
           }
           }
print OUT $column[0],"\t",$column[1],"\t",$column[2],"/",$column[3],"\t",$column[4],"\t",$column[5],"\t",$column[6],"\t",$column[7],"\t",$column[8],"\t",$column[9],"\t",$column[10],"\t",$column[11],"\t",$column[12],"\t",$column[13],"\t",$column[14],"\n";
           }
close IN; close OUT;


--
The Wellcome Trust Sanger Institute is operated by Genome Research Limited, a charity registered in England with number 1021457 and a company registered in England with number 2742969, whose registered office is 215 Euston Road, London, NW1 2BE.
--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to