in reply to Creating a column of frequency for the unique entries of another column
I'm sure that there is still stuff wrong with this code. Can you show one input file (a few lines) and the expected output of your program?#!usr/bin/perl -w use strict; my @input_files=<*.seq>; my $sequence='ABCD'; my @headings=('Tags', 'Frequency'); my $headings=join("\t",@headings); #"Tags\nFrequency" foreach my $input_file(@input_files) { open(INPUT, '<', $input_file) or die "Cannot open file: $!\n"; my $outfile=$input_file; $outfile =~ s/.seq/.tag.txt/i; #/g makes no sense open (OUTPUT, '>', $outfile") or die "Cannot open file $!\n"; print OUTPUT "\n$headings\n"; while (my $line=<INPUT>) { if ($line=~m/$sequence(.{11})(.{11})$sequence/o) { print OUTPUT "$1\n$2\n"; } } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Creating a column of frequency for the unique entries of another column
by bluray (Sexton) on Oct 29, 2011 at 16:50 UTC | |
by aaron_baugher (Curate) on Oct 29, 2011 at 17:24 UTC |