Compute the mean, standard deviation, and median of non-zero ratio results per window.
This function filters out zero and -1 values from the ratio results per window and computes the mean, standard deviation, and median of the remaining values. Values greater than or equal to 5 are capped at 5.
Parameters
----------
ratio_par_window_results : list or numpy.ndarray
A list or array of ratio values per window.
Returns
-------
tuple
A tuple containing the mean, standard deviation, and median of the filtered ratio values.
"""
sys.stderr.write("Computing stats : \n")
# Filtrer les résultats pour enlever les valeurs égales à 0
Detect genomic events based on z-score results and a z-score threshold.
This function identifies significant genomic events where z-scores exceed the given threshold. Events are recorded in the `events` dictionary for the specified chromosome.
Parameters
----------
z_score_results : list or numpy.ndarray
A list or array of z-score values.
zscore_threshold : float
The threshold for detecting significant z-score events.
events : dict
A dictionary to store detected events.
med_ratio : float
The median ratio used for copy number level calculations.
ratio_par_mean_ratio_results : list or numpy.ndarray
A list or array of ratio values compared to the mean ratio.
chr : str
The chromosome for which events are detected.
Returns
-------
None
The function modifies the events dictionary in place.
Generate a VCF file containing structural variant calls based on segmented regions and signal data.
This function creates a VCF (Variant Call Format) file containing structural variant calls derived from segmented regions and signal data. The structural variant type (DEL for deletion or DUP for duplication) is determined based on copy number levels and signal values. The resulting VCF file includes information about the chromosome, position, type of structural variant, copy number, and other relevant information.
Parameters
----------
sample : str
The sample name to be included in the VCF file header.
segment : dict
A dictionary containing segmented regions with copy number information.
signal : dict
A dictionary containing signal data for each chromosome.
lengthFilter : int
The minimum length threshold for including variants in the VCF file.
output_file : str
The path to the output VCF file.
Returns
-------
None
This function writes the structural variant calls to the specified output file in VCF format.
"""
globalheader_written
sys.stderr.write("starting display results\n")
withopen(output_file,'a')asf:
withopen(output_file,"a")asf:
ifnotheader_written:
f.write("##fileformat=VCFv4.2\n")
f.write("##source=cnvcaller\n")
f.write("##INFO=<ID=SVTYPE,Number=1,Type=String,Description=\"Type of structural variant\">\n")
f.write("##INFO=<ID=SVLEN,Number=.,Type=Integer,Description=\"Difference in length between REF and ALT alleles\">\n")
f.write("##INFO=<ID=END,Number=1,Type=Integer,Description=\"End position of the variant described in this record\">\n")