Esempio n. 1
0
 def test_signaturs_large_genome(self):
     f = fileinput.input(os.path.join(data_path,"8M_genome.fna"))
     c= list(SeqIO.parse(f,"fasta"))
     f.close
     dna_c = dna.DNA(id = c[0].id, seq = str(c[0].seq))
     dna_c.calculate_signature()
     calculated_parameters = ml.fit_parameters([dna_c])
     assert_equal(len(calculated_parameters), 136)
Esempio n. 2
0
 def test_parameters_one_contig_basic(self):
     f = fileinput.input(os.path.join(data_path,"bambus2.scaffold.linear.fasta.one_contig"))
     c = list(SeqIO.parse(f,"fasta"))
     f.close()
     dna_c = dna.DNA(id = c[0].id, seq = str(c[0].seq))
     dna_c.calculate_signature()
     c_sig = self.CORRECT_SIGNATURES_ONE_CONTIG
     n = sum(c_sig.values())
     correct_parameters = np.zeros(dna.DNA.kmer_hash_count)
     for i,v in c_sig.iteritems():
         correct_parameters[i] += v
     correct_parameters/=np.sum(correct_parameters)
     calculated_parameters = ml.fit_parameters([dna_c])
     assert_equal(calculated_parameters[0],correct_parameters[0])
     assert_equal((calculated_parameters==correct_parameters).all(),True)