Mercurial > repos > cpt > cpt_psm_plotter
comparison lib/CPT/External/LipoP.pm @ 1:8691c1c61a8e draft default tip
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
author | cpt |
---|---|
date | Mon, 05 Jun 2023 02:48:47 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
0:54c7a3ea81e2 | 1:8691c1c61a8e |
---|---|
1 package CPT::External::LipoP; | |
2 no warnings; | |
3 use Moose; | |
4 use File::Temp qw(tempfile); | |
5 use IPC::Run qw(run); | |
6 | |
7 has 'sequence' => ( is => 'rw', isa => 'Str' ); | |
8 has 'response' => ( is => 'rw', isa => 'Str' ); | |
9 has 'cleavage' => ( is => 'rw', isa => 'ArrayRef' ); | |
10 has 'tmpfile' => (is => 'rw', isa => 'Any'); | |
11 | |
12 sub create_fasta_file { | |
13 my ( $self, $seq ) = @_; | |
14 my ( $fh, $filename ) = tempfile( "cpt.lipop.XXXXXXX", UNLINK => 1 ); | |
15 | |
16 #printf $fh ">%s\n%s\n", 'seq', $seq; | |
17 printf $fh "%s\n", $seq; | |
18 close($fh); | |
19 return $filename; | |
20 } | |
21 | |
22 sub parse_text { | |
23 my ($self) = @_; | |
24 | |
25 foreach my $line ( split( /\n/, $self->response() ) ) { | |
26 if ( $line =~ /#.*cleavage=(\d+)-(\d+)/ ) { | |
27 $self->cleavage( [ $1, $2 ] ); | |
28 } | |
29 } | |
30 # # seq SpII score=17.8897 margin=13.48964 cleavage=19-20 Pos+2=K | |
31 # # Cut-off=-3 | |
32 # seq LipoP1.0:Best SpII 1 1 17.8897 | |
33 # seq LipoP1.0:Margin SpII 1 1 13.48964 | |
34 # seq LipoP1.0:Class SpI 1 1 4.40006 | |
35 # seq LipoP1.0:Class CYT 1 1 -0.200913 | |
36 # seq LipoP1.0:Signal CleavII 19 20 17.8897 # LVVSA|CKSPP Pos+2=K | |
37 # seq LipoP1.0:Signal CleavI 28 29 4.03409 # PPVQS|QRPEP | |
38 # seq LipoP1.0:Signal CleavI 21 22 2.04071 # VSACK|SPPPV | |
39 # seq LipoP1.0:Signal CleavI 27 28 -2.07502 # PPPVQ|SQRPE | |
40 # seq LipoP1.0:Signal CleavI 19 20 -2.6907 # LVVSA|CKSPP | |
41 # seq LipoP1.0:Signal CleavI 22 23 -2.87659 # SACKS|PPPVQ | |
42 } | |
43 | |
44 sub analyze { | |
45 my ( $self, $seq ) = @_; | |
46 $self->sequence($seq); | |
47 $self->tmpfile($self->create_fasta_file($seq)); | |
48 my @cmd = ( 'LipoP', $self->tmpfile(), '-workdir', '/tmp/nonexistant/', '-wwwdir', '/tmp/nonexistant' ); | |
49 my ( $in, $out, $err ); | |
50 run \@cmd, \$in, \$out, \$err; | |
51 if ($err) { print "Error: $err\n"; } | |
52 $self->response($out); | |
53 $self->parse_text(); | |
54 unlink($self->tmpfile()); | |
55 } | |
56 | |
57 sub cleanup { | |
58 my ($self) = @_; | |
59 return; | |
60 } | |
61 | |
62 | |
63 no Moose; | |
64 1; | |
65 | |
66 __END__ | |
67 | |
68 =pod | |
69 | |
70 =encoding UTF-8 | |
71 | |
72 =head1 NAME | |
73 | |
74 CPT::External::LipoP | |
75 | |
76 =head1 VERSION | |
77 | |
78 version 1.99.4 | |
79 | |
80 =head1 AUTHOR | |
81 | |
82 Eric Rasche <rasche.eric@yandex.ru> | |
83 | |
84 =head1 COPYRIGHT AND LICENSE | |
85 | |
86 This software is Copyright (c) 2014 by Eric Rasche. | |
87 | |
88 This is free software, licensed under: | |
89 | |
90 The GNU General Public License, Version 3, June 2007 | |
91 | |
92 =cut |