Bio::D...::Faidx(3pm)
π LICENSE π
okay bestie, legal moment, we gotta do it, no skipping π
Copyright [2015-2018] EMBL-European Bioinformatics Institute Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
that's it, that's the whole thing, Apache 2.0, iconic behavior, read it, respect it π
β¨ NAME β¨
Faidx β it's a Perl extension for accessing bgzip compressed and indexed FASTA using htslib. yes, bgzip, not plain gzip. yes, indexed. iykyk πΈ
π¦ SYNOPSIS π¦
first things first, bestie, you gotta include the module:
#include the module
use Bio::DB::HTS::Faidx;
#create the index object
my $fasta = "$Bin/data/Saccharomyces_cerevisiae.R64-1-1.dna.chromosome.I.fa.gz" ;
my $location = "I:1-100" ;
my $seq_id = "I" ;
my $index = Bio::DB::HTS::Faidx->new($fasta);
so we're pointing it at a bgzipped yeast chromosome I FASTA, and we hand new the file path and it gives us back an index object. main character energy, honestly π
now the actual fetching, using a location string:
#get sequence using the location
my $seq = "" ;
my $length = 0 ;
($seq, $length) = $index->get_sequence($location);
$seq = $index->get_sequence_no_length($location);
$length = $index->length($seq_id);
see how there's a version that gives you back both the sequence and its length, and a _no_length version when you literally only want the sequence? and then length will hand you the length on its own if you just pass a seq id. pick your fighter π«Ά
and here's the other flavor, where you pass the pieces separately instead of one "I:1-100" string:
#get sequence using the separate parameters.
#Note here that the sequence start and end points are zero indexed, so code accordingly.
($seq, $length) = $index->get_sequence2("I",1,99);
$seq = $index->get_sequence2_no_length("I",1,99);
my @seq_ids = $index->get_all_sequence_ids();
#returns 1 if sequence ID is present, 0 if not
my $has_seq = $index->has_sequence('I');
β οΈ okay this part is important, do NOT sleep on it: the sequence start and end points inget_sequence2andget_sequence2_no_lengthare zero indexed. so code accordingly, fr fr. that("I",1,99)is not what your brain thinks it is at first glance π
also, get_all_sequence_ids will drop every sequence id it's got into @seq_ids β all of them, the whole roster β¨
and has_sequence('I') is your vibe check: returns 1 if that sequence ID is present, 0 if it is not. simple, clean, we love a boolean π
π§ AUTHOR π§
Rishi Nag β thank you for your service, king π
and that's a wrap, bestie π this page came to you from perl v5.40.0, dated 2024-10-31, living under the name Bio::D...::Faidx(3pm) in the User Contributed Perl Documentation. go index something, periodt π π
π¦ where this page comes from
- debian trixie: libbio-db-hts-perl 3.01-5 Β· Apache-2.0
- ubuntu questing: libbio-db-hts-perl 3.01-5
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms