-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathparse_16S_from_gbk.pl
More file actions
47 lines (35 loc) · 1.03 KB
/
parse_16S_from_gbk.pl
File metadata and controls
47 lines (35 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/usr/bin/perl
use strict;
use warnings;
use Bio::SeqIO;
foreach(@ARGV) {
my @splitargv = split(/,/, $_);
# save split[0] and put this in as header. remove the .gb !!
my $MainRefID = $splitargv[0];
chomp $MainRefID;
chop $MainRefID;
chop $MainRefID;
chop $MainRefID;
for (my $i=0; $i<scalar(@splitargv); $i++) {
my $seqin = Bio::SeqIO->new( -format => 'genbank', -file => $splitargv[$i]);
while( (my $seq = $seqin->next_seq()) ) {
foreach my $sf ( $seq->get_SeqFeatures() ) {
if( $sf->primary_tag eq 'rRNA' ) {
my $product = "";
if ($sf->has_tag("product")) {
my @productlist = $sf->get_tag_values("product");
$product = $productlist[0];
}
my $id = $seq->display_id;
if ($product =~ m/16S/i or $product =~ m/Small subunit ribosomal RNA/i) {
print ">$MainRefID\n";
print $sf->spliced_seq->seq, "\n";
$i = 10000;
last;
}
}
}
if ($i == 10000) { last; }
}
}
}