ClusterAsFeatures¶
Class Definition¶
-
class
spectra_cluster.analyser.cluster_features.ClusterAsFeatures(result_file, sample_name_extractor=None)¶ Extracts the number of spectra per sample and cluster and writes the result directly to a file object.
Since the number of samples within the clustering result is not known at the beginning, you have to use the function “add_resultfile_header” to add a header to the result file.
-
__init__(result_file, sample_name_extractor=None)¶ Initialised a new ClusterAsFeatures analyser.
Parameters: - result_file – A file object that will be used to write the resulting table to. This is necessary since this result data will generally be too large to keep in memory.
- sample_name_extractor – A function that takes the spectrum’s title as parameter and returns the ie. ample name. If set to None the default function is used where everything before the first “.” is being returned.
-
add_resultfile_header(file_path)¶ Adds the header line to the result file that was used to write the results during the analysis to.
Parameters: file_path – Path ot the file where the results are stored.
-
static
extract_basic_sample_name(spec_ref)¶ Extracts the sample name by returning everything before the first “.” from the title (often used by ProteoWized converted files) or, if available, by returning the original filename (without path information).
Parameters: spec_ref – The spectrum object. Returns: The sample name
-
process_cluster(cluster)¶ Extracts how many spectrum per sample were observed.
Parameters: cluster – The cluster to process Returns:
-