|
ensembl-hive
2.8.1
|
Public Member Functions | |
| public Scalar | slurp () |
| public void | spurt () |
| public Scalar | gz_slurp () |
| public Scalar | bz_slurp () |
| public Scalar | zip_slurp () |
| public ArrayRef | slurp_to_array () |
| public ArrayRef | gz_slurp_to_array () |
| public ArrayRef | bz_slurp_to_array () |
| public ArrayRef | zip_slurp_to_array () |
| public ArrayRef | fh_to_array () |
| public ArrayRef | process_to_array () |
| public void | iterate_lines () |
| public void | iterate_file () |
| public void | work_with_file () |
| public void | gz_work_with_file () |
| public void | bz_work_with_file () |
| public void | zip_work_with_file () |
| public Arrayref | filter_dir () |
| public void | move_data () |
A collection of subroutines aimed to helping IO based operations
| public Scalar Bio::EnsEMBL::Utils::IO::bz_slurp | ( | ) |
Arg [1] : string $file Arg [2] : boolean; $want_ref Indicates if we want to return a scalar reference Arg [3] : boolean; $binary Arg [4] : HashRef arguments to pass into IO compression layers Description : Forces the contents of a file into a scalar. This is the fastest way to get a file into memory in Perl. You can also get a scalar reference back to avoid copying the file contents in Scalar references. If the input file is binary then specify with the binary flag Returntype : Scalar or reference of the file contents depending on arg 2 Example :
Exceptions : If the file did not exist or was not readable Status : Stable
Code:
| public ArrayRef Bio::EnsEMBL::Utils::IO::bz_slurp_to_array | ( | ) |
Arg [1] : string $file Arg [2] : boolean $chomp Arg [3] : HashRef arguments to pass into IO compression layers Description : Sends the contents of the given bzipped file into an ArrayRef Returntype : ArrayRef Example :
Exceptions : If the file did not exist or was not readable Status : Stable
Code:
| public void Bio::EnsEMBL::Utils::IO::bz_work_with_file | ( | ) |
Arg [1] : string $file
Arg [2] : string; $mode
Supports modes like r, w, > and <
Arg [3] : CodeRef the callback which is given the open file handle as
its only argument
Arg [4] : HashRef used to pass options into the IO
compression/uncompression modules
Description : Performs the nitty gritty of checking if a file handle is open
and closing the resulting filehandle down.
Returntype : None
Example : Exceptions : If we could not work with the file due to permissions Status : Stable
Code:
| public ArrayRef Bio::EnsEMBL::Utils::IO::fh_to_array | ( | ) |
Arg [1] : Glob/IO::Handle $fh
Arg [2] : boolean $chomp
Description : Sends the contents of the given filehandle into an ArrayRef.
Will perform chomp on each line if specified. If you require
any more advanced line based processing then see
process_to_array.
Returntype : ArrayRef
Example :Exceptions : None Status : Stable
Code:
| public Arrayref Bio::EnsEMBL::Utils::IO::filter_dir | ( | ) |
Arg [1] : String; directory
Arg [2] : CodeRef; the callback which is given a file in the
directory as its only argument
Description : Return the lexicographically sorted content of a directory.
The callback allows to specify the criteria an entry in
the directory must satisfy in order to appear in the content.
Returntype : Arrayref; list with the filtered files/directory
Example : Exceptions : If the directory cannot be opened or its handle
cannot be closed
Status : Stable
Code:
| public Scalar Bio::EnsEMBL::Utils::IO::gz_slurp | ( | ) |
Arg [1] : string $file Arg [2] : boolean; $want_ref Indicates if we want to return a scalar reference Arg [3] : boolean; $binary Arg [4] : HashRef arguments to pass into IO compression layers Description : Forces the contents of a file into a scalar. This is the fastest way to get a file into memory in Perl. You can also get a scalar reference back to avoid copying the file contents in Scalar references. If the input file is binary then specify with the binary flag Returntype : Scalar or reference of the file contents depending on arg 2 Example :
Exceptions : If the file did not exist or was not readable Status : Stable
Code:
| public ArrayRef Bio::EnsEMBL::Utils::IO::gz_slurp_to_array | ( | ) |
Arg [1] : string $file Arg [2] : boolean $chomp Arg [3] : HashRef arguments to pass into IO compression layers Description : Sends the contents of the given gzipped file into an ArrayRef Returntype : ArrayRef Example :
Exceptions : If the file did not exist or was not readable Status : Stable
Code:
| public void Bio::EnsEMBL::Utils::IO::gz_work_with_file | ( | ) |
Arg [1] : string $file
Arg [2] : string; $mode
Supports modes like r, w, > and <
Arg [3] : CodeRef the callback which is given the open file handle as
its only argument
Arg [4] : HashRef used to pass options into the IO
compression/uncompression modules
Description : Performs the nitty gritty of checking if a file handle is open
and closing the resulting filehandle down.
Returntype : None
Example : Exceptions : If we could not work with the file due to permissions Status : Stable
Code:
| public void Bio::EnsEMBL::Utils::IO::iterate_file | ( | ) |
Arg [1] : string $file
Arg [3] : CodeRef the callback which is used to iterate the lines in
the file
Description : Iterates through each line from the given file and
hands them to the callback one by one
Returntype : None
Example :Exceptions : If the file did not exist or if a callback was not given. Status : Stable
Code:
| public void Bio::EnsEMBL::Utils::IO::iterate_lines | ( | ) |
Arg [1] : Glob/IO::Handle $fh
Arg [2] : CodeRef $callback
Description : Iterates through each line from the given file handle and
hands them to the callback one by one
Returntype : None
Example :Exceptions : If the fh did not exist or if a callback was not given. Status : Stable
Code:
| public void Bio::EnsEMBL::Utils::IO::move_data | ( | ) |
Arg [1] : FileHandle $src_fh
Arg [2] : FileHandle $trg_fh
Arg [3] : int $buffer. Defaults to 8KB
Description : Moves data from the given source filehandle to the target one
using a 8KB buffer or user specified buffer
Returntype : None
Example :Exceptions : If inputs were not as expected
Code:
| public ArrayRef Bio::EnsEMBL::Utils::IO::process_to_array | ( | ) |
Arg [1] : Glob/IO::Handle $fh
Arg [2] : CodeRef $callback
Description : Sends the contents of the given file handle into an ArrayRef
via the processing callback. Assumes line based input.
Returntype : ArrayRef
Example :Exceptions : If the fh did not exist or if a callback was not given. Status : Stable
Code:
| public Scalar Bio::EnsEMBL::Utils::IO::slurp | ( | ) |
Arg [1] : string $file
Arg [2] : boolean; $want_ref
Arg [3] : boolean; $binary
Indicates if we want to return a scalar reference
Description : Forces the contents of a file into a scalar. This is the
fastest way to get a file into memory in Perl. You can also
get a scalar reference back to avoid copying the file contents
in Scalar references. If the input file is binary then specify
with the binary flag
Returntype : Scalar or reference of the file contents depending on arg 2
Example :Exceptions : If the file did not exist or was not readable Status : Stable
Code:
| public ArrayRef Bio::EnsEMBL::Utils::IO::slurp_to_array | ( | ) |
Arg [1] : string $file Arg [2] : boolean $chomp Description : Sends the contents of the given file into an ArrayRef Returntype : ArrayRef Example :
Exceptions : If the file did not exist or was not readable Status : Stable
Code:
| public void Bio::EnsEMBL::Utils::IO::spurt | ( | ) |
Arg [1] : string $file
Arg [2] : string $contents
Arg [3] : boolean; $append
Arg [4] : boolean; $binary
Description : Convenient method to safely open a file and dump some content into it.
$append can be set to append to the file instead of resetting it first.
$binary can be set if the content you are printing is not plain-text.
Returntype : None
Example :Exceptions : If the file could not be created or was not writable Status : Stable
Code:
| public void Bio::EnsEMBL::Utils::IO::work_with_file | ( | ) |
Arg [1] : string $file
Arg [2] : string; $mode
Supports all modes specified by the open() function as well as those
supported by IO::File
Arg [3] : CodeRef the callback which is given the open file handle as
its only argument
Description : Performs the nitty gritty of checking if a file handle is open
and closing the resulting filehandle down.
Returntype : None
Example : Exceptions : If we could not work with the file due to permissions Status : Stable
Code:
| public Scalar Bio::EnsEMBL::Utils::IO::zip_slurp | ( | ) |
Arg [1] : string $file Arg [2] : boolean; $want_ref Indicates if we want to return a scalar reference Arg [3] : boolean; $binary Arg [4] : HashRef arguments to pass into IO compression layers Description : Forces the contents of a file into a scalar. This is the fastest way to get a file into memory in Perl. You can also get a scalar reference back to avoid copying the file contents in Scalar references. If the input file is binary then specify with the binary flag Returntype : Scalar or reference of the file contents depending on arg 2 Example :
Exceptions : If the file did not exist or was not readable Status : Stable
Code:
| public ArrayRef Bio::EnsEMBL::Utils::IO::zip_slurp_to_array | ( | ) |
Arg [1] : string $file Arg [2] : boolean $chomp Arg [3] : HashRef arguments to pass into IO compression layers Description : Sends the contents of the given zipped file into an ArrayRef Returntype : ArrayRef Example :
Exceptions : If the file did not exist or was not readable Status : Stable
Code:
| public void Bio::EnsEMBL::Utils::IO::zip_work_with_file | ( | ) |
Arg [1] : string $file
Arg [2] : string; $mode
Supports modes like r, w, > and <
Arg [3] : CodeRef the callback which is given the open file handle as
its only argument
Arg [4] : HashRef used to pass options into the IO
compression/uncompression modules
Description : Performs the nitty gritty of checking if a file handle is open
and closing the resulting filehandle down.
Returntype : None
Example : Exceptions : If we could not work with the file due to permissions Status : Stable
Code: