def select(index_file, selected_keys_file): command = "rs_select -index_file=" \ + index_file \ + " -selected_keys_file=" \ + selected_keys_file execute_command(command, verbose)
def simulate_reads(script_path, number_of_transcripts, readlen, error_rate, coverage, output_dir): remove_file_if_exists(output_dir + '/transcript_names.txt') remove_file_if_exists(output_dir + '/num_of_reads.txt') command = "Rscript --vanilla " \ + script_path + " " \ + str(number_of_transcripts) + " " \ + str(readlen) + " " \ + str(error_rate) + " " \ + str(coverage) + " " \ + str(output_dir) + " " \ execute_command(command, verbose) transcript_names = np.genfromtxt(output_dir + '/transcript_names.txt', names=None, dtype=None, usecols=(0)) num_of_reads = np.genfromtxt(output_dir + '/num_of_reads.txt', names=None, dtype=None, usecols=(0)) ground_truth_map = dict(zip(transcript_names, num_of_reads)) return ground_truth_map
def select_with_k(index_file, selected_keys_file, k): command = "rs_select -index_file=" \ + index_file \ + " -selected_keys_file=" \ + selected_keys_file \ + " -rs_length=" \ + str(k) execute_command(command, verbose)
def build_index_with_k(transcriptome_reference_file, k, index_output_path): command = "kallisto index -i " \ + index_output_path \ + " -k " \ + str(k) \ + " " \ + transcriptome_reference_file execute_command(command, verbose)
def build_index(k, transcriptome_reference_file, index_output_path): command = "sailfish index -t " \ + transcriptome_reference_file \ + " -o " \ + index_output_path \ + " -k " \ + str(k) execute_command(command,verbose)
def build_index(cluster_output, index_file, k, numthreads): command = "rs_index -transcript_fasta=" \ + cluster_output \ + " -index_file=" \ + index_file \ + " -rs_length=" \ + str(k) \ + " -num_threads=" \ + str(numthreads) execute_command(command, verbose)
def cluster(transcriptome_reference_file, cluster_output, k, numthreads): command = "rs_cluster -gene_fasta=" \ + transcriptome_reference_file \ + " -num_threads=" \ + str(numthreads) \ + " -output=" \ + cluster_output \ + " -rs_length=" \ + str(k) execute_command(command, verbose)
def quant(index_dir, output_dir, sample_pair1, sample_pair2): command = "kallisto quant -i " \ + index_dir \ + " -t 4 -o " \ + output_dir \ + " " \ + sample_pair1 \ + " " \ + sample_pair2 \ execute_command(command, verbose)
def quant_with_k(sample_pair1, sample_pair2, index_dir, output_dir): command = "sailfish quant -i " \ + index_dir \ + " -l " \ + "T=PE:O=><:S=SA" \ + " -1 " \ + sample_pair1 \ + " -2 " \ + sample_pair2 \ + " -p 4 -o " \ + output_dir execute_command(command,verbose)
def count(selected_keys_file, count_file, sample_pair_1, sample_pair_2, numthreads): command = "rs_count -selected_keys_file=" \ + selected_keys_file \ + " -count_file=" \ + count_file \ + " -read_files1=" \ + sample_pair_1 \ + " -read_files2=" \ + sample_pair_2 \ + " -num_threads=" \ + str(numthreads) execute_command(command, verbose)
def quant_with_k(k, sample_pair1, sample_pair2, index_dir, output_dir): command = "salmon quant -i " \ + index_dir \ + " -l A" \ + " -1 " \ + sample_pair1 \ + " -2 " \ + sample_pair2 \ + " -p 4 -o " \ + output_dir \ + " -k " \ + str(k) execute_command(command, verbose)
def test_execute_command_success(self): """ Test if execute command function returns true when command succeeds. """ logging.info("test_execute_command_success") status, ret = general_utils.execute_command("ls") self.assertTrue(status)
def test_execute_command_fail(self): """ Test if execute command function returns false when command fails. """ logging.info("test_execute_command_fail") status, out = general_utils.execute_command("not a command") self.assertFalse(status) self.assertEquals(out, 'NA')
def convert_logbin_to_logtext(self): """This function is used to convert the binary log file to text file. Args: self: Instance of the class. Returns: True on success else False. Raises: NA. """ command = "".join(['mysqlbinlog ', self.temp_db_binlog_file, ' >> ', self.temp_db_textlog_file]) status, ret = general_utils.execute_command(command) if not status: logging.error("Conversion of mysql bin log file to text failed.") return FAILURE return SUCCESS