pybedtools.bedtool.BedTool.sequence¶
- BedTool.sequence(*args, **kwargs)[source]¶
Wraps
bedtools getfasta
.fi is passed in by the user; bed is automatically passed in as the bedfile of this object; fo by default is a temp file. Use save_seqs() to save as a file.
The end result is that this BedTool will have an attribute, self.seqfn, that points to the new fasta file.
Example usage:
>>> a = pybedtools.BedTool(""" ... chr1 1 10 ... chr1 50 55""", from_string=True) >>> fasta = pybedtools.example_filename('test.fa') >>> a = a.sequence(fi=fasta) >>> print(open(a.seqfn).read()) >chr1:1-10 GATGAGTCT >chr1:50-55 CCATC
For convenience, the file or stream this BedTool points to is implicitly passed as the
-bed
argument tofastaFromBed
Original BEDTools help::
Tool: bedtools getfasta (aka fastaFromBed) Version: v2.31.1 Summary: Extract DNA sequences from a fasta file based on feature coordinates. Usage: bedtools getfasta [OPTIONS] -fi <fasta> -bed <bed/gff/vcf> Options: -fi Input FASTA file -fo Output file (opt., default is STDOUT -bed BED/GFF/VCF file of ranges to extract from -fi -name Use the name field and coordinates for the FASTA header -name+ (deprecated) Use the name field and coordinates for the FASTA header -nameOnly Use the name field for the FASTA header -split Given BED12 fmt., extract and concatenate the sequences from the BED "blocks" (e.g., exons) -tab Write output in TAB delimited format. -bedOut Report extract sequences in a tab-delimited BED format instead of in FASTA format. - Default is FASTA format. -s Force strandedness. If the feature occupies the antisense, strand, the sequence will be reverse complemented. - By default, strand information is ignored. -fullHeader Use full fasta header. - By default, only the word before the first space or tab is used. -rna The FASTA is RNA not DNA. Reverse complementation handled accordingly.