Hello all,
I have got a file that has the informations like this is in a tab delimited form.
Chromosom_id fstart fstop Count
1 105 1 14.5
1 105 1 14.5
1 105 1 14.5
1 813 797 4
I would like to get the fstart and fstop and use them in the further processes.
I try to get those by two different types of scripts.
the first one is some thing like this::
while(<>){
chomp();
next if /^\s*$/;
next if /^(Chromosom_id.+)$/;
my ($cid, $fstart, $fstop, $count) = split/\t/;
print $fstart,"\n";
}
I cant get individula columns. As in the code if I tried to print $cid it prints everything.
like this1 105 1 14.5
1 105 1 14.5
1 105 1 14.5
1 813 797 4
1 813 797 22
1 813 797 4where as if I tried to print $fstart I get
Use of uninitialized value in print at gbrowse_cluster_col.pl line 12, <> line 2.
Use of uninitialized value in print at gbrowse_cluster_col.pl line 12, <> line 3.
Use of uninitialized value in print at gbrowse_cluster_col.pl line 12, <> line 4.
Also I tried replacing the split with tab by split/\s+/
it returns everthing as a single line like this:1105114.5
1105114.5
1105114.5
18137974
Then in the case of the other code
open (FILE ,"$file") or die "Cannot open the file\n";
my @hit_clusters = <FILE>;
foreach my $file_line(@hit_clusters){
next if $file_line =~m/^\s*$/;
next if $file_line =~m/^(Chromosom_id.+)$/;
print $file_line, "\n";
if ($file_line =~m/^(.+?)\t(\d+?)\t(\d+?)\t(\d+?)\b/){
my ($id, $fstart, $fstop, $count)= ($1,$2,$3,$4);
}
}
I could not access the variables in the if loop.
Whats wrong in these? Any help?
Thanks.