ursgal.ucore.calculate_mz(mass, charge)

Calculate m/z function

Keyword Arguments:
  • mass (float) – mass for calculating m/z
  • charge (int) – charge for calculating m/z

calculated m/z

Return type:


ursgal.ucore.convert_ppm_to_dalton(ppm_value, base_mz=1000.0)

Normalize the precision in ppm to 1000 Dalton

Keyword Arguments:
  • ppm_value (float) – parts per million value to transform
  • base_mz (float) – factor for transformation

value in Dalton

Return type:


ursgal.ucore.count_distinct_psms(csv_file_path=None, psm_defining_colnames=None)

Returns a counter based on PSM-defining column names (i.e spectrum & peptide, but also score field because sometimes the same PSMs are reported with different scores…).

ursgal.ucore.digest(sequence, enzyme, no_missed_cleavages=False)

Amino acid digest function

Keyword Arguments:
  • sequence (str) – amino acid sequence to digest
  • enzyme (tuple) – enzyme properties used for cleavage (‘aminoacid(s)’, ‘N/C(terminus)’) e.g. (‘KR’,’C’) for trypsin
  • no_missed_cleavages (bool) – allow missed cleavages or not

list of digestes peptides

Return type:


ursgal.ucore.merge_duplicate_psm_rows(csv_file_path=None, psm_counter=None, psm_defining_colnames=None, joinchar='<|>', overwrite_file=True)

Rows describing the same PSM (e.g. when two proteins share the same peptide) are merged to one row.

ursgal.ucore.merge_rowdicts(list_of_rowdicts, joinchar='<|>')

Merges CSV rows. If the column values are conflicting, they are joined with a character (joinchar).


Small function to efficiently parse a file in fasta format.

Keyword Arguments:
 io (obj) – openend file obj (fasta file)
Yields:tuple – fasta_id and sequence
ursgal.ucore.print_current_params(params, old_params=None)

Function to print current params

Keyword Arguments:
 params (dict) – parameter dict to print
ursgal.ucore.reformat_peptide(regex_pattern, unimod_name, peptide)

reformats the MQ and Novor peptide string to ursgal format (ac)SSSLM(ox)RPGPSR –> SSSLMRPGPSR#Acetyl:0;Oxidation:5


Returns True if the running system’s terminal supports color, and False otherwise. Source: https://github.com/django/django/blob/master/django/core/management/color.py