This shows you the differences between two versions of the page.
Both sides previous revision Previous revision | |||
tech [2019/03/29 11:02] fplmarques [Extract features from NCBI/GenBank annotation] |
tech [2019/03/29 13:34] (current) fplmarques [Extract features from NCBI/GenBank annotation] |
||
---|---|---|---|
Line 108: | Line 108: | ||
<code>for file in *.gb ; do python extract_*.py ${file} ${file%.*}.fas ; done </code> | <code>for file in *.gb ; do python extract_*.py ${file} ${file%.*}.fas ; done </code> | ||
+ | This code extracts individual genomes from concatenated genomes in GenBank (*.gb) format. | ||
+ | <code perl | get_individual_genomes.pl> | ||
+ | #!/usr/bin/perl | ||
+ | # | ||
+ | # usage: | ||
+ | # perl get_individual_genomes.pl input_file.gb | ||
+ | # | ||
+ | # | ||
+ | $file = $ARGV[0]; | ||
+ | open (FILE, $file); | ||
+ | while (<FILE>) { | ||
+ | if ($_ =~ m/^LOCUS\s+(\w+).*/){ | ||
+ | $output_file = "$1\.gb"; | ||
+ | open($out, '>', $output_file); | ||
+ | print $out "$_"; | ||
+ | } | ||
+ | if (($_ =~ m/^[\w|\s|\d].*/) ne ($_ =~ m/^LOCUS.*/)){ | ||
+ | print $out "$_"; | ||
+ | } | ||
+ | if ($_ =~ m/^\/\/\n/){ | ||
+ | print $out "$_"; | ||
+ | close ($out); | ||
+ | } | ||
+ | } | ||
+ | close (FILE); | ||
+ | </code> | ||
===== Sequence submission to the NCBI/GenBank ===== | ===== Sequence submission to the NCBI/GenBank ===== | ||