text
stringlengths
0
828
header the whole header sequence is used as a protein id instead of
raising an exception.
:returns: dict, describing a fasta header. Minimally contains an 'id' key.
""""""
if parser is None:
try:
headerInfo = pyteomics.fasta.parse(fastaHeader)
except pyteomics.auxiliary.PyteomicsError as raisedPyteomicsError:
#If forceId is set True, the whole header is used as id
if forceId:
headerInfo = {'id': fastaHeader}
else:
raise raisedPyteomicsError
else:
headerInfo = parser(fastaHeader)
return headerInfo"
3746,"def _idFromHeaderInfo(headerInfo, isDecoy, decoyTag):
""""""Generates a protein id from headerInfo. If ""isDecoy"" is True, the
""decoyTag"" is added to beginning of the generated protein id.
:param headerInfo: dict, must contain a key ""id""
:param isDecoy: bool, determines if the ""decoyTag"" is added or not.
:param decoyTag: str, a tag that identifies decoy / reverse protein entries.
:returns: str, protein id
""""""
proteinId = headerInfo['id']
if isDecoy:
proteinId = ''.join((decoyTag, proteinId))
return proteinId"
3747,"def _nameFromHeaderInfo(headerInfo, isDecoy, decoyTag):
""""""Generates a protein name from headerInfo. If ""isDecoy"" is True, the
""decoyTag"" is added to beginning of the generated protein name.
:param headerInfo: dict, must contain a key ""name"" or ""id""
:param isDecoy: bool, determines if the ""decoyTag"" is added or not.
:param decoyTag: str, a tag that identifies decoy / reverse protein entries.
:returns: str, protein name
""""""
if 'name' in headerInfo:
proteinName = headerInfo['name']
else:
proteinName = headerInfo['id']
if isDecoy:
proteinName = ''.join((decoyTag, proteinName))
return proteinName"
3748,"def _addProtein(self, proteinId, proteinName, sequence, fastaHeader,
headerInfo, isDecoy=False, isContaminant=False):
""""""#TODO""""""
proteinEntry = ProteinEntry(
proteinId, proteinName, sequence, fastaHeader, headerInfo,
isDecoy=isDecoy, isContaminant=isContaminant
)
self.proteins[proteinEntry.id] = proteinEntry"
3749,"def _addPeptide(self, sequence, proteinId, digestInfo):
""""""Add a peptide to the protein database.
:param sequence: str, amino acid sequence
:param proteinId: str, proteinId
:param digestInfo: dict, contains information about the in silico digest
must contain the keys 'missedCleavage', 'startPos' and 'endPos'
""""""
stdSequence = self.getStdSequence(sequence)
if stdSequence not in self.peptides:
self.peptides[stdSequence] = PeptideEntry(
stdSequence, mc=digestInfo['missedCleavage']
)
if sequence not in self.peptides:
self.peptides[sequence] = self.peptides[stdSequence]
if proteinId not in self.peptides[stdSequence].proteins:
#FUTURE: peptide can appear at multiple positions per protein.
#peptideEntry.addSource(proteinId, startPos, endPos)
self.peptides[stdSequence].proteins.add(proteinId)
self.peptides[stdSequence].proteinPositions[proteinId] = (
digestInfo['startPos'], digestInfo['endPos']
)
self.proteins[proteinId].peptides.add(sequence)"
3750,"def options(self, parser, env):
""""""
Add options to command line.
""""""
super(LeakDetectorPlugin, self).options(parser, env)
parser.add_option(""--leak-detector-level"", action=""store"",
default=env.get('NOSE_LEAK_DETECTOR_LEVEL'),
dest=""leak_detector_level"",
help=""Level at which to detect leaks and report memory deltas ""
""(0=None, 1=Dir, 2=Module, 3=TestCaseClass, 4=Test)"")
parser.add_option(""--leak-detector-report-delta"", action=""store_true"",
default=env.get('NOSE_LEAK_DETECTOR_REPORT_DELTA'),
dest=""leak_detector_report_delta"",
help="""")
parser.add_option(""--leak-detector-patch-mock"", action=""store_true"",
default=env.get('NOSE_LEAK_DETECTOR_PATCH_MOCK', True),
dest=""leak_detector_patch_mock"",