Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
add simple example scripts
- Loading branch information
Showing
4 changed files
with
51 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# Example FASTA parsing | ||
|
||
The three examples here parse a FASTA file in three ways: | ||
|
||
1. `fasta.pl6` - using bioperl6's implementation of Bio::SeqIO | ||
|
||
2. `grammar.pl6` - using bioperl6's low-level grammar | ||
|
||
3. `fasta-from-p5.pl` - using p5 Bio::SeqIO within Perl 6 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
use v6; | ||
|
||
# This is using p5 BioPerl Bio::SeqIO | ||
use Bio::SeqIO:from<Perl5>; | ||
|
||
my $file = @*ARGS.shift; | ||
|
||
# Note: left side needs quotes; keys are not automaically strings in p6 | ||
my $in = Bio::SeqIO.new('-format' => 'fasta', '-file' => $file); | ||
|
||
my $ct = 0; | ||
|
||
while $in.next_seq -> $record { | ||
$ct++; | ||
} | ||
|
||
say "Count: $ct"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
use v6; | ||
use Bio::SeqIO; | ||
|
||
my $file = @*ARGS.shift; | ||
my $in = Bio::SeqIO.new(:format<fasta>, :file($file)); | ||
|
||
my $ct = 0; | ||
|
||
while $in.next-Seq -> $record { | ||
$ct++; | ||
} | ||
|
||
say "Count: $ct"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
use v6; | ||
use Bio::Grammar::Fasta; | ||
|
||
my $file = @*ARGS.shift; | ||
my $data = Bio::Grammar::Fasta.parsefile($file); | ||
|
||
my $ct = 0; | ||
for $data<record> -> $record { | ||
$ct++; | ||
} | ||
|
||
say $ct; |