UCore

ursgal.ucore.calculate_mass(mz, charge)

Calculate mass function

Keyword Arguments:
 
  • mz (float) – mz of molecule/peak
  • charge (int) – charge for calculating mass
Returns:

calculated mass

Return type:

float

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
Returns:

calculated m/z

Return type:

float

ursgal.ucore.convert_dalton_to_ppm(da_value, base_mz=1000.0)

Convert the precision in Dalton to ppm

Keyword Arguments:
 
  • da_value (float) – Dalton value to transform
  • base_mz (float) – factor for transformation
Returns:

value in ppm

Return type:

float

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
Returns:

value in Dalton

Return type:

float

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, count_missed_cleavages=None, 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
  • count_missed_cleavages (int) – number of miss cleavages allowed
Returns:

list of digested peptides

Return type:

list

ursgal.ucore.merge_duplicate_psm_rows(csv_file_path=None, psm_counter=None, psm_defining_colnames=None, psm_colnames_to_merge_multiple_values={}, 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, psm_colnames_to_merge_multiple_values, joinchar='<|>')

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

ursgal.ucore.parse_fasta(io)

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

ursgal.ucore.terminal_supports_color()

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