def import_external_fasta(input_file): """ Create a FastaGenome object, set its metadata, and populate it with the data from a fasta file. Must return the data as the single item in an array, because other file formats potentially contain several genomes. """ from nasp.nasp_objects import FastaGenome genome = FastaGenome() set_genome_metadata(genome, input_file) genome.import_fasta_file(genome.file_path(), "franken::") # from sys import stdout #genome._genome._send_to_fasta_handle( stdout ) return [genome]
def setUp(self): reference_path = testdata.REFERENCE_FASTA dups_path = testdata.REFERENCE_DUPS reference = ReferenceGenome() reference.import_fasta_file(reference_path) reference.import_dups_file(dups_path) self.genome = GenomeCollection() fasta = FastaGenome() fasta.import_fasta_file(reference_path) self.genome.add_genome(fasta) self.genome.set_reference(reference) # Statistics are gathered when the matrices are created self.genome.write_to_matrices({}) self.tmpfile = tempfile.NamedTemporaryFile(mode='w', delete=False)
def setUp(self): reference_path = testdata.REFERENCE_FASTA dups_path = testdata.REFERENCE_DUPS reference = ReferenceGenome() reference.import_fasta_file(reference_path) reference.import_dups_file(dups_path) self.genome = GenomeCollection() fasta = FastaGenome() fasta.import_fasta_file(reference_path) self.genome.add_genome(fasta) self.genome.set_reference(reference) self.tmpfile = tempfile.NamedTemporaryFile(mode='w', delete=False) self.matrix_formats = [ { 'dataformat': 'matrix', 'handle': self.tmpfile, 'filter': '' } ]