assemblerflow.templates.mapping2json module¶
Purpose¶
This module is intended to generate a json output for mapping results that can be imported in pATLAS.
Expected input¶
The following variables are expected whether using NextFlow or the
main()
executor.
depth_file
: String with the name of the mash screen output file.- e.g.:
'samtoolsDepthOutput_sampleA.txt'
- e.g.:
json_dict
: the file that contains the dictionary with keys and values foraccessions and their respective lengths.
- e.g.:
'reads_sample_result_length.json'
- e.g.:
cutoff
: The cutoff used to trim the unwanted matches for the minimumcoverage results from mapping. This value may range between 0 and 1.
- e.g.:
0.6
- e.g.:
Code documentation¶
-
assemblerflow.templates.mapping2json.
depthfilereader
(depth_file, plasmid_length, cutoff)[source]¶ Function that parse samtools depth file and creates 3 dictionaries that will be useful to make the outputs of this script, both the tabular file and the json file that may be imported by pATLAS
Parameters: - depth_file: str
the path to depth file for each sample
- plasmid_length: dict
a dictionary that stores length of all plasmids in fasta given as input
- cutoff: str
the cutoff used to trim the unwanted matches for the minimum coverage results from mapping. This is then converted into a float within this function in order to compare with the value returned from the perc_value_per_ref.
Returns: - percentage_basescovered: dict
stores the percentage of the total sequence of a reference/accession (plasmid) in a dictionary