Package: gerenuq
GERENUQA simple commandline tool and python functions for filtering long reads from bam, sam and paf red alignment files according to various user-defined parameters.InstallationUsing Conda$condainstall-cconda-forge-cbioconda-cabahcheligerenuqUsing Pip$pipinstallgerenuqUsing Docker$dockerpullabahcheli/gerenuqManual$gitclonehttps://github.com/abahcheli/gerenuq$cdgerenuq$pythonsetup.pyinstallUsagegerenuq

Requiredinputs:
-i/--input<inputrawsamfile>
-o/--output<outputfilteredsamfile>

Optionalinputs:
-l/--length<minimumreadlengthforcutoff(default1000)>
-m/--matchlength<sequenceidentity,alsoknownasminimumratioofmatchestoreadlength(default0.5)>
-s/--score<minimumscoreforthewholealignment(default1)>
-q/--lengthscore<minimumratiooflengthtoscore,maybeconsideredasthefractionofbasesthathaveapositivescore(default2)>
-t/--threads<numberofprocessestorun(default1)>gerenuq_filter_file(input_file,output_file,min_score=1,min_len_to_score=2,min_length=1000,min_match_to_length=0.5)'''Filters minimap2-mapped reads by mapping score, length, match-to-length and length-to-score ratios. Paf format files only filter by query cutoff.Requires input_file in bam, sam or paf format and output_file (output in the same format as input).'''gerenuq_filter_read_list(read_list,format='sam',min_score=1,min_len_to_score=2,min_length=1000,min_match_to_length=0.5)'''Filters minimap2-mapped reads by mapping score, length, match-to-length and length-to-score ratios. Paf format files only filter by query cutoff.Requires read_list as list of mapped read lines from sam or paf file (in tsv format). Returns a list of reads in sam or paf (tsv) format that passed filtering parameters. Headers will be ignored and not returned.'''Getting StartedBackground and TheoryGerenuq is based off of a series of commands used to filter reads, originating from the filtering process used in the cmags paper. Instead of requiring a number of inputs and outputs, this script is a single line requiring a samfile input and returning a filtered samfile list.The script filters reads mapped against a reference from a minimap2 results samfile. Required input parameters is a samfile (-i or --samfile) (seeGetting Started) and an output file (-o or --output).The script will parse the samfile, filtering reads that are primary alignments, at least 1,000 bases long, meet a minimum ratio of 0.5 for the number of matches to the read length (sequence identity), and be less than a maximum ratio of 2 for the length divided by the score (inverse of the average score per base).Optional parameters can change the filters in a number of ways (refer to the help command when running the script). It is highly recommended that you multi-thread to speed up the filtering process.Quick StartFor appropriate inputs, typepython3 gerenuq.py --help.The samfile should be the output from a minimap2 alignment that may be filtered by samtools.Required input parameters is a samfile, bamfile or paf file (-i or --input) and output file (-o or --output). Output will a samfile, bamfile or paf file filtered according to input or default parameters. For example, a simple input would be:gerenuq -i raw_samfile.sam -o filtered_samfile.samProcessing time increases exponentially for each additionally mapped read. Multi-processing is recommended, which the number of processes to run can be describe with the-tflag (or--threads).gerenuq -i raw_samfile.sam -o filtered_samfile.sam --length 50000 --threads 20