view release on metacpan or search on metacpan
BioX-CLPM version 0.0.1
+Mass spectrometry coupled with chemical crosslinking is an efficient
method to study protein - protein interactions.
+Mass spectra of cross-linked peptides contain m/z values of crosslinked
species as well as peptide fragments that are not cross-linked.
Thus, finding cross-linked species from this mass spectra is like
finding needles from hay-stack.
+Few programs have attempted to find cross-linked species from
mass spectra, but they are lacking few or more desired
functionalities.
+Newer version of CLPM is improvement over the previous one to
provide an all-inclusive tool to analyze mass spectra of all kinds of
cross-linked data.
+CLPM is an ongoing effort to include more and more functionalities
for analysis of chemical cross-linking data.
lib/BioX/CLPM/Engine.pm view on Meta::CPAN
use Carp;
use version; our $VERSION = qv('0.0.1');
{
my %sequences_of :ATTR( :get<sequences> :set<sequences> :default<[]> :init_arg<sequences> );
my %enzyme_of :ATTR( :get<enzyme> :set<enzyme> :default<''> :init_arg<enzyme> );
my %linker_of :ATTR( :get<linker> :set<linker> :default<''> :init_arg<linker> );
my %peaks_of :ATTR( :get<peaks> :set<peaks> :default<''> :init_arg<peaks> );
my %matches_of :ATTR( :get<matches> :set<matches> :default<''> :init_arg<matches> );
my %fragments_of :ATTR( :get<fragments> :set<fragments> :default<''> :init_arg<fragments> );
my %tolerance_of :ATTR( :get<tolerance> :set<tolerance> :default<''> :init_arg<tolerance> );
my %missed_clvg_of :ATTR( :get<missed_clvg> :set<missed_clvg> :default<''> :init_arg<missed_clvg> );
my %var_mod_of :ATTR( :get<var_mod> :set<var_mod> :default<''> :init_arg<var_mod> );
my %stat_mod_of :ATTR( :get<stat_mod> :set<stat_mod> :default<''> :init_arg<stat_mod> );
#my %attribute_of :ATTR( :get<attribute> :set<attribute> :default<''> :init_arg<attribute> );
# PRIV
sub BUILD {
my ( $self, $ident, $arg_ref ) = @_;
$self->db_trunc();
lib/BioX/CLPM/Engine.pm view on Meta::CPAN
# Add or replace linker from id or name
if ( defined $arg_ref->{linker_id} or defined $arg_ref->{linker_name} ) {
my $linker = $self->linker({ id => $arg_ref->{linker_id},
name => $arg_ref->{linker_name} });
if ( $linker ) { $self->set_linker( $linker ); }
}
# Mark linking aa's
$self->mark_links();
# Cleave sequence into fragments
$self->cleave();
# Calculate masses
$self->masses();
# Cross link
$self->cross_link();
# Match
#$self->match();
lib/BioX/CLPM/Engine.pm view on Meta::CPAN
return \@sequences;
}
# API
sub cleave {
my ( $self, $arg_ref ) = @_;
my $enzyme = $self->get_enzyme();
my $linker = $self->get_linker();
my $missed_clvg = $self->get_missed_clvg();
my @sequences = defined $arg_ref->{sequences} ? @{ $arg_ref->{sequences} } : $self->sequences();
my @fragments;
warn "ENGINE cleave() \n";
my $last_index = 1;
for ( my $i = 0; $i < @sequences; $i++ ) {
@fragments = $self->_cleave({ sequence => $sequences[$i], enzyme => $enzyme });
@fragments = $self->_missed({ fragments => \@fragments, missed_clvg => $missed_clvg });
@fragments = $self->_filter({ fragments => \@fragments, index => $i });
#warn " setting fragments " . join( ', ', @fragments ) . "\n";
my $fragments = BioX::CLPM::Fragments->new({ sequence_id => $sequences[$i]->get_sequence_id(), index => $last_index, type => 'simple' });
foreach my $fragment ( @fragments ) { $fragments->add({ sequence => $fragment }); }
$sequences[$i]->set_fragments( $fragments->get_list() );
$last_index = $fragments->get_index();
}
$self->set_sequences( \@sequences );
return \@sequences;
}
# API
sub masses {
my ( $self, $arg_ref ) = @_;
my %var_mods = defined $arg_ref->{var_mod} ? %{ $arg_ref->{var_mod} } : $self->var_mods();
my @sequences = defined $arg_ref->{sequences} ? @{ $arg_ref->{sequences} } : $self->sequences();
my $aa_masses = $self->_stat_mod();
foreach my $sequence ( @sequences ) {
my @fragments = $sequence->fragments();
for ( my $i = 0; $i < @fragments; $i++ ) {
my $sequence = $fragments[$i]->get_sequence();
my @sequence = split( //, $sequence );
my $counts = {};
my $mass = 0;
foreach my $aa ( @sequence ) {
$aa = uc($aa);
$mass += $aa_masses->{$aa};
$counts->{$aa}++;
}
# Add mass of 1 molecule of water
$mass += 18.010565;
$fragments[$i]->set_mass( $mass );
# Keep counts for aa's affected by var_mod
my $keepers = {};
foreach my $var_mod ( keys %var_mods ) {
$keepers->{$var_mod} = $counts->{$var_mod};
}
$fragments[$i]->set_counts( $keepers );
}
$sequence->set_fragments( \@fragments );
}
$self->set_sequences( \@sequences );
return \@sequences;
}
# API
sub cross_link {
my ( $self, $arg_ref ) = @_;
my $mass = defined $arg_ref->{mass} ? $arg_ref->{mass} : $self->linker()->get_mass();
#my @sequences = defined $arg_ref->{sequences} ? @{ $arg_ref->{sequences} } : $self->sequences();
lib/BioX/CLPM/Engine.pm view on Meta::CPAN
#return \@sequences;
}
# PRIV
sub _ffm {
my ( $self, $arg_ref ) = @_;
my $list1 = defined $arg_ref->{list1} ? $arg_ref->{list1} : [];
my $list2 = defined $arg_ref->{list2} ? $arg_ref->{list2} : [];
my $type = defined $arg_ref->{type} ? $arg_ref->{type} : '';
my $linker = defined $arg_ref->{linker} ? $arg_ref->{linker} : $self->get_linker();
foreach my $frag1 ( @$list1 ) {
foreach my $frag2 ( @$list2 ) {
my $fragments = BioX::CLPM::Fragments->new({ type => 'linked' });
$fragments->add({ fragment_id_1 => $frag1->get_fragment_id(),
fragment_id_2 => $frag2->get_fragment_id(),
mass => $frag1->{mass} + $frag2->{mass} + $linker->get_mass() });
}
}
}
# PRIV
sub _cleave {
my ( $self, $arg_ref ) = @_;
my $sequence = defined $arg_ref->{sequence} ? $arg_ref->{sequence} : '';
my $enzyme = defined $arg_ref->{enzyme} ? $arg_ref->{enzyme} : $self->get_enzyme();
my $clvg_position = $enzyme->get_clvg_position();
my ( $sgn, @chars ) = split( //, $enzyme->get_rule() );
my $length = @chars;
my $rule = join( '', @chars );
my $sequence_str = $sequence->get_cl_sequence();
my @sequence_chars = split( //, $sequence_str );
my $cut = 0;
my ( $fragment, @fragments );
for ( my $i = 0; $i < @sequence_chars; ++$i ){
my $aa = $sequence_chars[$i];
$cut = 0;
$fragment .= $aa;
foreach my $clvg_site( $enzyme->clvg_sites() ){
if ( uc( $aa ) eq $clvg_site ){
my $next_chars = @sequence_chars[$i+1..$i+$length];
unless ( uc( $next_chars ) eq $rule ){
push( @fragments, $fragment );
$fragment='';
}
$cut = 1;
}
}
}
if ( !$cut ) { push( @fragments, $fragment ); }
return @fragments;
}
# PRIV
sub _missed {
my ( $self, $arg_ref ) = @_;
my @fragments = defined $arg_ref->{fragments} ? @{ $arg_ref->{fragments} } : ();
my $missed_clvg = defined $arg_ref->{missed_clvg} ? $arg_ref->{missed_clvg} : 0;
my ( @results, $k );
for ( my $i = $missed_clvg + 1; $i > 1; $i-- ) {
for ( my $j = 0; $j < @fragments - $i + 1; $j++ ) {
my $new_fragment = $fragments[$j];
for ( $k = 0; $k < $i - 1; $k++ ) {
$new_fragment .= $fragments[$j+$k+1];
}
while ( $new_fragment =~ m/[a-z]$/ and $i == $missed_clvg + 1){
if (! $fragments[$j+$k+1] ) { last; }
$new_fragment .= $fragments[$j+$k+1];
$k++;
}
push( @results, $new_fragment );
}
}
push( @fragments, @results );
return @fragments;
}
# PRIV
sub _filter {
my ( $self, $arg_ref ) = @_;
my @fragments = defined $arg_ref->{fragments} ? @{ $arg_ref->{fragments} } : ();
push @fragments, my $final_fragment = pop @fragments;
my $linker = defined $arg_ref->{linker} ? $arg_ref->{linker} : $self->get_linker();
my $index = defined $arg_ref->{index} ? $arg_ref->{index} : 0;
my @ends = $linker->ends();
my $end = $ends[$index];
my @results;
foreach my $fragment ( @fragments ) {
if ( $end ) { if ( $self->_has_lc($fragment) ){ if ( $self->_has_uc_last($fragment) or ( $fragment =~ m/$final_fragment$/ ) ) { push @results, $fragment; } } }
else { if ( $self->_has_uc_last($fragment) or ( $fragment =~ m/$final_fragment$/ ) ) { push @results, $fragment; } }
}
return @results;
}
# PRIV
sub _stat_mod {
my ( $self, $arg_ref ) = @_;
my $aa_masses = defined $arg_ref->{aa_masses} ? $arg_ref->{aa_masses} : $self->load_masses();
switch( $self->get_stat_mod() ) {
case 'carbamidomethylated' { $aa_masses->{'C'} = $aa_masses->{'C2'} }
lib/BioX/CLPM/Engine.pm view on Meta::CPAN
$sql = 'select LAST_INSERT_ID()';
my ( $run_id ) = $self->sqlexec( $sql, '\@@' );
return $run_id;
}
# UTIL
sub db_trunc {
my ( $self ) = @_;
warn "ENGINE db_trunc() \n";
$self->sqlexec("truncate table sequences");
$self->sqlexec("truncate table fragments");
$self->sqlexec("truncate table final_fragment_masses");
$self->sqlexec("truncate table run_data");
$self->sqlexec("truncate table file_masses");
$self->sqlexec("truncate table results");
$self->sqlexec("truncate table precursor_masses");
}
# UTIL
sub get_seq {
my ( $self, $arg_ref ) = @_;
my $file = $arg_ref->{file} ? $arg_ref->{file} : '';
lib/BioX/CLPM/Engine.pm view on Meta::CPAN
tolerance => '500',
missed_clvg => 3,
stat_mod => 'carbamidomethylated',
var_mod => { C => 160.2, M => -90.56 } };
# Create engine
my $engine = BioX::CLPM::Engine->new( $params );
my @sequences = $engine->sequences();
foreach my $sequence ( @sequences ) {
my @fragments = $sequence->fragments();
foreach my $fragment ( @fragments ) {
my %counts = %{ $fragment->get_counts() };
}
}
my $mass = $engine->linker()->get_mass();
my $result = $engine->run();
=head1 DESCRIPTION
lib/BioX/CLPM/Enzyme.pm view on Meta::CPAN
$self->set_clvg_sites($clvg_sites);
$self->set_clvg_position($clvg_position);
$self->set_rule($rule);
warn "ENZYME _load() ( $enzyme_id, $enzyme_name, $clvg_sites, $clvg_position, $rule )\n";
}
}
# API READ ONLY
sub clvg_sites { my ( $self ) = @_; return split( //, $self->get_clvg_sites() ); }
sub generate_fragments {
my ($self, $arg_ref) = @_;
my @clvg_sites;
foreach my $sequence (@$arg_ref->{sequences}){
my @sequence = split(//, $sequence);
my $fragment;
my @initial_fragments;
foreach my $amino_acid (@sequence){
$fragment .= $amino_acid;
foreach my $clvg_site(@clvg_sites){
if (uc($amino_acid) eq $clvg_site){
push(@initial_fragments, $fragment);
$fragment='';
}
}
}
my @all_fragments = @initial_fragments;
for ( my $i = @initial_fragments - 1; $i > 1; $i--){
for ( my $j=0; $j<@initial_fragments-$i+1; $j++){
my $new_fragment = '';
$new_fragment.=$initial_fragments[$j];
for ( my $k=0; $k<$i-1; $k++){
$new_fragment.=$initial_fragments[$j+$k+1];
}
push (@all_fragments, $new_fragment);
}
}
foreach $fragment(@all_fragments){
if ($fragment=~m/.*[a-z]+.*/){
#&SQLExec("insert into fragments(sequence_id, fragment_sequence) values ($sequence_id, '$fragment')");
}
}
}
}
}
1; # Magic true value required at end of module
__END__
=head1 NAME
lib/BioX/CLPM/Fragment.old view on Meta::CPAN
use Class::Std;
use Class::Std::Utils;
use warnings;
use strict;
use Carp;
use version; our $VERSION = qv('0.0.1');
{
my %fragment_id_of :ATTR( :get<fragment_id> :set<fragment_id> :default<''> :init_arg<fragment_id> );
my %sequence_id_of :ATTR( :get<sequence_id> :set<sequence_id> :default<''> :init_arg<sequence_id> );
my %sequence_of :ATTR( :get<sequence> :set<sequence> :default<''> :init_arg<sequence> );
my %mass_of :ATTR( :get<mass> :set<mass> :default<''> :init_arg<mass> );
my %counts_of :ATTR( :get<counts> :set<counts> :default<{}> :init_arg<counts> );
sub START {
my ($self, $ident, $arg_ref) = @_;
#if ( defined $arg_ref->{fragment_id} ) { $self->_load( $arg_ref ); }
return;
}
sub _load {
my ($self, $ident, $arg_ref) = @_;
my $fragment_id = defined $arg_ref->{fragment_id} ?
$arg_ref->{fragment_id} :
$self->get_fragment_id();
if ( defined $arg_ref->{fragment_id} ) {
$self->set_fragment_id($fragment_id);
}
my $sql = 'select sequence_id, sequence, mass ';
$sql .= "from fragments where fragment_id = '$fragment_id'";
my ( $sequence_id, $sequence, $mass) = $self->data->sqlexec( $sql, '@' );
$self->set_sequence_id($sequence_id);
$self->set_sequence($sequence);
$self->set_mass($mass);
}
}
1; # Magic true value required at end of module
__END__
lib/BioX/CLPM/Fragment.old view on Meta::CPAN
indication Whether they are likely to be fixed in an upcoming
release. Also a list of restrictions on the features the module
does provide: data types that cannot be handled, performance issues
and the circumstances in which they may arise, practical
limitations on the size of data sets, special cases that are not
(yet) handled, etc.
No bugs have been reported.
Please report any bugs or feature requests to
C<bug-biox-clpm-fragment@rt.cpan.org>, or through the web interface at
L<http://rt.cpan.org>.
=head1 AUTHOR
Nathan Crabtree C<< <crabtree@cpan.org> >>
=head1 LICENSE AND COPYRIGHT
lib/BioX/CLPM/Fragments.pm view on Meta::CPAN
sub START {
my ($self, $ident, $arg_ref) = @_;
return;
}
sub list { my ( $self ) = @_; return @{ $self->get_list() }; }
sub next_index { my ( $self ) = @_; my $index = $self->get_index(); $self->set_index( $index + 1 ); return $index; }
sub add {
my ( $self, $arg_ref ) = @_;
my @fragments = $self->list();
my $fragment;
if ( $self->get_type() eq 'simple' ) {
my $sequence = defined $arg_ref->{sequence} ? $arg_ref->{sequence} : '';
my $mass = defined $arg_ref->{mass} ? $arg_ref->{mass} : '';
my $fragment_id = defined $arg_ref->{fragment_id} ? $arg_ref->{fragment_id} : $self->next_index();
$fragment = BioX::CLPM::Fragments::Simple->new({
sequence => $sequence,
mass => $mass,
fragment_id => $fragment_id,
sequence_id => $self->get_sequence_id() });
}
elsif ( $self->get_type() eq 'linked' ) {
my $fragment_id_1 = defined $arg_ref->{fragment_id_1} ? $arg_ref->{fragment_id_1} : '';
my $fragment_id_2 = defined $arg_ref->{fragment_id_2} ? $arg_ref->{fragment_id_2} : '';
my $mass = defined $arg_ref->{mass} ? $arg_ref->{mass} : '';
my $mods = defined $arg_ref->{mods} ? $arg_ref->{mods} : '';
$fragment = BioX::CLPM::Fragments::Linked->new({
fragment_id_1 => $fragment_id_1,
fragment_id_2 => $fragment_id_2,
mass => $mass,
mods => $mods });
}
push( @fragments, $fragment );
$self->set_list( \@fragments );
return;
}
}
1; # Magic true value required at end of module
__END__
=head1 NAME
lib/BioX/CLPM/Fragments.pm view on Meta::CPAN
indication Whether they are likely to be fixed in an upcoming
release. Also a list of restrictions on the features the module
does provide: data types that cannot be handled, performance issues
and the circumstances in which they may arise, practical
limitations on the size of data sets, special cases that are not
(yet) handled, etc.
No bugs have been reported.
Please report any bugs or feature requests to
C<bug-biox-clpm-fragments@rt.cpan.org>, or through the web interface at
L<http://rt.cpan.org>.
=head1 AUTHOR
Nathan Crabtree, MidSouth Bioinformatics Center C<< <crabtree@cpan.org> >>
=head1 LICENSE AND COPYRIGHT
lib/BioX/CLPM/Fragments/Linked.pm view on Meta::CPAN
use Class::Std;
use Class::Std::Utils;
use warnings;
use strict;
use Carp;
use version; our $VERSION = qv('0.0.1');
{
my %fragment_id_1_of :ATTR( :get<fragment_id_1> :set<fragment_id_1> :default<''> :init_arg<fragment_id_1> );
my %fragment_id_2_of :ATTR( :get<fragment_id_2> :set<fragment_id_2> :default<''> :init_arg<fragment_id_2> );
my %mass_of :ATTR( :get<mass> :set<mass> :default<''> :init_arg<mass> );
my %mods_of :ATTR( :get<mods> :set<mods> :default<''> :init_arg<mods> );
my %type_of :ATTR( :get<type> :set<type> :default<''> :init_arg<type> );
sub START {
my ($self, $ident, $arg_ref) = @_;
if ( defined $arg_ref->{fragment_id} ) { $self->_load( $arg_ref ); }
return;
}
sub _load {
my ($self, $ident, $arg_ref) = @_;
my $fragment_id = defined $arg_ref->{fragment_id} ?
$arg_ref->{fragment_id} :
$self->get_fragment_id();
if ( defined $arg_ref->{fragment_id} ) {
$self->set_fragment_id($fragment_id);
}
my $sql = 'select sequence_id, sequence, mass ';
$sql .= "from fragments where fragment_id = '$fragment_id'";
my ( $sequence_id, $sequence, $mass) = $self->data->sqlexec( $sql, '@' );
$self->set_sequence_id($sequence_id);
$self->set_sequence($sequence);
$self->set_mass($mass);
}
}
1; # Magic true value required at end of module
__END__
lib/BioX/CLPM/Fragments/Linked.pm view on Meta::CPAN
indication Whether they are likely to be fixed in an upcoming
release. Also a list of restrictions on the features the module
does provide: data types that cannot be handled, performance issues
and the circumstances in which they may arise, practical
limitations on the size of data sets, special cases that are not
(yet) handled, etc.
No bugs have been reported.
Please report any bugs or feature requests to
C<bug-biox-clpm-fragment@rt.cpan.org>, or through the web interface at
L<http://rt.cpan.org>.
=head1 AUTHOR
Nathan Crabtree, MidSouth Bioinformatics Center C<< <crabtree@cpan.org> >>
=head1 LICENSE AND COPYRIGHT
lib/BioX/CLPM/Fragments/Simple.pm view on Meta::CPAN
use Class::Std;
use Class::Std::Utils;
use warnings;
use strict;
use Carp;
use version; our $VERSION = qv('0.0.1');
{
my %fragment_id_of :ATTR( :get<fragment_id> :set<fragment_id> :default<''> :init_arg<fragment_id> );
my %sequence_id_of :ATTR( :get<sequence_id> :set<sequence_id> :default<''> :init_arg<sequence_id> );
my %sequence_of :ATTR( :get<sequence> :set<sequence> :default<''> :init_arg<sequence> );
my %mass_of :ATTR( :get<mass> :set<mass> :default<''> :init_arg<mass> );
my %counts_of :ATTR( :get<counts> :set<counts> :default<{}> :init_arg<counts> );
sub START {
my ($self, $ident, $arg_ref) = @_;
#if ( defined $arg_ref->{fragment_id} ) { $self->_load( $arg_ref ); }
return;
}
sub _load {
my ($self, $ident, $arg_ref) = @_;
my $fragment_id = defined $arg_ref->{fragment_id} ?
$arg_ref->{fragment_id} :
$self->get_fragment_id();
if ( defined $arg_ref->{fragment_id} ) {
$self->set_fragment_id($fragment_id);
}
my $sql = 'select sequence_id, sequence, mass ';
$sql .= "from fragments where fragment_id = '$fragment_id'";
my ( $sequence_id, $sequence, $mass) = $self->data->sqlexec( $sql, '@' );
$self->set_sequence_id($sequence_id);
$self->set_sequence($sequence);
$self->set_mass($mass);
}
}
1; # Magic true value required at end of module
__END__
lib/BioX/CLPM/Fragments/Simple.pm view on Meta::CPAN
indication Whether they are likely to be fixed in an upcoming
release. Also a list of restrictions on the features the module
does provide: data types that cannot be handled, performance issues
and the circumstances in which they may arise, practical
limitations on the size of data sets, special cases that are not
(yet) handled, etc.
No bugs have been reported.
Please report any bugs or feature requests to
C<bug-biox-clpm-fragment@rt.cpan.org>, or through the web interface at
L<http://rt.cpan.org>.
=head1 AUTHOR
Nathan Crabtree, MidSouth Bioinformatics Center C<< <crabtree@cpan.org> >>
=head1 LICENSE AND COPYRIGHT
lib/BioX/CLPM/Sequence.pm view on Meta::CPAN
use strict;
use Carp;
use version; our $VERSION = qv('0.0.1');
{
my %sequence_of :ATTR( :get<sequence> :set<sequence> :default<''> :init_arg<sequence> );
my %sequence_id_of :ATTR( :get<sequence_id> :set<sequence_id> :default<''> :init_arg<sequence_id> );
my %cl_sequence_of :ATTR( :get<cl_sequence> :set<cl_sequence> :default<''> :init_arg<cl_sequence> );
my %ann_cl_sequence_of :ATTR( :get<ann_cl_sequence> :set<ann_cl_sequence> :default<''> :init_arg<ann_cl_sequence> );
my %fragments_of :ATTR( :get<fragments> :set<fragments> :default<[]> :init_arg<fragments> );
sub START {
my ( $self, $ident, $arg_ref ) = @_;
if ( $arg_ref ) { $self->_load( $arg_ref ); }
return;
}
sub fragments { my ( $self ) = @_; return @{ $self->get_fragments() }; }
sub _load {
my ( $self, $arg_ref ) = @_;
#my $sequence_id = defined $arg_ref->{sequence_id} ?
if ( defined $arg_ref->{sequence_id} ) {
$self->_load_from_db( $arg_ref );
}
elsif ( defined $arg_ref->{sequence} ) {
# $self->_load_from_sequence( $arg_ref );
}
scripts/run.pp view on Meta::CPAN
missed_clvg => 3,
stat_mod => 'carbamidomethylated',
var_mod => { C => 160.2, M => -90.56 } };
# Create engine
my $engine = BioX::CLPM::Engine->new( $params );
my @sequences = $engine->sequences();
foreach my $sequence ( @sequences ) {
warn "RUN sequence->get_cl_sequence " . $sequence->get_cl_sequence() . "\n";
my @fragments = $sequence->fragments();
foreach my $fragment ( @fragments ) {
warn "RUN fragment_id " . $fragment->get_fragment_id() . "\n";
warn "RUN mass " . $fragment->get_mass() . "\n";
my %counts = %{ $fragment->get_counts() };
warn "RUN vmass " . join( ':', keys %counts) . "," . join( ':', values %counts ) . "\n";
}
}
my $mass = $engine->linker()->get_mass();
warn "RUN linker mass " . $mass . "\n";
exit;