diff --git a/CHANGELOG.md b/CHANGELOG.md index 83b120c..d14c28f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## [v0.0.10](https://github.com/bigbio/py-pgatk/tree/v0.0.10) (2021-02-05) + +**Implemented enhancements:** + +- Ensembl release [\#23](https://github.com/bigbio/py-pgatk/issues/23) +- Add a changelog.md to the project [\#22](https://github.com/bigbio/py-pgatk/issues/22) + ## [v0.0.9](https://github.com/bigbio/py-pgatk/tree/v0.0.9) (2021-02-03) **Implemented enhancements:** diff --git a/pypgatk/proteomics/db/decoy_pyrat.py b/pypgatk/proteomics/db/decoy_pyrat.py index 2a975bc..89bf014 100644 --- a/pypgatk/proteomics/db/decoy_pyrat.py +++ b/pypgatk/proteomics/db/decoy_pyrat.py @@ -199,39 +199,37 @@ def decoy_database(self): # empty protein sequence seq = '' - # open temporary decoy FASTA file - outfa = open(self._temp_file, 'w') - # Open FASTA file using first cmd line argument fasta = SeqIO.parse(self._input_fasta, 'fasta') - # loop each seq in the file - for record in fasta: - seq = str(record.seq) - dcount+=1 - #make sequence isobaric (check args for switch off) - if not self._isobaric: - seq = seq.replace('I', 'L') - - #digest sequence add peptides to set - upeps.update(ProteinDBService.digest(seq, self._cleavage_sites, self._cleavage_position, - self._anti_cleavage_sites, self._peptide_length)) - - #reverse and switch protein sequence - decoyseq = ProteinDBService.revswitch(seq, self._no_switch, self._cleavage_sites) - - #do not store decoy peptide set in reduced memory mode - if not self._memory_save: - #update decoy peptide set - dpeps.update( ProteinDBService.digest(decoyseq, self._cleavage_sites, self._cleavage_position, - self._anti_cleavage_sites, self._peptide_length)) - #write decoy protein accession and sequence to file - outfa.write('>' + self._decoy_prefix + record.id + '\n') - outfa.write(decoyseq + '\n') + # open temporary decoy FASTA file + with open(self._temp_file, 'w') as outfa: + + # loop each seq in the file + for record in fasta: + seq = str(record.seq) + dcount+=1 + #make sequence isobaric (check args for switch off) + if not self._isobaric: + seq = seq.replace('I', 'L') + + #digest sequence add peptides to set + upeps.update(ProteinDBService.digest(seq, self._cleavage_sites, self._cleavage_position, + self._anti_cleavage_sites, self._peptide_length)) + + #reverse and switch protein sequence + decoyseq = ProteinDBService.revswitch(seq, self._no_switch, self._cleavage_sites) + + #do not store decoy peptide set in reduced memory mode + if not self._memory_save: + #update decoy peptide set + dpeps.update( ProteinDBService.digest(decoyseq, self._cleavage_sites, self._cleavage_position, + self._anti_cleavage_sites, self._peptide_length)) + + #write decoy protein accession and sequence to file + outfa.write('>' + self._decoy_prefix + record.id + '\n') + outfa.write(decoyseq + '\n') - # Close files - fasta.close() - outfa.close() # Summarise the numbers of target and decoy peptides and their intersection nonDecoys = set() diff --git a/setup.py b/setup.py index 1d74054..e2b80f1 100644 --- a/setup.py +++ b/setup.py @@ -8,7 +8,7 @@ def readme(): return f.read() setup(name='pypgatk', - version='0.0.10', + version='0.0.11', description='Python tools for proteogenomics', url='http://github.com/bigbio/py-pgatk', long_description=readme(),