Scroll to navigation

Bio::DB::HTS::Faidx(3pm) User Contributed Perl Documentation Bio::DB::HTS::Faidx(3pm)

LICENSE

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.

NAME

Faidx -- Perl extension for accessing bgzip compressed and indexed FASTA using htslib

SYNOPSIS

 #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);
 #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);
 #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');

AUTHOR

Rishi Nag

2024-03-07 perl v5.38.2