def test_writeCSV(self): read_csv_data = bioio.readCSV(['sample1.csv'])['sample1'] bioio.writeCSV('rewritten_sample1.csv', read_csv_data) self.assertEqual( bioio.readCSV(['rewritten_sample1.csv'])['rewritten_sample1'], read_csv_data) os.remove('rewritten_sample1.csv')
def test_readCSV(self): self.assertDictEqual(bioio.readCSV(example_csv_files), expected_csv_input) with self.assertRaises(SystemExit): bioio.readCSV(['sample1.csv', 'path/sample2.csv']) with self.assertRaises(SystemExit): bioio.readCSV(['sample1.csv', 'sample2.txt'])
# -*- coding: utf-8 -*- """ @author: rishijavia """ import sys import os sys.path.append(os.path.join(sys.path[0], 'lib')) sys.path.append(os.path.join(sys.path[0], 'test')) import bioio import biomath # strip file extension and read file read_csv = bioio.readCSV([sys.argv[-1]]) input_csv_name = sys.argv[-1][:-4] input_csv_data = read_csv[input_csv_name] # break the clusters output_data = bioio.breakClusters(input_csv_data) # write the resulting data to files output_txt_name = input_csv_name + "_brokenCluster.txt" bioio.writeTXT(output_txt_name, output_data)
# -*- coding: utf-8 -*- """ @author: thatbudakguy """ import sys import os sys.path.append(os.path.join(sys.path[0],'lib')) sys.path.append(os.path.join(sys.path[0],'test')) import bioio import biomath # strip file extension and read file read_csv = bioio.readCSV([sys.argv[-1]]) input_csv_name = sys.argv[-1][:-4] input_csv_data = read_csv[input_csv_name] # find longest sequences and get their corresponding ids output_csv_data = biomath.findLongestSeq(input_csv_data) output_seq_ids = bioio.splitCSV(output_csv_data)['output_seq_ids'] output_seqs = bioio.splitCSV(output_csv_data)['output_seqs'] output_seq_ids_txt = bioio.addGreaterThans(output_seq_ids) # define names of the resulting files output_csv_name = input_csv_name+"_trimmed.csv" output_txt_name = input_csv_name+"_names_only.txt" output_fasta_name = input_csv_name+".fasta" # write the resulting data to files bioio.writeCSV(output_csv_name,output_csv_data) bioio.writeTXT(output_txt_name,output_seq_ids_txt)
def test_splitCSV(self): example_input_csv = bioio.readCSV(['sample1.csv']) example_input_csv = bioio.splitCSV(example_input_csv['sample1']) self.assertDictEqual(example_input_csv, expected_split_data)
def test_writeCSV(self): read_csv_data = bioio.readCSV(['sample1.csv'])['sample1'] bioio.writeCSV('rewritten_sample1.csv',read_csv_data) self.assertEqual(bioio.readCSV(['rewritten_sample1.csv'])['rewritten_sample1'],read_csv_data) os.remove('rewritten_sample1.csv')
def test_splitCSV(self): example_input_csv = bioio.readCSV(['sample1.csv']) example_input_csv = bioio.splitCSV(example_input_csv['sample1']) self.assertDictEqual(example_input_csv,expected_split_data)
def test_readCSV(self): self.assertDictEqual(bioio.readCSV(example_csv_files),expected_csv_input) with self.assertRaises(SystemExit): bioio.readCSV(['sample1.csv','path/sample2.csv']) with self.assertRaises(SystemExit): bioio.readCSV(['sample1.csv','sample2.txt'])