in reply to Re^2: Counting matches
in thread Counting matches
Here is an SSCCE which matches your spec. Enjoy.
#!/usr/bin/env perl use strict; use warnings; use Test::More; my @hant = ('Gloin1'); my @counts = (2); plan tests => scalar @hant; my $nrt2 = <<EOT; >Gloin1_46659 MVKLFARPLPIDP.... >Gloin1_30454 MIKLFDKPSKELS.... EOT for my $pat (@hant) { my $matches = () = $nrt2 =~ /$pat/g; is ($matches, shift @counts, "Correct number of matches found for +$pat"); }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^4: Counting matches
by Nicpetbio23! (Acolyte) on May 29, 2017 at 16:00 UTC | |
| [reply] [d/l] [select] |
by hippo (Archbishop) on May 29, 2017 at 16:04 UTC | |
There is absolutely nothing preventing you from expanding the @hant and @counts arrays. Why do you suppose I set them up as arrays in the first place even though you had only given us one data point in your sample? | [reply] [d/l] [select] |
by Nicpetbio23! (Acolyte) on May 29, 2017 at 17:07 UTC | |
Ok, I tried this script and got the following error. "You said to perform 0 tests at Counter.pl line 13". What should I change? Sorry like I said I am new at writing perl scripts. My script might not make sense.lol | [reply] [d/l] |
by shmem (Chancellor) on May 29, 2017 at 17:19 UTC | |
by Nicpetbio23! (Acolyte) on May 29, 2017 at 17:45 UTC | |
| |
by poj (Abbot) on May 29, 2017 at 17:38 UTC | |
How big are the 2 files ? Try poj | [reply] [d/l] |
by Nicpetbio23! (Acolyte) on May 29, 2017 at 17:47 UTC | |
| [reply] |
by Nicpetbio23! (Acolyte) on May 29, 2017 at 18:20 UTC | |
| [reply] [d/l] |
by poj (Abbot) on May 29, 2017 at 18:49 UTC | |
by AnomalousMonk (Archbishop) on May 29, 2017 at 19:19 UTC | |
For those monks following along at home, please note that the sample NRT2.txt Fasta file given here has none of the genomes in the sample Genomes_used_hant.txt file! You'll have to roll your own sample data. Thank you, Nicpetbio23!. Give a man a fish: <%-{-{-{-< | [reply] [d/l] [select] |