pybedtools.bedtool.BedTool.sort¶
-
BedTool.
sort
(*args, **kwargs)[source]¶ Wraps
bedtools sort
.Note that chromosomes are sorted lexograpically, so chr12 will come before chr9.
Example usage:
>>> a = pybedtools.BedTool(''' ... chr9 300 400 ... chr1 100 200 ... chr1 1 50 ... chr12 1 100 ... chr9 500 600 ... ''', from_string=True) >>> print(a.sort()) chr1 1 50 chr1 100 200 chr12 1 100 chr9 300 400 chr9 500 600
For convenience, the file or stream this BedTool points to is implicitly passed as the
-i
argument tosortBed
Original BEDTools help::
Tool: bedtools sort (aka sortBed) Version: v2.29.2 Summary: Sorts a feature file in various and useful ways. Usage: bedtools sort [OPTIONS] -i <bed/gff/vcf> Options: -sizeA Sort by feature size in ascending order. -sizeD Sort by feature size in descending order. -chrThenSizeA Sort by chrom (asc), then feature size (asc). -chrThenSizeD Sort by chrom (asc), then feature size (desc). -chrThenScoreA Sort by chrom (asc), then score (asc). -chrThenScoreD Sort by chrom (asc), then score (desc). -g (names.txt) Sort according to the chromosomes declared in "genome.txt" -faidx (names.txt) Sort according to the chromosomes declared in "names.txt" -header Print the header from the A file prior to results.