in reply to How do i extract only contigs of interest
In your case, you have to change the identifiers, as the underscore in contig names is not present in the genbank:
#!/usr/bin/perl use warnings; use strict; my %contig; open my $CNTG, '<', 'contig_names' or die $!; while (<$CNTG>) { chomp; s/_//; # Remove the underscore, as it doesn't appear in the genba +nk. $contig{$_} = 1; } local $/ = '//'; # Read the file one record a time. open my $GB, '<', 'genbank' or die $!; while (<$GB>) { if (my ($id) = /LOCUS \s+ \S+ _ (contig [0-9]+)/x) { print if $contig{$id}; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: How do i extract only contigs of interest
by faozhi (Acolyte) on Sep 09, 2015 at 12:18 UTC |