From 26ea758aa6731fd7983a946eedcec511845f99f9 Mon Sep 17 00:00:00 2001 From: Thomas Mooney Date: Tue, 15 Nov 2016 12:11:38 -0600 Subject: [PATCH] Extract function to get fasta chunk name. --- pvacseq/lib/pipeline.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/pvacseq/lib/pipeline.py b/pvacseq/lib/pipeline.py index 47f70c1..338d0f9 100644 --- a/pvacseq/lib/pipeline.py +++ b/pvacseq/lib/pipeline.py @@ -184,9 +184,12 @@ def generate_fasta(self): def split_fasta_file_path(self, split_start, split_end): basename = os.path.join(self.tmp_dir, self.sample_name + "_" + str(self.peptide_sequence_length) + ".fa.split") - fasta_chunk = "%d-%d" % (split_start*2-1, split_end*2) + fasta_chunk = self.split_fasta_chunk(split_start, split_end) return "%s_%s" % (basename, fasta_chunk) + def split_fasta_chunk(self, split_start, split_end): + return "%d-%d" % (split_start*2-1, split_end*2) + @abstractmethod def call_iedb_and_parse_outputs(self, chunks): pass @@ -343,7 +346,7 @@ def __init__(self, **kwargs): def generate_fasta(self, chunks): status_message("Generating Variant Peptide FASTA and Key Files") for (split_start, split_end) in chunks: - fasta_chunk = "%d-%d" % (split_start*2-1, split_end*2) + fasta_chunk = self.split_fasta_chunk(split_start, split_end) split_tsv_file_path = self.split_tsv_file_path(split_start, split_end) split_fasta_file_path = self.split_fasta_file_path(split_start, split_end) if os.path.exists(split_fasta_file_path): @@ -366,7 +369,7 @@ def generate_fasta(self, chunks): def call_iedb_and_parse_outputs(self, chunks): split_parsed_output_files = [] for (split_start, split_end) in chunks: - fasta_chunk = "%d-%d" % (split_start*2-1, split_end*2) + fasta_chunk = self.split_fasta_chunk(split_start, split_end) for a in self.alleles: for epl in self.epitope_lengths: split_fasta_file_path = self.split_fasta_file_path(split_start, split_end) @@ -435,7 +438,7 @@ def __init__(self, **kwargs): def generate_fasta(self, chunks): status_message("Generating Variant Peptide FASTA and Key Files") for (split_start, split_end) in chunks: - fasta_chunk = "%d-%d" % (split_start*2-1, split_end*2) + fasta_chunk = self.split_fasta_chunk(split_start, split_end) split_tsv_file_path = self.split_tsv_file_path(split_start, split_end) split_fasta_file_path = self.split_fasta_file_path(split_start, split_end) if os.path.exists(split_fasta_file_path): @@ -458,7 +461,7 @@ def generate_fasta(self, chunks): def call_iedb_and_parse_outputs(self, chunks): split_parsed_output_files = [] for (split_start, split_end) in chunks: - fasta_chunk = "%d-%d" % (split_start*2-1, split_end*2) + fasta_chunk = self.split_fasta_chunk(split_start, split_end) for a in self.alleles: split_fasta_file_path = self.split_fasta_file_path(split_start, split_end) split_iedb_output_files = []