Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Generate fasta files of genomes

Signed-off-by: Michael Barton <mail@michaelbarton.me.uk>
  • Loading branch information...
commit 4d36f2963d29232e51bb9f034f3c13901fc8b844 1 parent 9f16028
@michaelbarton authored
Showing with 20 additions and 0 deletions.
  1. +4 −0 Makefile
  2. +16 −0 bin/fasta
View
4 Makefile
@@ -1,3 +1,7 @@
+genomes/.fasta: bin/fasta genomes/.decompressed
+ ls $(dir $(lastword $^))**/**/genome.gb | parallel $<
+ touch $@
+
gene_density.eps: bin/plot_gene_density gene_count.csv
$^ $@
View
16 bin/fasta
@@ -0,0 +1,16 @@
+#!/usr/bin/env ruby
+
+require 'rubygems'
+require 'bio'
+
+in_file = ARGV.first
+out_file = in_file.gsub(".gb",".fna")
+
+species, strain = in_file.gsub('.gb','').split('/')[-3,2]
+
+File.open(out_file,'w') do |out|
+ dna = Bio::FlatFile.auto(in_file).first.to_biosequence
+ out.print dna.output(:fasta,:header => species + '_' + strain)
+end
+
+exit
Please sign in to comment.
Something went wrong with that request. Please try again.