From 47a031dc0ad1512ee8c4fce77801fe2aa337b3c6 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 6a2b4ee..0c6c0a6 100644 --- a/pvacseq/lib/pipeline.py +++ b/pvacseq/lib/pipeline.py @@ -156,9 +156,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 @@ -312,7 +315,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): @@ -335,7 +338,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) @@ -404,7 +407,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): @@ -427,7 +430,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 = []