The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Bio::SeqAlignment::Components::Sundry::DocumentSequenceModifications - Store and retrieve sequence modifications

VERSION

version 0.01

SYNOPSIS

  use Bio::SeqAlignment::Components::Sundry::DocumentSequenceModifications qw(store_modifications);

  my $modifications = {
      'seq1' => {
          'mod1' => 'A->G',
          'mod2' => 'C->T'
      },
      'seq2' => {
          'mod1' => 'G->A',
          'mod2' => 'T->C'
      }
  };

  my $mod_fname = store_modifications(
      mods      => $modifications,
      format    => 'YAML',
      bioseq_file => 'sequences.fasta',
      outdir    => '.'
  );

  my $modifications_ref = retrieve_modifications(
      format    => 'YAML',
      mod_fname => $mod_fname
  );

DESCRIPTION

This module provides functions to store and retrieve sequence modifications in various formats. These modifications provide a meta-data layer to fasta files (and down the road to fastq files) that can be used to track changes made to the sequences in the file. While there are many ways to store such information, this module provides a simple way to store and retrieve it in common serialization formats (e.g. JSON/YAML/MessagePack). Storing this information in this manner allows for easy retrieval and use in downstream analyses and avoids the use of the rather heavyweight BioPerl modules.

EXPORT

store_modifications, retrieve_modifications

SUBROUTINES

store_modifications

  my $mod_fname = store_modifications(
      mods      => $modifications,
      format    => 'YAML',
      bioseq_file => 'sequences.fasta',
      outdir    => '.'
  );

Stores the sequence modifications in the specified format. The modifications are stored in a file with the same name as the fasta file but with a '_mods' suffix and the appropriate extension (e.g. 'sequences_mods.yaml'). The file is written to the specified output directory. The function returns the full path to the file where the modifications are stored.

retrieve_modifications

  my $modifications_ref = retrieve_modifications(
      format    => 'YAML',
      mod_fname => $mod_fname
  );

Retrieves the sequence modifications from the specified file in the specified format. The function returns a reference to the hash containing the modifications.

AUTHOR

Christos Argyropoulos <chrisarg *at* cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2024 by Christos Argyropoulos.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.