| 1 | #!/usr/bin/env perl | ||
| 2 | # PODNAME: HmmCleaner.pl | ||
| 3 | # ABSTRACT: Removing low similarity segments from your MSA | ||
| 4 | |||
| 5 | use Modern::Perl; | ||
| 6 | use Getopt::Euclid; | ||
| 7 | |||
| 8 | ## no critic (RequireLocalizedPunctuationVars) | ||
| 9 | BEGIN{ | ||
| 10 | $ENV{Smart_Comments} = $ARGV{-v} | ||
| 11 | ? join q{ }, map { '#' x (2 + $_) } 1..$ARGV{-v} | ||
| 12 | : q{} | ||
| 13 | ; | ||
| 14 | } | ||
| 15 | ## use critic | ||
| 16 | use Smart::Comments -ENV; | ||
| 17 | |||
| 18 | use Bio::MUST::Apps::HmmCleaner; | ||
| 19 | use aliased 'Bio::MUST::Apps::HmmCleaner'; | ||
| 20 | |||
| 21 | ### Lauching script... | ||
| 22 | |||
| 23 | ###### %ARGV | ||
| 24 | |||
| 25 | my %costs_values = ( | ||
| 26 | 'default' => [-0.15, -0.08, 0.15, 0.45], | ||
| 27 | 'large' => [-0.175, -0.04, 0.15, 0.4], | ||
| 28 | 'specificity' => [-0.125, -0.07, 0.175, 0.4], | ||
| 29 | 'large_specificity' => [-0.125, -0.03, 0.15, 0.4], | ||
| 30 | ); | ||
| 31 | |||
| 32 | my $costs = $costs_values{'default'}; | ||
| 33 | $costs = $costs_values{'large'} if ($ARGV{'--large'}); | ||
| 34 | $costs = $costs_values{'specificity'} if ($ARGV{'--specificity'}); | ||
| 35 | $costs = $costs_values{'large_specificity'} if ( $ARGV{'--large'} && $ARGV{'--specificity'}); | ||
| 36 | $costs = [$ARGV{'-costs'}{'c1'}, $ARGV{'-costs'}{'c2'}, $ARGV{'-costs'}{'c3'}, $ARGV{'-costs'}{'c4'}] if ($ARGV{'-costs'}); | ||
| 37 | |||
| 38 | #### $costs | ||
| 39 | |||
| 40 | for my $file ( @{$ARGV{'<infiles>'}} ) { | ||
| 41 | my $args = { | ||
| 42 | ali => $file, | ||
| 43 | ali_model => $file, | ||
| 44 | threshold => 1, | ||
| 45 | changeID => $ARGV{'--changeID'}, | ||
| 46 | #~ delchar => $ARGV{'-delchar'}, | ||
| 47 | costs => $costs, | ||
| 48 | consider_X => ($ARGV{'--noX'}) ? 0 : 1, | ||
| 49 | perseq_profile => ($ARGV{'-profile'} eq 'leave-one-out') ? 1 : 0, | ||
| 50 | outfile_type => ($ARGV{'--ali'}) ? 1 : 0, | ||
| 51 | debug_mode => ($ARGV{'-v'}>5) ? 1 : 0, | ||
| 52 | symfrac => $ARGV{'-symfrac'}, | ||
| 53 | }; | ||
| 54 | |||
| 55 | ### Creating object for file : $file | ||
| 56 | my $cleaner = HmmCleaner->new($args); | ||
| 57 | |||
| 58 | ($ARGV{'--log_only'}) ? $cleaner->store_log : $cleaner->store_all; | ||
| 59 | |||
| 60 | } | ||
| 61 | |||
| 62 | ### End of script... | ||
| 63 | |||
| 64 | __END__ | ||
| 65 | |||
| 66 | =pod | ||
| 67 | |||
| 68 | =encoding UTF-8 | ||
| 69 | |||
| 70 | =head1 NAME | ||
| 71 | |||
| 72 | HmmCleaner.pl - Removing low similarity segments from your MSA | ||
| 73 | |||
| 74 | =head1 VERSION | ||
| 75 | |||
| 76 | version 0.180750 | ||
| 77 | |||
| 78 | =head1 USAGE | ||
| 79 | |||
| 80 | HmmCleaner.pl <infiles> [-costs <c1> <c2> <c3> <c4> --changeID --noX --ali --log-only] | ||
| 81 | |||
| 82 | =head1 REQUIRED ARGUMENTS | ||
| 83 | |||
| 84 | =over | ||
| 85 | |||
| 86 | =item <infiles> | ||
| 87 | |||
| 88 | list of alignment file to check with HmmCleaner | ||
| 89 | |||
| 90 | =for Euclid: infiles.type: readable | ||
| 91 | repeatable | ||
| 92 | |||
| 93 | =back | ||
| 94 | |||
| 95 | =head1 OPTIONS | ||
| 96 | |||
| 97 | =over | ||
| 98 | |||
| 99 | =item -costs <c1> <c2> <c3> <c4> | ||
| 100 | |||
| 101 | Cost parameters that defines the low similarity segments detected by HmmCleaner. | ||
| 102 | Default values are -0.15, -0.08, 0.15, 0.45 | ||
| 103 | Users can change each value but they have to be in increasing order. | ||
| 104 | c1 < c2 < 0 < c3 < c4 | ||
| 105 | Predefine value are also available with --large and --specificity options but | ||
| 106 | user defined costs will be prioritary if present. | ||
| 107 | |||
| 108 | =for Euclid: c1.type: number < 0 | ||
| 109 | c2.type: number < 0 | ||
| 110 | c3.type: number > 0 | ||
| 111 | c4.type: number > 0 | ||
| 112 | |||
| 113 | =item --changeID | ||
| 114 | |||
| 115 | Determine if output will have defline with generic suffix (_hmmcleaned) | ||
| 116 | |||
| 117 | =item --noX | ||
| 118 | |||
| 119 | Convert X characters to gaps that will not be taken into account by HmmCleaner. | ||
| 120 | |||
| 121 | =item -symfrac <symfrac> | ||
| 122 | |||
| 123 | Handle the symfrac option of hmmbuild modifying the required fraction of sequences | ||
| 124 | to consider a position as a consensus column | ||
| 125 | |||
| 126 | =for Euclid: symfrac.type: 0+num, symfrac <=1 | ||
| 127 | symfrac.default: 0.5 | ||
| 128 | symfrac.type.error: <symfrac> must be between 0 and 1 | ||
| 129 | |||
| 130 | =item -profile=<profile> | ||
| 131 | |||
| 132 | Determine how the profile will be create | ||
| 133 | complete or leave-one-out (default: complete) | ||
| 134 | leave-one-out = without the analyzed sequence (new profile each time) | ||
| 135 | complete = all sequences (same profile for each sequence) | ||
| 136 | First case is more sensitive but need more ressources (hence more time) | ||
| 137 | |||
| 138 | =for Euclid: profile.type: /complete|leave-one-out/ | ||
| 139 | profile.type.error: <profile> must be either "leave-one-out" or "complete" | ||
| 140 | profile.default: 'complete' | ||
| 141 | |||
| 142 | =item --large | ||
| 143 | |||
| 144 | Load predifined cost parameters optimized for MSA with at least 50 sequences. | ||
| 145 | Can be use with --specificity option. | ||
| 146 | User defined costs will be prioritary if present. | ||
| 147 | |||
| 148 | =item --specificity | ||
| 149 | |||
| 150 | Load predifined cost parameters optimized to give more weigth on specificity. | ||
| 151 | Can be use with --large option. | ||
| 152 | User defined costs will be prioritary if present. | ||
| 153 | |||
| 154 | =item --log_only | ||
| 155 | |||
| 156 | Only outputs list of segments removed. | ||
| 157 | |||
| 158 | =item --ali | ||
| 159 | |||
| 160 | Outputs result file(s) in ali MUST format. | ||
| 161 | |||
| 162 | =item -v[erbosity]=<level> | ||
| 163 | |||
| 164 | Verbosity level for logging to STDERR [default: 0]. Available levels range from | ||
| 165 | 0 to 5. | ||
| 166 | |||
| 167 | =for Euclid: level.type: int, level >= 0 && level <= 5 | ||
| 168 | level.default: 0 | ||
| 169 | |||
| 170 | =item --version | ||
| 171 | |||
| 172 | =item --usage | ||
| 173 | |||
| 174 | =item --help | ||
| 175 | |||
| 176 | =item --man | ||
| 177 | |||
| 178 | Print the usual program information | ||
| 179 | |||
| 180 | =back | ||
| 181 | |||
| 182 | =head1 AUTHOR | ||
| 183 | |||
| 184 | Arnaud Di Franco <arnaud.difranco@gmail.fr> | ||
| 185 | |||
| 186 | =head1 COPYRIGHT AND LICENSE | ||
| 187 | |||
| 188 | This software is copyright (c) 2018 by Arnaud Di Franco. | ||
| 189 | |||
| 190 | This is free software; you can redistribute it and/or modify it under | ||
| 191 | the same terms as the Perl 5 programming language system itself. | ||
| 192 | |||
| 193 | =cut |