GratoolsBam
- class gratools.Graph.GratoolsBam(bam_path: ~pathlib.Path, threads: int = 1, logger: ~logging.Logger = <factory>)[source]
Bases:
object
Class for handling BAM files.
Attributes Summary
Methods Summary
build_segments
([list_segments])Extract segments from a BAM file.
Indexes the BAM file specified by self.bam_path.
segments_info
(output_base_path, nb_samples_gfa)specific_and_shared_segments
([...])tag
(dict_link_SA_SB, dict_segments_samples)Add tags to the BAM file with the given dictionary data.
Attributes Documentation
- threads: int = 1
Methods Documentation
- build_segments(list_segments: list | None = None)[source]
Extract segments from a BAM file.
- Parameters:
list_segments (list) – A list of segment IDs to extract from the BAM file.
- Returns:
A tuple containing the GFA segments list, segment samples dictionary, and segment sequence dictionary.
- Return type:
tuple
- index_bam()[source]
Indexes the BAM file specified by self.bam_path.
- Parameters:
self (object) – The instance of the class.
- Returns:
None
- segments_info(output_base_path, nb_samples_gfa, shared_min=1, specific_max=None, filter_len=1)[source]
- tag(dict_link_SA_SB: dict, dict_segments_samples: dict)[source]
Add tags to the BAM file with the given dictionary data.
- Parameters:
dict_link_SA_SB (dict) – Dictionary containing link information for SA and SB.
dict_segments_samples (dict) – Dictionary containing segment samples.
- Returns:
The path to the tagged segments BAM file.
- Return type:
str