phe.mapping¶
Submodules¶
Module contents¶
Mapping related classes and functions.
Implementing Mapper¶
This project does not provide novel way of mapping or calling variants. Instead it interfaces with available mappers through command line interface. Hopefully, we have made it straight forward to add your favourite mapper for others to use.
To do this, you will need to implement Mapper
class. There are a
number of methods that need to be implemented for you mapper to work:
Mapper.name
- Attribute that specifies the name of the mapper (used to dynamically load it).Mapper.make_sam()
- Create a sam file in out_file from R1/Forward, R2/Reverse and ref. SeeMapper.make_sam()
for all input options.Mapper.create_aux_files()
- Create auxilliary files needed for the mapper. This is also called by phenix.Mapper.get_version()
- get the version of the mapper.Mapper.get_info()
- Get the meta data information for the mapper (included in the VCF header).Mapper.make_bam()
- If you want, you can also implement this method, but my default samtools is used to convert from SAM -> BAM.
Bear in mind that cmd_options will be passed on, if they specified in the command line or config under mapper-options.
Once you have implemented this interface, save the file in the mapping directory and it should be automatically picked up. To verify run:
run_snp_pipeline.py --help
You should see your mapper in the list of available mappers. If the mapper works, it will also be included n automatically in the documentations.
Date: | 22 Sep, 2015 |
---|---|
Author: | Alex Jironkin |
-
class
Mapper
(cmd_options=None)[source]¶ Bases:
phe.metadata.PHEMetaData
Abstract Mapper class that provides generic interface to the mapping implementation for a particular mapper.
Attributes: name
Return name of the mapper (implemented by individual classes.
Methods
create_aux_files
(ref)Create required auxiliary files for ref. get_info
([plain])Get information about the mapper. get_samtools_version
()Get version of samtools used. get_version
()Get the version of the underlying command used. make_bam
(*args, **kwargs)Make indexed BAM from reference, and fastq files. make_sam
(*args, **kwargs)Make SAM from reference, and fastq files. validate
()Validate itself, by checking appropriate commands can run. get_meta -
create_aux_files
(ref)[source]¶ Create required auxiliary files for ref.
Parameters: - ref: str
Path to the reference file.
Returns: - bool:
True if auxiliary files were created, False otherwise.
-
get_samtools_version
()[source]¶ Get version of samtools used. Reterned as a triple (major, minor, patch)
-
make_bam
(*args, **kwargs)[source]¶ Make indexed BAM from reference, and fastq files.
Parameters: - ref: str
Path to the reference file used for mapping.
- R1: str
Path to the R1/Forward reads file in FastQ format.
- R2: str:
Path to the R2/Reverse reads file in FastQ format.
- out_file: str
Name of the output file where BAM data is written.
- sample_name: str
Name of the sample to be included in the read group (RG) field.
Returns: - bool:
True iff mapping, converting to BAM and indexing returns 0, False otherwise.
-
make_sam
(*args, **kwargs)[source]¶ Make SAM from reference, and fastq files.
Parameters: - ref: str
Path to the reference file used for mapping.
- R1: str
Path to the R1/Forward reads file in FastQ format.
- R2: str:
Path to the R2/Reverse reads file in FastQ format.
- out_file: str
Name of the output file where SAM data is written.
- sample_name: str
Name of the sample to be included in the read group (RG) field.
- make_aux: bool, optional
True/False to make auxilliary files (default: False).
Returns: - bool:
True iff mapping returns 0, False otherwise.
-
name
¶ Return name of the mapper (implemented by individual classes.