1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712
|
# -*-Perl-*- Test Harness script for Bioperl
use strict;
use warnings;
BEGIN {
use lib '.';
use Bio::Root::Test;
test_begin( -tests => 824 );
use_ok('Bio::SearchIO');
}
my $searchio = Bio::SearchIO->new(
-format => 'hmmer',
-file => test_input_file('hmmpfam.out')
);
my $result;
while ( $result = $searchio->next_result ) {
is( ref($result),
'Bio::Search::Result::HMMERResult',
'Check for the correct result reference type'
);
is( $result->algorithm, 'HMMPFAM', 'Check algorithm' );
is( $result->algorithm_version, '2.1.1', 'Check algorithm version' );
is( $result->hmm_name, 'pfam', 'Check hmm_name' );
is( $result->sequence_file,
'/home/birney/src/wise2/example/road.pep',
'Check sequence_file'
);
is( $result->query_name, 'roa1_drome', 'Check query_name' );
is( $result->query_length, 0, 'Check query_length absence' );
is( $result->query_description, '', 'Check query_description' );
is( $result->num_hits(), 2, 'Check num_hits' );
my ( $hsp, $hit );
if ( defined( $hit = $result->next_model ) ) {
is( ref($hit), 'Bio::Search::Hit::HMMERHit',
'Check for the correct hit reference type' );
is( $hit->name, 'SEED', 'Check hit name' );
is( $hit->description,
'',
'Check for hit description'
);
is( $hit->raw_score, 146.1, 'Check hit raw_score' );
is( $hit->bits, 0, 'Check hit bits (0)' );
float_is( $hit->significance, 6.3e-40, 'Check hit significance' );
is( $hit->num_hsps, 1, 'Check num_hsps' );
# Query and Hit lengths are usually unknown in HMMER,
# but sometimes they can be deduced from domain data '[]'
is( $hit->length, 77, 'Check hit length' );
is( $hit->frac_aligned_query, undef );
is( $hit->frac_aligned_hit, '1.00' );
is( $hit->matches('cons'), 55, 'Check hit total conserved residues' );
is( $hit->matches('id'), 22, 'Check hit total identical residues' );
is( sprintf( "%.3f", $hit->frac_identical('query') ), '0.310' );
is( sprintf( "%.3f", $hit->frac_identical('hit') ), 0.286 );
is( sprintf( "%.3f", $hit->frac_identical('total') ), 0.282 );
is( sprintf( "%.3f", $hit->frac_conserved('query') ), 0.775 );
is( sprintf( "%.3f", $hit->frac_conserved('hit') ), 0.714 );
is( sprintf( "%.3f", $hit->frac_conserved('total') ), 0.705 );
if ( defined( $hsp = $hit->next_domain ) ) {
is( ref($hsp), 'Bio::Search::HSP::HMMERHSP',
'Check for correct hsp reference type' );
is( $hsp->query->seq_id(), 'roa1_drome', 'Check for query seq_id' );
is( $hsp->hit->seq_id(), 'SEED', 'Check for hit seq_id' );
is( $hsp->hit->start, 1, 'Check for hit hmmfrom value' );
is( $hsp->hit->end, 77, 'Check for hit hmm to value' );
is( $hsp->query->start, 33, 'Check for query alifrom value' );
is( $hsp->query->end, 103, 'Check for query ali to value' );
is( $hsp->score, 71.2, 'Check for hsp score' );
is( $hsp->bits, 0, 'Check for hsp bits (0)' );
float_is( $hsp->evalue, 2.2e-17, 'Check for hsp c-Evalue' );
is( $hsp->length('query'), 71, 'Check for hsp query length' );
is( $hsp->length('hit'), 77, 'Check for hsp hit length' );
is( $hsp->length('total'), 78, 'Check for hsp total length' );
is( $hsp->gaps('query'), 7, 'Check for hsp query gaps' );
is( $hsp->gaps('hit'), 1, 'Check for hsp hit gaps' );
is( $hsp->gaps('total'), 8, 'Check for hsp total gaps' );
($hit->length == 0) ?
is( $hsp->{HIT_LENGTH}, $hsp->hit->length, 'Check hit length consistency' )
: is( $hsp->{HIT_LENGTH}, $hit->length, 'Check hit length consistency' );
($result->query_length == 0) ?
is( $hsp->{QUERY_LENGTH}, $hsp->query->length, 'Check query length consistency' )
: is( $hsp->{QUERY_LENGTH}, $result->query_length, 'Check query length consistency' );
is( $hsp->num_conserved, 55 );
is( $hsp->num_identical, 22 );
is( sprintf( "%.2f", $hsp->percent_identity ), 28.21 );
is( sprintf( "%.3f", $hsp->frac_identical('query') ), '0.310' );
is( sprintf( "%.3f", $hsp->frac_identical('hit') ), 0.286 );
is( sprintf( "%.3f", $hsp->frac_identical('total') ), 0.282 );
is( sprintf( "%.3f", $hsp->frac_conserved('query') ), 0.775 );
is( sprintf( "%.3f", $hsp->frac_conserved('hit') ), 0.714 );
is( sprintf( "%.3f", $hsp->frac_conserved('total') ), 0.705 );
is( $hsp->query_string,
'LFIGGLDYRTTDENLKAHFEKWGNIVDVVVMKD-----PRTKRSRGFGFITYSHSSMIDEAQK--SRpHKIDGRVVEP',
'Check for query string'
);
is( $hsp->hit_string,
'lfVgNLppdvteedLkdlFskfGpivsikivrDiiekpketgkskGfaFVeFeseedAekAlealnG-kelggrklrv',
'Check for hit string'
);
is( $hsp->homology_string,
'lf+g+L + +t+e Lk++F+k G iv++ +++D + t++s+Gf+F+++ ++ + A + +++++gr+++ ',
'Check for homology string'
);
is( length( $hsp->homology_string ),
length( $hsp->hit_string ),
'Check if homology string and hit string have an equal length'
);
is( length( $hsp->query_string ),
length( $hsp->homology_string ),
'Check if query string and homology string have an equal length'
);
# This Hmmpfam don't have PP or CS strings, these are tests to check for side effects
is( $hsp->posterior_string, '' );
is( $hsp->consensus_string, '' );
}
}
if ( defined( $hit = $result->next_model ) ) {
is( ref($hit), 'Bio::Search::Hit::HMMERHit',
'Check for the correct hit reference type' );
is( $hit->name, 'SEED', 'Check hit name' );
is( $hit->description, '', 'Check for hit description' );
is( $hit->raw_score, 146.1, 'Check hit raw_score' );
is( $hit->bits, 0, 'Check hit bits (0)' );
float_is( $hit->significance, 6.3e-040, 'Check hit significance' );
is( $hit->num_hsps, 1, 'Check num_hsps' );
# Query and Hit lengths are usually unknown in HMMER,
# but sometimes they can be deduced from domain data '[]'
is( $hit->length, 77, 'Check hit length' );
is( $hit->frac_aligned_query, undef );
is( $hit->frac_aligned_hit, '1.00' );
is( $hit->matches('cons'), 56, 'Check hit total conserved residues' );
is( $hit->matches('id'), 33, 'Check hit total identical residues' );
is( sprintf( "%.3f", $hit->frac_identical('query') ), 0.471 );
is( sprintf( "%.3f", $hit->frac_identical('hit') ), 0.429 );
is( sprintf( "%.3f", $hit->frac_identical('total') ), 0.429 );
is( sprintf( "%.3f", $hit->frac_conserved('query') ), '0.800' );
is( sprintf( "%.3f", $hit->frac_conserved('hit') ), 0.727 );
is( sprintf( "%.3f", $hit->frac_conserved('total') ), 0.727 );
if ( defined( $hsp = $hit->next_domain ) ) {
is( ref($hsp), 'Bio::Search::HSP::HMMERHSP',
'Check for correct hsp reference type' );
is( $hsp->query->seq_id(), 'roa1_drome', 'Check for query seq_id' );
is( $hsp->hit->seq_id(), 'SEED', 'Check for hit seq_id' );
is( $hsp->hit->start, 1, 'Check for hit hmmfrom value' );
is( $hsp->hit->end, 77, 'Check for hit hmm to value' );
is( $hsp->query->start, 124, 'Check for query alifrom value' );
is( $hsp->query->end, 193, 'Check for query ali to value' );
is( $hsp->score, 75.5, 'Check for hsp score' );
is( $hsp->bits, 0, 'Check for hsp bits (0)' );
float_is( $hsp->evalue, 1.1e-18, 'Check for hsp c-Evalue' );
is( $hsp->length('query'), 70, 'Check for hsp query length' );
is( $hsp->length('hit'), 77, 'Check for hsp hit length' );
is( $hsp->length('total'), 77, 'Check for hsp total length' );
is( $hsp->gaps('query'), 7, 'Check for hsp query gaps' );
is( $hsp->gaps('hit'), 0, 'Check for hsp hit gaps' );
is( $hsp->gaps('total'), 7, 'Check for hsp total gaps' );
($hit->length == 0) ?
is( $hsp->{HIT_LENGTH}, $hsp->hit->length, 'Check hit length consistency' )
: is( $hsp->{HIT_LENGTH}, $hit->length, 'Check hit length consistency' );
($result->query_length == 0) ?
is( $hsp->{QUERY_LENGTH}, $hsp->query->length, 'Check query length consistency' )
: is( $hsp->{QUERY_LENGTH}, $result->query_length, 'Check query length consistency' );
is( $hsp->num_conserved, 56 );
is( $hsp->num_identical, 33 );
is( sprintf( "%.2f", $hsp->percent_identity ), 42.86 );
is( sprintf( "%.3f", $hsp->frac_identical('query') ), 0.471 );
is( sprintf( "%.3f", $hsp->frac_identical('hit') ), 0.429 );
is( sprintf( "%.3f", $hsp->frac_identical('total') ), 0.429 );
is( sprintf( "%.3f", $hsp->frac_conserved('query') ), '0.800' );
is( sprintf( "%.3f", $hsp->frac_conserved('hit') ), 0.727 );
is( sprintf( "%.3f", $hsp->frac_conserved('total') ), 0.727);
is( $hsp->query_string,
'LFVGALKDDHDEQSIRDYFQHFGNIVDINIVID-----KETGKKRGFAFVEFDDYDPVDKVVL--KQHQLNGKMVDV',
'Check for query string'
);
is( $hsp->hit_string,
'lfVgNLppdvteedLkdlFskfGpivsikivrDiiekpketgkskGfaFVeFeseedAekAlealnGkelggrklrv',
'Check for hit string'
);
is( $hsp->homology_string,
'lfVg L d +e+ ++d+F++fG iv+i+iv+D ketgk +GfaFVeF++++ ++k + ++l+g+ + v',
'Check for homology string'
);
is( length( $hsp->homology_string ),
length( $hsp->hit_string ),
'Check if homology string and hit string have an equal length'
);
is( length( $hsp->query_string ),
length( $hsp->homology_string ),
'Check if query string and homology string have an equal length'
);
}
last;
}
}
$searchio = Bio::SearchIO->new(
-format => 'hmmer',
-file => test_input_file('hmmsearch.out')
);
while ( $result = $searchio->next_result ) {
is( ref($result),
'Bio::Search::Result::HMMERResult',
'Check for the correct result reference type'
);
is( $result->algorithm, 'HMMSEARCH', 'Check algorithm' );
is( $result->algorithm_version, '2.0', 'Check algorithm version' );
is( $result->hmm_name, 'HMM [SEED]', 'Check hmm_name' );
is( $result->sequence_file, 'HMM.dbtemp.29591', 'Check sequence_file' );
is( $result->database_name, 'HMM.dbtemp.29591', 'Check database_name' );
is( $result->query_name, 'SEED', 'Check query_name' );
is( $result->query_length, 77, 'Check query_length' );
is( $result->query_description, '', 'Check query_description' );
is( $result->num_hits(), 1215, 'Check num_hits' );
my $hit = $result->next_model;
is( ref($hit), 'Bio::Search::Hit::HMMERHit',
'Check for the correct hit reference type' );
is( $hit->name, 'Q91581', 'Check hit name' );
is( $hit->description,
'Q91581 POLYADENYLATION FACTOR 64 KDA SUBUN',
'Check for hit description'
);
is( $hit->raw_score, 119.7, 'Check hit raw_score' );
is( $hit->bits, 0, 'Check hit bits (0)' );
float_is( $hit->significance, 2e-31, 'Check hit significance' );
is( $hit->num_hsps, 1, 'Check num_hsps' );
is( $hit->length, 0, 'Check hit length' );
my $hsp = $hit->next_domain;
is( ref($hsp), 'Bio::Search::HSP::HMMERHSP',
'Check for correct hsp reference type' );
is( $hsp->query->seq_id(), 'SEED', 'Check for query seq_id' );
is( $hsp->hit->seq_id(), 'Q91581', 'Check for hit seq_id' );
is( $hsp->hit->start, 18, 'Check for hit hmmfrom value' );
is( $hsp->hit->end, 89, 'Check for hit hmm to value' );
is( $hsp->query->start, 1, 'Check for query alifrom value' );
is( $hsp->query->end, 77, 'Check for query ali to value' );
is( $hsp->score, 119.7, 'Check for hsp score' );
is( $hsp->bits, 0, 'Check for hsp bits (0)' );
float_is( $hsp->evalue, 2e-31, 'Check for hsp c-Evalue' );
is( $hsp->length('query'), 77, 'Check for hsp query length' );
is( $hsp->length('hit'), 72, 'Check for hsp hit length' );
is( $hsp->length('total'), 0, 'Check for hsp total length' );
is( $hsp->gaps('query'), 0, 'Check for hsp query gaps' );
is( $hsp->gaps('hit'), 0, 'Check for hsp hit gaps' );
is( $hsp->gaps('total'), 0, 'Check for hsp total gaps' );
my $example_counter = 0;
while ($hit = $result->next_model) {
if ($hit->name eq 'Q61954') {
$example_counter++;
if ($example_counter == 1) {
# Query and Hit lengths are usually unknown in HMMER,
# but sometimes they can be deduced from domain data '[]'
is( $hit->length, 153, 'Check hit length' );
is( $hit->frac_aligned_query, '1.00' );
is( $hit->frac_aligned_hit, 0.42 );
$hsp = $hit->next_domain;
is( $hsp->query->seq_id(), 'SEED', 'Check for query seq_id' );
is( $hsp->hit->seq_id(), 'Q61954', 'Check for hit seq_id' );
is( $hsp->hit->start, 26, 'Check for hit hmmfrom value' );
is( $hsp->hit->end, 89, 'Check for hit hmm to value' );
is( $hsp->query->start, 1, 'Check for query alifrom value' );
is( $hsp->query->end, 77, 'Check for query ali to value' );
is( $hsp->score, 72.9, 'Check for hsp score' );
is( $hsp->bits, 0, 'Check for hsp bits (0)' );
float_is( $hsp->evalue, 2.4e-17, 'Check for hsp c-Evalue' );
is( $hsp->length('query'), 77, 'Check for hsp query length' );
is( $hsp->length('hit'), 64, 'Check for hsp hit length' );
is( $hsp->length('total'), 0, 'Check for hsp total length' );
is( $hsp->gaps('query'), 0, 'Check for hsp query gaps' );
is( $hsp->gaps('hit'), 0, 'Check for hsp hit gaps' );
is( $hsp->gaps('total'), 0, 'Check for hsp total gaps' );
}
elsif ($example_counter == 2) {
# Query and Hit lengths are usually unknown in HMMER,
# but sometimes they can be deduced from domain data '[]'
is( $hit->length, 153, 'Check hit length' );
is( $hit->frac_aligned_query, '1.00' );
is( $hit->frac_aligned_hit, 0.34 );
$hsp = $hit->next_domain;
is( $hsp->query->seq_id(), 'SEED', 'Check for query seq_id' );
is( $hsp->hit->seq_id(), 'Q61954', 'Check for hit seq_id' );
is( $hsp->hit->start, 102, 'Check for hit hmmfrom value' );
is( $hsp->hit->end, 153, 'Check for hit hmm to value' );
is( $hsp->query->start, 1, 'Check for query alifrom value' );
is( $hsp->query->end, 77, 'Check for query ali to value' );
is( $hsp->score, 3.3, 'Check for hsp score' );
is( $hsp->bits, 0, 'Check for hsp bits (0)' );
float_is( $hsp->evalue, 1.9, 'Check for hsp c-Evalue' );
is( $hsp->length('query'), 77, 'Check for hsp query length' );
is( $hsp->length('hit'), 52, 'Check for hsp hit length' );
is( $hsp->length('total'), 0, 'Check for hsp total length' );
is( $hsp->gaps('query'), 0, 'Check for hsp query gaps' );
is( $hsp->gaps('hit'), 0, 'Check for hsp hit gaps' );
is( $hsp->gaps('total'), 0, 'Check for hsp total gaps' );
last;
}
}
}
}
$searchio = Bio::SearchIO->new(
-format => 'hmmer',
-file => test_input_file('L77119.hmmer')
);
while ( $result = $searchio->next_result ) {
is( ref($result),
'Bio::Search::Result::HMMERResult',
'Check for the correct result reference type'
);
is( $result->algorithm, 'HMMPFAM', 'Check algorithm' );
is( $result->algorithm_version, '2.2g', 'Check algorithm version' );
is( $result->hmm_name, 'Pfam', 'Check hmm_name' );
is( $result->sequence_file, 'L77119.faa', 'Check sequence_file' );
is( $result->query_name,
'gi|1522636|gb|AAC37060.1|',
'Check query_name'
);
is( $result->query_length, 0, 'Check query_length absence' );
is( $result->query_description,
'M. jannaschii predicted coding region MJECS02 [Methanococcus jannaschii]',
'Check query_description'
);
is( $result->num_hits(), 1, 'Check num_hits' );
my $hit = $result->next_hit;
is( ref($hit), 'Bio::Search::Hit::HMMERHit',
'Check for the correct hit reference type' );
is( $hit->name, 'Methylase_M', 'Check hit name' );
is( $hit->description,
'Type I restriction modification system, M',
'Check for hit description'
);
is( $hit->raw_score, -105.2, 'Check hit raw_score' );
is( $hit->bits, 0, 'Check hit bits (0)' );
float_is( $hit->significance, 0.0022, 'Check hit significance' );
is( $hit->num_hsps, 1, 'Check num_hsps' );
# Query and Hit lengths are usually unknown in HMMER,
# but sometimes they can be deduced from domain data '[]'
is( $hit->length, 279, 'Check hit length' );
is( $hit->frac_aligned_query, undef );
is( $hit->frac_aligned_hit, '1.00' );
is( $hit->matches('cons'), 133, 'Check hit total conserved residues' );
is( $hit->matches('id'), 48, 'Check hit total identical residues' );
is( sprintf( "%.3f", $hit->frac_identical('query') ), 0.238 );
is( sprintf( "%.3f", $hit->frac_identical('hit') ), 0.172 );
is( sprintf( "%.3f", $hit->frac_identical('total') ), 0.171 );
is( sprintf( "%.3f", $hit->frac_conserved('query') ), 0.658 );
is( sprintf( "%.3f", $hit->frac_conserved('hit') ), 0.477 );
is( sprintf( "%.3f", $hit->frac_conserved('total') ), 0.475 );
my $hsp = $hit->next_hsp;
is( ref($hsp), 'Bio::Search::HSP::HMMERHSP',
'Check for correct hsp reference type' );
is( $hsp->query->seq_id(), 'gi|1522636|gb|AAC37060.1|', 'Check for query seq_id' );
is( $hsp->hit->seq_id(), 'Methylase_M', 'Check for hit seq_id' );
is( $hsp->hit->start, 1, 'Check for hit hmmfrom value' );
is( $hsp->hit->end, 279, 'Check for hit hmm to value' );
is( $hsp->query->start, 280, 'Check for query alifrom value' );
is( $hsp->query->end, 481, 'Check for query ali to value' );
is( $hsp->score, -105.2, 'Check for hsp score' );
is( $hsp->bits, 0, 'Check for hsp bits (0)' );
float_is( $hsp->evalue, 0.0022, 'Check for hsp evalue' );
is( $hsp->length('query'), 202, 'Check for hsp query length' );
is( $hsp->length('hit'), 279, 'Check for hsp hit length' );
is( $hsp->length('total'), 280, 'Check for hsp total length' );
is( $hsp->gaps('query'), 78, 'Check for hsp query gaps' );
is( $hsp->gaps('hit'), 1, 'Check for hsp hit gaps' );
is( $hsp->gaps('total'), 79, 'Check for hsp total gaps' );
($hit->length == 0) ?
is( $hsp->{HIT_LENGTH}, $hsp->hit->length, 'Check hit length consistency' )
: is( $hsp->{HIT_LENGTH}, $hit->length, 'Check hit length consistency' );
($result->query_length == 0) ?
is( $hsp->{QUERY_LENGTH}, $hsp->query->length, 'Check query length consistency' )
: is( $hsp->{QUERY_LENGTH}, $result->query_length, 'Check query length consistency' );
is( $hsp->num_conserved, 133 );
is( $hsp->num_identical, 48 );
is( sprintf( "%.2f", $hsp->percent_identity ), 17.14 );
is( sprintf( "%.3f", $hsp->frac_identical('query') ), 0.238 );
is( sprintf( "%.3f", $hsp->frac_identical('hit') ), 0.172 );
is( sprintf( "%.3f", $hsp->frac_identical('total') ), 0.171 );
is( sprintf( "%.3f", $hsp->frac_conserved('query') ), 0.658 );
is( sprintf( "%.3f", $hsp->frac_conserved('hit') ), 0.477 );
is( sprintf( "%.3f", $hsp->frac_conserved('total') ), 0.475 );
is (length($hsp->homology_string), length($hsp->query_string));
is( $hsp->hit_string,
'lrnELentLWavADkLRGsmDaseYKdyVLGLlFlKYiSdkFlerrieieerktdtesepsldyakledqyeqlededlekedfyqkkGvFilPsqlFwdfikeaeknkldedigtdldkifseledqialgypaSeedfkGlfpdldfnsnkLgskaqarnetLtelidlfselelgtPmHNG-dfeelgikDlfGDaYEYLLgkFAeneGKsGGeFYTPqeVSkLiaeiLtigqpsegdfsIYDPAcGSGSLllqaskflgehdgkrnaisyYGQEsn',
'Check for hiy string'
);
is( $hsp->query_string,
'NTSELDKKKFAVLLMNR--------------LIFIKFLEDK------GIV---------PRDLLRRTYEDY---KKSNVLI-NYYDAY-L----KPLFYEVLNTPEDER--KENIRT-NPYYKDIPYL---N-G-------GLFRSNNV--PNELSFTIKDNEIIGEVINFLERYKFTLSTSEGsEEVELNP-DILGYVYEKLINILAEKGQKGLGAYYTPDEITSYIAKNT-IEPIVVE----------------RFKEIIK--NWKINDINF----ST',
'Check for query string'
);
is( $hsp->homology_string,
' ++EL+++ av+ R L+F K++ dk +i+ p + + +++y ++ ++ ++y ++ + lF++++ e ++ ++++ + + ++ + + Glf ++++ ++ +s+ +ne ++e+i+ +++ +++ G++ +el D++G +YE L+ Ae K+ G +YTP e++ ia+ + i+ ++ +++ ++ k+n+i + s+',
'Check for homology string'
);
is( join( ' ', $hsp->seq_inds( 'query', 'nomatch', 1 ) ),
'280 288 289 293-295 300 304 311 313-315 317 324-326 332 335 337 344-346 348 355 358-361 364-366 372 379 383-385 389 396 400 404-408 412 416 417 422 426 429-431 434-436 439 441 446 450 451 455 459 460 463 464 468 471 472 478',
'Check for nomatch indices in query'
);
is( join( ' ', $hsp->seq_inds( 'hit', 'nomatch', 1 ) ),
'1 9 10 14-16 18-31 35 39 42-47 51-59 61 63-65 67 72-74 77-79 82 86 89-94 96 103-105 107 110 111 116 118 120-123 126-131 133 135-141 145 150 151 154 158-160 164 171 175 179-183 187 191-193 198 202 205-207 210-212 215 217 222 226 227 231 233 236 237 240-257 261 264-267 273 275-278',
'Check for nomatch indices in hit'
);
is( join( ' ', $hsp->seq_inds( 'query', 'gap', 1 ) ),
'296 306 309 321 328 334 335 350 356 366-368 376 417 456 463 470 479',
'Check for gap indices in query'
);
is( join( ' ', $hsp->seq_inds( 'hit', 'gap', 1 ) ),
'', 'Check for gap indices in hit' );
}
$searchio = Bio::SearchIO->new(
-format => 'hmmer',
-file => test_input_file('cysprot1b.hmmsearch')
);
while ( $result = $searchio->next_result ) {
is( ref($result),
'Bio::Search::Result::HMMERResult',
'Check for the correct result reference type'
);
is( $result->algorithm, 'HMMSEARCH', 'Check algorithm' );
is( $result->algorithm_version, '2.2g', 'Check algorithm version' );
is( $result->hmm_name,
'Peptidase_C1.hmm [Peptidase_C1]',
'Check hmm_name'
);
is( $result->database_name, 'cysprot1b.fa', 'Check database_name' );
is( $result->sequence_file, 'cysprot1b.fa', 'Check sequence_file' );
is( $result->query_name, 'Peptidase_C1', 'Check query_name' );
is( $result->query_length, 337, 'Check query_length' );
is( $result->query_accession, 'PF00112', 'Check query_accession' );
is( $result->query_description,
'Papain family cysteine protease',
'Check query_description'
);
is( $result->num_hits(), 4, 'Check num_hits' );
my $hit = $result->next_hit;
is( ref($hit), 'Bio::Search::Hit::HMMERHit',
'Check for the correct hit reference type' );
is( $hit->name, 'CATL_RAT', 'Check hit name' );
is( $hit->description,
'',
'Check for hit description'
);
is( $hit->raw_score, 449.4, 'Check hit raw_score' );
is( $hit->bits, 0, 'Check hit bits (0)' );
float_is( $hit->significance, 2e-135, 'Check hit significance' );
is( $hit->num_hsps, 1, 'Check num_hsps' );
# Query and Hit lengths are usually unknown in HMMER,
# but sometimes they can be deduced from domain data '[]'
is( $hit->length, 0, 'Check hit length absence' );
is( $hit->frac_aligned_query, '1.00' );
is( $hit->frac_aligned_hit, undef );
is( $hit->matches('cons'), 204, 'Check hit total conserved residues' );
is( $hit->matches('id'), 131, 'Check hit total identical residues' );
is( sprintf( "%.3f", $hit->frac_identical('query') ), 0.389 );
is( sprintf( "%.3f", $hit->frac_identical('hit') ), 0.598 );
is( sprintf( "%.3f", $hit->frac_identical('total') ), 0.389 );
is( sprintf( "%.3f", $hit->frac_conserved('query') ), 0.605 );
is( sprintf( "%.3f", $hit->frac_conserved('hit') ), 0.932 );
is( sprintf( "%.3f", $hit->frac_conserved('total') ), 0.605 );
my $hsp = $hit->next_hsp;
is( ref($hsp), 'Bio::Search::HSP::HMMERHSP',
'Check for correct hsp reference type' );
is( $hsp->query->seq_id(), 'Peptidase_C1', 'Check for query seq_id' );
is( $hsp->hit->seq_id(), 'CATL_RAT', 'Check for hit seq_id' );
is( $hsp->hit->start, 114, 'Check for hit hmmfrom value' );
is( $hsp->hit->end, 332, 'Check for hit hmm to value' );
is( $hsp->query->start, 1, 'Check for query alifrom value' );
is( $hsp->query->end, 337, 'Check for query ali to value' );
is( $hsp->score, 449.4, 'Check for hsp score' );
is( $hsp->bits, 0, 'Check for hsp bits (0)' );
float_is( $hsp->evalue, 2e-135, 'Check for hsp evalue' );
is( $hsp->length('query'), 337, 'Check for hsp query length' );
is( $hsp->length('hit'), 219, 'Check for hsp hit length' );
is( $hsp->length('total'), 337, 'Check for hsp total length' );
is( $hsp->gaps('query'), 0, 'Check for hsp query gaps' );
is( $hsp->gaps('hit'), 118, 'Check for hsp hit gaps' );
is( $hsp->gaps('total'), 118, 'Check for hsp total gaps' );
($hit->length == 0) ?
is( $hsp->{HIT_LENGTH}, $hsp->hit->length, 'Check hit length consistency' )
: is( $hsp->{HIT_LENGTH}, $hit->length, 'Check hit length consistency' );
($result->query_length == 0) ?
is( $hsp->{QUERY_LENGTH}, $hsp->query->length, 'Check query length consistency' )
: is( $hsp->{QUERY_LENGTH}, $result->query_length, 'Check query length consistency' );
is( $hsp->num_conserved, 204 );
is( $hsp->num_identical, 131 );
is( sprintf( "%.2f", $hsp->percent_identity ), 38.87 );
is( sprintf( "%.3f", $hsp->frac_identical('query') ), 0.389 );
is( sprintf( "%.3f", $hsp->frac_identical('hit') ), 0.598 );
is( sprintf( "%.3f", $hsp->frac_identical('total') ), 0.389 );
is( sprintf( "%.3f", $hsp->frac_conserved('query') ), 0.605 );
is( sprintf( "%.3f", $hsp->frac_conserved('hit') ), 0.932 );
is( sprintf( "%.3f", $hsp->frac_conserved('total') ), 0.605 );
is (length($hsp->homology_string), length($hsp->query_string));
is( $hsp->hit_string,
'IPKTVDWRE-KG-CVTPVKNQG-QCGSCWAFSASGCLEGQMFLKT------GKLISLSEQNLVDCSH-DQGNQ------GCNG-GLMDFAFQYIKE-----NGGLDSEESY-----PYE----AKD-------------------GSCKYR-AEYAV-----ANDTGFVDIPQQ-----EKALMKAVATVGPISVAMDASHPS---LQFYSSG-------IYYEP---NCSSK---DLDHGVLVVGYGYEG-T------------------------------------DSNKDKYWLVKNSWGKEWGMDGYIKIAKDRN----NHCGLATAASYPI',
'Check for hiy string'
);
is( $hsp->homology_string,
'+P+++DWRe kg VtpVK+QG qCGSCWAFSa g lEg+ ++kt gkl+sLSEQ+LvDC++ d gn+ GCnG Glmd Af+Yik+ NgGl++E++Y PY+ +kd g+Cky+ + ++ a+++g++d+p++ E+al+ka+a++GP+sVa+das+ s q+Y+sG +Y+++ C+++ +LdH+Vl+VGYG e+ ++++ +YW+VKNSWG++WG++GY++ia+++n n+CG+a+ asypi',
'Check for homology string'
);
is( $hsp->query_string,
'lPesfDWReWkggaVtpVKdQGiqCGSCWAFSavgalEgryciktgtkawggklvsLSEQqLvDCdgedygnngesCGyGCnGGGlmdnAfeYikkeqIsnNgGlvtEsdYekgCkPYtdfPCgkdggndtyypCpgkaydpndTgtCkynckknskypktyakikgygdvpynvsTydEealqkalaknGPvsVaidasedskgDFqlYksGendvgyGvYkhtsageCggtpfteLdHAVliVGYGteneggtfdetssskksesgiqvssgsngssgSSgssgapiedkgkdYWIVKNSWGtdWGEnGYfriaRgknksgkneCGIaseasypi',
'Check for query string'
);
# Hmmsearch2 don't have PP or CS strings, these are tests to check for side effects
is( $hsp->posterior_string, '' );
is( $hsp->consensus_string, '' );
$hit = $result->next_hit;
is( $hit->name, 'CATL_HUMAN', 'Check hit name' );
is( $hit->description, '', 'Check for hit description' );
is( $hit->raw_score, 444.5, 'Check hit raw_score' );
is( $hit->bits, 0, 'Check hit bits (0)' );
float_is( $hit->significance, 6.1e-134, 'Check hit significance' );
}
# test for bug 2632 - CS lines are captured without breaking the parser
$searchio = Bio::SearchIO->new(
-format => 'hmmer',
-file => test_input_file('hmmpfam_cs.out')
);
if (defined ($result = $searchio->next_result) ) {
my $hit = $result->next_hit;
my $hsp = $hit->next_hsp;
is ($hsp->seq_str, $hsp->query_string);
is (length($hsp->seq_str), length($hsp->query_string));
is (length($hsp->homology_string), length($hsp->query_string));
is (length($hsp->consensus_string), length($hsp->query_string));
is( $hsp->consensus_string,
'EEEEEEEEETSSHSBHHHHHHHHHHHHHGGGGSSCSTTSSCECEEEEEEECTCCCHHHHHHHCT----S GC-EEEEEEE-SSHHHHHHHHHHHHHHHHHTT-EEEEEEE--B-GGGS-HHHHHC--EEEEEEEE-TT--HHHHHHCEEEEECHSCHHHHTHHH. BEEEEEESSEEEEEECC-GGGHHHHBHGGGSTTEEBSEEEEEECESSSSSCTGGGSSCEEECCCTTCEEEEEEEEETTTHHHHHHHHHHTSCCCSSTTCGHHHHCC-SSS-TTSCHHHHHHHHHHHHHHTT--HHHHHHHHS----TT-GGGTST-HHHHHHHHHHHHHHCCHCCEEEEEEETSSEEEEEEETTTSCESEEEEEEEEEE.TTEEEEEESSC',
'Check for consensus structure string'
);
is( $hsp->seq_str,
'CGV-GFIADVNNVANHKIVVQALEALTCMEHRGACSADRDSGDGAGITTAIPWNLFQKSLQNQNIKFEQnDSVGVGMLFLPAHKLKES--KLIIETVLKEENLEIIGWRLVPTVQEVLGKQAYLNKPHVEQVFCKSSNLSKDRLEQQLFLVRKKIEKYIGINGKDwaheFYICSLSCYTIVYKGMMRSAVLGQFYQDLYHSEYTSSFAIYHRRFSTNTMPKWPLAQPMR---------FVSHNGEINTLLGNLNWMQSREPLLQSKVWKDRIHELKPITNKDNSDSANLDAAVELLIASGRSPEEALMILVPEAFQNQPDFA-NNTEISDFYEYYSGLQEPWDGPALVVFTNGKV-IGATLDRNGL-RPARYVIT----KDNLVIVSSES',
'Check for hsp seq_str'
);
is( $hsp->query_string,
'CGV-GFIADVNNVANHKIVVQALEALTCMEHRGACSADRDSGDGAGITTAIPWNLFQKSLQNQNIKFEQnDSVGVGMLFLPAHKLKES--KLIIETVLKEENLEIIGWRLVPTVQEVLGKQAYLNKPHVEQVFCKSSNLSKDRLEQQLFLVRKKIEKYIGINGKDwaheFYICSLSCYTIVYKGMMRSAVLGQFYQDLYHSEYTSSFAIYHRRFSTNTMPKWPLAQPMR---------FVSHNGEINTLLGNLNWMQSREPLLQSKVWKDRIHELKPITNKDNSDSANLDAAVELLIASGRSPEEALMILVPEAFQNQPDFA-NNTEISDFYEYYSGLQEPWDGPALVVFTNGKV-IGATLDRNGL-RPARYVIT----KDNLVIVSSES',
'Check for query string'
);
is( $hsp->hit_string,
'CGvlGfiAhikgkpshkivedaleaLerLeHRGavgADgktGDGAGIltqiPdgFFrevakelGieLpe-gqYAVGmvFLPqdelaraearkifEkiaeeeGLeVLGWReVPvnnsvLGetAlatePvIeQvFvgapsgdgedfErrLyviRkrieksivaenvn----fYiCSLSsrTIVYKGMLtseQLgqFYpDLqderfeSalAivHsRFSTNTfPsWplAQPfRVnslwgggivlAHNGEINTlrgNrnwMraRegvlksplFgddldkLkPIvneggSDSaalDnvlEllvraGRslpeAlMMlIPEAWqnnpdmdkdrpekraFYeylsglmEPWDGPAalvftDGryavgAtLDRNGLTRPaRygiTrdldkDglvvvaSEa',
'Check for hit string'
);
is( $hsp->homology_string,
'CGv GfiA+ ++ ++hkiv +aleaL+++eHRGa++AD ++GDGAGI t+iP+++F++ ++++i++ ++ +VGm+FLP l+ + i+E +++ee+Le++GWR VP+ +vLG++A + P++eQvF+ +++ +++ +E++L+++Rk+iek+i+ + + ++fYiCSLS++TIVYKGM++s++LgqFY+DL++++++S++Ai+H+RFSTNT+P+WplAQP+R ++ HNGEINTl gN nwM++Re +l+s++++d++++LkPI n+++SDSa+lD ++Ell+++GRs++eAlM+l+PEA+qn+pd +++e+ +FYey+sgl+EPWDGPA++vft+G++ +gAtLDRNGL RPaRy+iT kD+lv+v+SE+',
'Check for homology string'
);
}
# Tests for hmmer3 output here
$searchio = Bio::SearchIO->new(
-format => 'hmmer',
-file => test_input_file('hmmscan.out'),
-verbose => 1
);
is( ref($searchio), 'Bio::SearchIO::hmmer3',
'Check if correct searchio object is returned' );
my $counter = 0;
while ( $result = $searchio->next_result ) {
$counter++;
if ($counter == 1) {
is( ref($result),
'Bio::Search::Result::HMMERResult',
'Check for the correct result reference type'
);
is( $result->algorithm, 'HMMSCAN', 'Check algorithm' );
is( $result->algorithm_version, '3.0', 'Check algorithm version' );
is( $result->hmm_name,
'/data/biodata/HMMerDB/Pfam.hmm',
'Check hmm_name'
);
is( $result->sequence_file,
'BA000019.orf1.fasta',
'Check sequence_file'
);
is( $result->query_name, 'BA000019.orf1', 'Check query_name' );
is( $result->query_length, 198, 'Check query_length' );
is( $result->query_accession, '', 'Check query_accession' );
is( $result->query_description, '', 'Check query_description' );
# 1 hit above and 6 below inclusion threshold
is( $result->num_hits(), 7, 'Check num_hits' );
my ( $hsp, $hit );
if ( $hit = $result->next_model ) {
is( ref($hit), 'Bio::Search::Hit::HMMERHit',
'Check for the correct hit reference type' );
is( $hit->name, 'Peripla_BP_2', 'Check hit name' );
is( $hit->description,
'Periplasmic binding protein',
'Check for hit description'
);
is( $hit->raw_score, 105.2, 'Check hit raw_score' );
is( $hit->bits, 0, 'Check hit bits (0)' );
float_is( $hit->significance, 6e-30, 'Check hit significance' );
is( $hit->num_hsps, 1, 'Check num_hsps' );
# Hit length is usually unknown for HMMSCAN and HMMSEARCH but not for NHMMER.
# When is not known, sometimes it can be deduced from domain data '[]'
is( $hit->length, 0, 'Check hit length absence' );
is( $hit->frac_aligned_query, 0.87 );
is( $hit->frac_aligned_hit, undef );
if ( defined( $hsp = $hit->next_domain ) ) {
is( ref($hsp), 'Bio::Search::HSP::HMMERHSP',
'Check for correct hsp reference type' );
is( $hsp->hit->seq_id(), 'Peripla_BP_2', 'Check for hit seq_id' );
is( $hsp->query->seq_id(), 'BA000019.orf1', 'Check for query seq_id' );
is( $hsp->hit->start, 59, 'Check for hit hmmfrom value' );
is( $hsp->hit->end, 236, 'Check for hit hmm to value' );
is( $hsp->query->start, 2, 'Check for query alifrom value' );
is( $hsp->query->end, 173, 'Check for query ali to value' );
is( $hsp->score, '105.0', 'Check for hsp score' );
is( $hsp->bits, 0, 'Check for hsp bits (0)' );
float_is( $hsp->evalue, 1.5e-33, 'Check for hsp c-Evalue' );
is( $hsp->length('query'), 172, 'Check for hsp query length' );
is( $hsp->length('hit'), 178, 'Check for hsp hit length' );
is( $hsp->length('total'), 180, 'Check for hsp total length' );
is( $hsp->gaps('query'), 8, 'Check for hsp query gaps' );
is( $hsp->gaps('hit'), 2, 'Check for hsp hit gaps' );
is( $hsp->gaps('total'), 10, 'Check for hsp total gaps' );
($hit->length == 0) ?
is( $hsp->{HIT_LENGTH}, $hsp->hit->length, 'Check hit length consistency' )
: is( $hsp->{HIT_LENGTH}, $hit->length, 'Check hit length consistency' );
($result->query_length == 0) ?
is( $hsp->{QUERY_LENGTH}, $hsp->query->length, 'Check query length consistency' )
: is( $hsp->{QUERY_LENGTH}, $result->query_length, 'Check query length consistency' );
is( $hsp->num_conserved, 140 );
is( $hsp->num_identical, 50 );
is( sprintf( "%.2f", $hsp->percent_identity ), 27.78 );
is( sprintf( "%.3f", $hsp->frac_identical('query') ), 0.291 );
is( sprintf( "%.3f", $hsp->frac_identical('hit') ), 0.281 );
is( sprintf( "%.3f", $hsp->frac_identical('total') ), 0.278 );
is( sprintf( "%.3f", $hsp->frac_conserved('query') ), 0.814 );
is( sprintf( "%.3f", $hsp->frac_conserved('hit') ), 0.787 );
is( sprintf( "%.3f", $hsp->frac_conserved('total') ), 0.778 );
is (length($hsp->homology_string), length($hsp->query_string));
is( $hsp->query_string,
'LKPDLIIGREYQ---KNIYNQLSNFAPTVLVDWGSF-TSFQDNFRYIAQVLNEEEQGKLVLQQYQKRIRDLQDRMGERlQKIEVSVIGFSGQSIKSLNR-DAVFNQVLDDAGIKRIsIQKNQQERYLEISIENLNKYDADVLFVINE---SKEQLYPDLKNPLWHHLRAVKKQQVYVVNQ',
'Check for query string'
);
is( $hsp->hit_string,
'lkPDlvivsafgalvseieellelgipvvavessstaeslleqirllgellgeedeaeelvaelesridavkaridsl-kpktvlvfgyadegikvvfgsgswvgdlldaaggeni-iaeakgseseeisaEqilaadpdviivsgrgedtktgveelkenplwaelpAvkngrvyllds',
'Check for hit string'
);
is( $hsp->homology_string,
'lkPDl+i+ +++ ++i+++l++ +p+v v+ s+ s+++ +r ++++l+ee++++ + +++++ri+++++r + ++ +v+v+g+++ +ik+++ + ++++ld+ag++ i i++++++ + eis+E+++++d+dv++v k+ + ++nplw +l+Avk+++vy++++',
'Check for homology string'
);
is( $hsp->posterior_string,
'8***********...********************9.*****************************************999999999999997777776.5678999999****99777777*************************...77777777899***************9976',
'Check for posterior probability string'
);
}
}
}
# Check for errors in HSP caused by the existence of 2 hits with the same ID
elsif ($counter == 2) {
is( $result->algorithm, 'HMMSCAN', 'Check algorithm' );
is( $result->algorithm_version, '3.0', 'Check algorithm version' );
is( $result->hmm_name,
'/data/biodata/HMMerDB/Pfam.hmm',
'Check hmm_name'
);
is( $result->sequence_file,
'BA000019.orf1.fasta',
'Check sequence_file'
);
is( $result->query_name, 'lcl|Test_ID.1|P1', 'Check query_name' );
is( $result->query_length, 463, 'Check query_length' );
is( $result->query_description, '281521..282909', 'Check query_description' );
is( $result->num_hits(), 2, 'Check num_hits' );
my ( $hsp, $hit );
my $hit_counter = 0;
while ( $hit = $result->next_model ) {
$hit_counter++;
if ($hit_counter == 1) {
is( ref($hit), 'Bio::Search::Hit::HMMERHit',
'Check for the correct hit reference type' );
is( $hit->name, 'IS4.original', 'Check hit name' );
is( $hit->description, '', 'Check for hit description' );
is( $hit->num_hsps, 1, 'Check num_hsps' );
if ( defined( $hsp = $hit->next_domain ) ) {
is( ref($hsp), 'Bio::Search::HSP::HMMERHSP',
'Check for correct hsp reference type' );
is( $hsp->hit->seq_id(), 'IS4.original', 'Check for hit seq_id' );
is( $hsp->query->seq_id(), 'lcl|Test_ID.1|P1', 'Check for query seq_id' );
is( $hsp->hit->start, 315, 'Check for hit hmmfrom value' );
is( $hsp->hit->end, 353, 'Check for hit hmm to value' );
is( $hsp->query->start, 335, 'Check for query alifrom value' );
is( $hsp->query->end, 369, 'Check for query ali to value' );
is( $hsp->score, 18.9, 'Check for hsp score' );
is( $hsp->bits, 0, 'Check for hsp bits (0)' );
float_is( $hsp->evalue, 8.9e-08, 'Check for hsp c-Evalue' );
}
}
elsif ($hit_counter == 2) {
is( ref($hit), 'Bio::Search::Hit::HMMERHit',
'Check for the correct hit reference type' );
is( $hit->name, 'IS4.original', 'Check hit name' );
is( $hit->description, '', 'Check for hit description' );
is( $hit->num_hsps, 1, 'Check num_hsps' );
if ( defined( $hsp = $hit->next_domain ) ) {
is( ref($hsp), 'Bio::Search::HSP::HMMERHSP',
'Check for correct hsp reference type' );
is( $hsp->hit->seq_id(), 'IS4.original', 'Check for hit seq_id' );
is( $hsp->query->seq_id(), 'lcl|Test_ID.1|P1', 'Check for query seq_id' );
is( $hsp->hit->start, 315, 'Check for hit hmmfrom value' );
is( $hsp->hit->end, 353, 'Check for hit hmm to value' );
is( $hsp->query->start, 335, 'Check for query alifrom value' );
is( $hsp->query->end, 369, 'Check for query ali to value' );
is( $hsp->score, 18.8, 'Check for hsp score' );
is( $hsp->bits, 0, 'Check for hsp bits (0)' );
float_is( $hsp->evalue, 9e-08, 'Check for hsp c-Evalue' );
}
}
}
}
}
$searchio = Bio::SearchIO->new(
-format => 'hmmer',
-file => test_input_file('hmmsearch3.out'),
-verbose => 1
);
while ( $result = $searchio->next_result ) {
is( ref($result),
'Bio::Search::Result::HMMERResult',
'Check for the correct result reference type'
);
is( $result->algorithm, 'HMMSEARCH', 'Check algorithm' );
is( $result->algorithm_version, '3.0', 'Check algorithm version' );
is( $result->hmm_name, 'Kv9.hmm', 'Check hmm_name' );
is( $result->sequence_file,
'/home/pboutet/Desktop/databases/nr_May26',
'Check sequence_file'
);
is( $result->query_name, 'Kv9', 'Check query_name' );
is( $result->query_length, '481', 'Check query_length' );
is( $result->query_description, '', 'Check query_description' );
is( $result->num_hits(), 2, 'Check num_hits' );
while ( my $hit = $result->next_model ) {
}
}
$searchio = Bio::SearchIO->new(
-format => 'hmmer',
-file => test_input_file('hmmsearch3_multi.out'),
-verbose => 1
);
is( ref($searchio), 'Bio::SearchIO::hmmer3',
'Check if correct searchio object is returned' );
$counter = 0;
while ( $result = $searchio->next_result ) {
$counter++;
if ($counter == 1) {
is( ref($result),
'Bio::Search::Result::HMMERResult',
'Check for the correct result reference type'
);
is( $result->algorithm, 'HMMSEARCH', 'Check algorithm' );
is( $result->algorithm_version, '3.0', 'Check algorithm version' );
is( $result->hmm_name, 'Pfam-A.hmm', 'Check hmm_name' );
is( $result->sequence_file, 'test_seqs.seq_raw.txt', 'Check sequence_file' );
is( $result->query_name, '1-cysPrx_C', 'Check query_name' );
is( $result->query_length, 40, 'Check query_length' );
is( $result->query_accession, 'PF10417.4', 'Check query_accession' );
is( $result->query_description,
'C-terminal domain of 1-Cys peroxiredoxin',
'Check query_description'
);
is( $result->num_hits(), 0, 'Check num_hits' );
}
elsif ($counter == 2) {
is( ref($result),
'Bio::Search::Result::HMMERResult',
'Check for the correct result reference type'
);
is( $result->algorithm, 'HMMSEARCH', 'Check algorithm' );
is( $result->algorithm_version, '3.0', 'Check algorithm version' );
is( $result->hmm_name, 'Pfam-A.hmm', 'Check hmm_name' );
is( $result->sequence_file, 'test_seqs.seq_raw.txt', 'Check sequence_file' );
is( $result->query_name, 'DUF4229', 'Check query_name' );
is( $result->query_length, 69, 'Check query_length' );
is( $result->query_accession, 'PF14012.1', 'Check query_accession' );
is( $result->query_description,
'Protein of unknown function (DUF4229)',
'Check query_description'
);
is( $result->num_hits(), 1, 'Check num_hits' );
my ( $hsp, $hit );
if ( $hit = $result->next_model ) {
is( ref($hit), 'Bio::Search::Hit::HMMERHit',
'Check for the correct hit reference type' );
is( $hit->name, 'lcl|Protein_ID1.3|M3', 'Check hit name' );
is( $hit->description,
'complement(48376..51420)',
'Check for hit description'
);
is( $hit->raw_score, -17.8, 'Check hit raw_score' );
is( $hit->bits, 0, 'Check hit bits (0)' );
float_is( $hit->significance, 3, 'Check hit significance' );
is( $hit->num_hsps, 5, 'Check num_hsps' );
# Check first HSP
if ( defined( $hsp = $hit->next_domain ) ) {
is( ref($hsp), 'Bio::Search::HSP::HMMERHSP',
'Check for correct hsp reference type' );
is( $hsp->hit->seq_id(), 'lcl|Protein_ID1.3|M3', 'Check for hit seq_id' );
is( $hsp->query->seq_id(), 'DUF4229', 'Check for query seq_id' );
is( $hsp->hit->start, 305, 'Check for hit alifrom value' );
is( $hsp->hit->end, 311, 'Check for hit ali to value' );
is( $hsp->query->start, 34, 'Check for query hmmfrom value' );
is( $hsp->query->end, 40, 'Check for query hmm to value' );
is( $hsp->score, -4.3, 'Check for hsp score' );
is( $hsp->bits, 0, 'Check for hsp bits (0)' );
float_is( $hsp->evalue, 1, 'Check for hsp c-Evalue' );
is( $hsp->length('query'), 7, 'Check for hsp query length' );
is( $hsp->length('hit'), 7, 'Check for hsp hit length' );
is( $hsp->length('total'), 7, 'Check for hsp total length' );
is( $hsp->gaps('query'), 0, 'Check for hsp query gaps' );
is( $hsp->gaps('hit'), 0, 'Check for hsp hit gaps' );
is( $hsp->gaps('total'), 0, 'Check for hsp total gaps' );
($hit->length == 0) ?
is( $hsp->{HIT_LENGTH}, $hsp->hit->length, 'Check hit length consistency' )
: is( $hsp->{HIT_LENGTH}, $hit->length, 'Check hit length consistency' );
($result->query_length == 0) ?
is( $hsp->{QUERY_LENGTH}, $hsp->query->length, 'Check query length consistency' )
: is( $hsp->{QUERY_LENGTH}, $result->query_length, 'Check query length consistency' );
is( $hsp->num_conserved, 6 );
is( $hsp->num_identical, 4 );
is( sprintf( "%.2f", $hsp->percent_identity ), 57.14 );
is( sprintf( "%.3f", $hsp->frac_identical('query') ), 0.571 );
is( sprintf( "%.3f", $hsp->frac_identical('hit') ), 0.571 );
is( sprintf( "%.3f", $hsp->frac_identical('total') ), 0.571 );
is( sprintf( "%.3f", $hsp->frac_conserved('query') ), 0.857 );
is( sprintf( "%.3f", $hsp->frac_conserved('hit') ), 0.857 );
is( sprintf( "%.3f", $hsp->frac_conserved('total') ), 0.857 );
is (length($hsp->homology_string), length($hsp->query_string));
is( $hsp->consensus_string,
'',
'Check for consensus structure string'
);
is( $hsp->query_string,
'laallAl',
'Check for query string'
);
is( $hsp->hit_string,
'LAILSAI',
'Check for hit string'
);
is( $hsp->homology_string,
'la+l A+',
'Check for homology string'
);
is( $hsp->posterior_string,
'3333332',
'Check for posterior probability string'
);
}
}
}
elsif ($counter == 3) {
is( ref($result),
'Bio::Search::Result::HMMERResult',
'Check for the correct result reference type'
);
is( $result->algorithm, 'HMMSEARCH', 'Check algorithm' );
is( $result->algorithm_version, '3.0', 'Check algorithm version' );
is( $result->hmm_name, 'Pfam-A.hmm', 'Check hmm_name' );
is( $result->sequence_file, 'test_seqs.seq_raw.txt', 'Check sequence_file' );
is( $result->query_name, 'ACR_tran', 'Check query_name' );
is( $result->query_length, 1021, 'Check query_length' );
is( $result->query_accession, 'PF00873.14', 'Check query_accession' );
is( $result->query_description,
'AcrB/AcrD/AcrF family',
'Check query_description'
);
is( $result->num_hits(), 1, 'Check num_hits' );
my ( $hsp, $hit );
if ( $hit = $result->next_model ) {
is( ref($hit), 'Bio::Search::Hit::HMMERHit',
'Check for the correct hit reference type' );
is( $hit->name, 'lcl|Protein_ID1.3|M3', 'Check hit name' );
is( $hit->description,
'complement(48376..51420)',
'Check for hit description'
);
is( $hit->raw_score, 616.9, 'Check hit raw_score' );
is( $hit->bits, 0, 'Check hit bits (0)' );
float_is( $hit->significance, 9.3e-189, 'Check hit significance' );
is( $hit->num_hsps, 1, 'Check num_hsps' );
# Hit length is usually unknown for HMMSCAN and HMMSEARCH but not for NHMMER.
# When is not known, sometimes it can be deduced from domain data '[]'
is( $hit->length, 0, 'Check hit length absence' );
is( $hit->frac_aligned_query, 0.93 );
is( $hit->frac_aligned_hit, undef );
if ( defined( $hsp = $hit->next_domain ) ) {
is( ref($hsp), 'Bio::Search::HSP::HMMERHSP',
'Check for correct hsp reference type' );
is( $hsp->hit->seq_id(), 'lcl|Protein_ID1.3|M3', 'Check for hit seq_id' );
is( $hsp->query->seq_id(), 'ACR_tran', 'Check for query seq_id' );
is( $hsp->hit->start, 11, 'Check for hit alifrom value' );
is( $hsp->hit->end, 1000, 'Check for hit ali to value' );
is( $hsp->query->start, 71, 'Check for query hmmfrom value' );
is( $hsp->query->end, 1021, 'Check for query hmm to value' );
is( $hsp->score, 616.6, 'Check for hsp score' );
is( $hsp->bits, 0, 'Check for hsp bits (0)' );
float_is( $hsp->evalue, 3.9e-189, 'Check for hsp c-Evalue' );
is( $hsp->length('query'), 951, 'Check for hsp query length' );
is( $hsp->length('hit'), 990, 'Check for hsp hit length' );
is( $hsp->length('total'), 1003, 'Check for hsp total length' );
is( $hsp->gaps('query'), 52, 'Check for hsp query gaps' );
is( $hsp->gaps('hit'), 13, 'Check for hsp hit gaps' );
is( $hsp->gaps('total'), 65, 'Check for hsp total gaps' );
($hit->length == 0) ?
is( $hsp->{HIT_LENGTH}, $hsp->hit->length, 'Check hit length consistency' )
: is( $hsp->{HIT_LENGTH}, $hit->length, 'Check hit length consistency' );
($result->query_length == 0) ?
is( $hsp->{QUERY_LENGTH}, $hsp->query->length, 'Check query length consistency' )
: is( $hsp->{QUERY_LENGTH}, $result->query_length, 'Check query length consistency' );
is( $hsp->num_conserved, 690 );
is( $hsp->num_identical, 262 );
is( sprintf( "%.2f", $hsp->percent_identity ), 26.12 );
is( sprintf( "%.3f", $hsp->frac_identical('query') ), 0.275 );
is( sprintf( "%.3f", $hsp->frac_identical('hit') ), 0.265 );
is( sprintf( "%.3f", $hsp->frac_identical('total') ), 0.261 );
is( sprintf( "%.3f", $hsp->frac_conserved('query') ), 0.726 );
is( sprintf( "%.3f", $hsp->frac_conserved('hit') ), 0.697 );
is( sprintf( "%.3f", $hsp->frac_conserved('total') ), 0.688 );
is (length($hsp->homology_string), length($hsp->query_string));
is( $hsp->consensus_string,
'S-TTEEEEEEEETTSEEEEEEEESTTS-HHHHHHHHHHHHHHHGGGS-HHHHHH-EEEEEEECCECEEEEEEESSSTS-HHHHHHHHHHCTHHHHHTSTTEEEEEESS.--EEEEEEE-HHHHHCTT--HHHHHHHHHHHSSB-EEEECTT-SB-EEEE-SB---SCCHHCT-EEEETTSEEEEHHHCEEEEEEESSSS-EEEETTCEEEEEEEEEETTSBHHHHHHHHHHHHHCCGGGSSTTEEEEEEEESHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHSSHCCCHHHHHHHHHHHHHHHHHHHHTT--EEHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHCSS-HHHHHHHHHHHHCCHHHHHHHHHHHHCCGGGGSBHHHHHHHHHHHHHHHHHHHHHHHHHHCCHHHHHHHCS----TT-CC..............................CHHHHHHHHHHHHHHHHHHHHHHHHHSCHHHHHHHHHHHHH.HHHHHCCS-BESS----TSEEEEEEE-STTC-HHHHHHHHHHHHHHHH...TTTTEEEEEEEESESSSS..E........CTTEEEEEEEE--CTTS-SCCCSHHHHHHHHHHHC.CTSTSSEEEEEE-SSSCCCSSSSSEEEEEEE.TSSSCHHHHHHHHHHHHHHHCCSTTEECEEESS-S-EEEEEEEE-HHHHHHCTB-HHHHHHHHHHHHT-..EEEEEEEETTE...EEEEEEEE-GGGSSSGGGGCC-EEEETTSE.EEECGGCEEEEEEEE-SEEEEETTCEEEEEEEEESTTS...-HHHHHHHHHHCCTT..SSTTEEEEEECHHHHHHHHCCCHHHHHHHHHHHHHHHHHHHCTSSSTCHHHHTTHHHHHHHHHHHHHHTT--BSHHHHHHHHHHHHHHHHHHHHHHHHHHHHHCTTTBHHHHHHHHHHHHCHHHHHHHHHHHHHCCHHHHTT-STTHHHHHHHHHHHHHHHHHHHHCHHHHHHHHHHHHH',
'Check for consensus structure string'
);
is( $hsp->query_string,
'gldglkyvsSqSseglssitvtFedgtdidiArqqvqnrlqeaknkLPeevqepgiskiktssseilvlavtskdgsltktdlrdlaesnikdqlsrveGVgdvqliGgsekavriwldpqklaklgltltdvvsalkeqnvqvaaGqlegqqeelliraqgrlqsaediekiivksqdgskvrlrDvAkvelgaeeeriaatlngkpavllavkklpganaievvkavkekleelketlPegveivvvydttefvrasieeVvktlleaivLvvlvlflFLqnlratlipaiavPlsllgtfavlkalglsiNlltlfgLvlAiGlvvDdAiVvvEnverkleeegekpleaalksmkeiegalvaialvllavfvPilflgGveGklfrqfaltivlaillsvlvaltltPalcallLkarkeekek..............................gffrefnrlfdalerrYekllekvlrhravvllvalllvvg.slllfvripkeflPeedegvlvtsvqlppgvsleqtekvlkqvekilk...ekpevesvfavtGfafagdta........gqnsakvfisLkpekerkeeektvealierlrkel.ekikganvellapiqlreletlsgvrlelqvklfgddleaLseareqllaalkqlpeladvrseqqedepqlqvkidrekaaalGvsiadinetlstalgg..syvndfieegr...vvkvvvqleedlrsspedlkklyvrnkkgk.mvplsavakieeekgpnsierenglrsveisgevaegd...slgeaeeavekiakqvklPagvgiewtglseqeqeagnsllllvalalllvflvLaalyeslsdpllvlltvPlalvGallalllrglelsviaqvGlilliGlavkNailivefakelrekeglsleeAileaaklRLrPiLMTalaailGvlPLalstGaGselqqplgivvlGGlvtstvLtlllvPvlYvlva',
'Check for query string'
);
is( $hsp->hit_string,
'TVNDIEHIESQSLFGYGIVKIFFQPDVDIRTANAQVTAISQTVLKQMPPGITPPLILNYNAATVPILQLALSSK--VLSEDRIFDLGQNFIRPQLATVRGSAVPSPYGGKVRQIQIDLDPQAMQSKRVSPDDVARALSQQNLVLSPGTEKIGSFEYNVKINDSPDEFTLLNNLPIKNVGGVTIFIHDVAHVRDGFPPQINVVRDDGRRSVLMTILKNGATSTLDIIQGTKELIPKLKETLPNNLVLKVVGDQSIFVKSAISGVVREGTIAGILTSVMILLFLGSWRSTIIISMSIPLAILSAIIFLSLTGNTLNVMTLGGLALAVGMLVDDATVVIENINHHLEM-GKPTTKAIIDAARQIIQPALVSTLSICIVFVPMFSLTGVPRYLFIPMAEAVIFGMLSSFVLSQTFVPTVANKLLKYQTQHFKHehhtdahrpehdpnfkvhrsvkasifqffiNIQQGFEKRFTKVRLVYRSILHFALDHRKKFITLFLGFVIVsCVTLFPLLGKNFFPEVDSGDMKIHIRVQVGTRIEETAKQFDLIENTIRrlvPQNELDTIVDNIGLSVSGINTaysstgtiGPQDGDILIHLNEN------HHPTKEYMKKLRETLpRAFPGVS-FAFLPADITSQILNFGVPAPIDIRVDGPNHDNNLKFVRAILKDIRNVPGIADLRVQQATNYPQFNVDIDRSQAKNYGLTEGDITNSLVATLAGtsQVAPTFWLNNKngvSYPIVIQMPQYKINSLADLANIPITTKESSsMQVLGGLGSIERDQSDSVISHYNIKPSFDIFASLQGRDlgsISGDIETIIQHHHQE--LPKGVSVKLQGQVPIMQDSYRGLSLGLVASIILIYFLVVVNFESWLDPFVIITALPAALAGIVWMLYLTGTTLSVPALTGAIMCMGVATANSILVISFARERLA-IVKDSTQAALEAGYTRFRPVLMTASAMLIGMIPMALGLGDGGEQNAPLGRAVIGGLLLATIATLIFVPVVFSVVH',
'Check for hit string'
);
is( $hsp->homology_string,
' ++ +++++SqS g + + F+ + di A+ qv++ q + +++P ++++p i +++ +il+la++sk l++ + dl ++ i++ql+ v G + +Gg+ ++++i ldpq++++ +++++dv++al++qn + G+ + + e+++++++ + ++++ +k+ g + ++DvA+v +g + ++++ +g vl+++ k ++++++ ke +++lketlP+++ ++vv d++ fv+++i+ Vv + +a +L ++++lFL+++r+t+i+ +++Pl++l ++++l++ g ++N++tl+gL+lA+G++vDdA Vv+En+ +le+ g+ +a++ ++++i + + ++l++++vfvP+++l+Gv lf ++a ++++ +l s +++ t++P ++ lLk + ++ ++ ++ + f++ f ++ Y+ +l++ l hr+ ++++l +v++ ++ lf+ ++k+f+Pe d g++ ++++++ g+ +e+t+k + +e++++ ++e + ++ G + +g + g++ +++ i+L ++ ++ ++ +++lr+ l ++++g++ +++ p +++ + gv + ++ + g ++++ + ++++l+ ++++p++ad+r++q ++ pq++v+idr +a+++G++ di + l + l g +++ +f +++ + +v+q+++ + +s+ dl+++++++k++ m l+ + +ie+ ++ + i+++n ++s+ i ++++ +d ++g++e+++++ +++ lP+gv+++ +g+ q ++ l+l ++++++l++++ + +es++dp+++++ +P al+G + l+l+g++lsv a+ G i+ +G+a N il+++fa+e + ++ +A+lea+ +R+rP+LMTa a+++G++P+al+ G+G e plg +v+GGl+++t+ tl +vPv++ +v+',
'Check for homology string'
);
is( $hsp->posterior_string,
'578899********************************************************************..*****************************************************************************************************************************************************************************************************************************************************************************.***************************************************************************8776544446799********************9655555578*************************999999887775899******************************************8875446889999999999888774331111111134445555555444......45688999999999945678887.7888999*999************************************************************************8877666655434556776544422279***********************998764889*******************************8876222578999999999888..********************************************************************************************************.888899*****************************************************************9997',
'Check for posterior probability string'
);
}
}
}
}
$searchio = Bio::SearchIO->new(
-format => 'hmmer',
-file => test_input_file('hmmscan_multi_domain.out'),
-verbose => 1
);
my @multi_hits = (
[ 'PPC',
'Bacterial pre-peptidase C-terminal domain',
'111.0', 3.1e-32, 6,
[ [ 4, 59, 117, 183, 0.5, 0.16 ],
[ 12, 58, 347, 388, -0.6, 0.36 ],
[ 1, 69, 470, 549, 71.3, 1.3e-23 ],
[ 15, 25, 582, 603, -3.2, 2 ],
[ 13, 36, 987, 1019, -1.1, 0.5 ],
[ 1, 69, 1087, 1168, 54.4, 2.4e-18 ]
]
],
[ 'HemolysinCabind',
'Hemolysin-type calcium-binding repeat (2 copies)',
'47.9', 4.7e-13, 3,
[ [ 2, 13, 1214, 1225, 5.9, 0.0026 ],
[ 1, 18, 1231, 1248, 10.8, 6.8e-5 ],
[ 4, 18, 1243, 1257, 11.4, 4.3e-05 ]
]
]
);
while ( $result = $searchio->next_result ) {
is( ref($result),
'Bio::Search::Result::HMMERResult',
'Check for the correct result reference type'
);
is( $result->algorithm, 'HMMSCAN', 'Check algorithm' );
is( $result->algorithm_version, '3.0', 'Check algorithm version' );
is( $result->hmm_name,
'/data/biodata/HMMerDB/Pfam-A.hmm',
'Check hmm_name'
);
is( $result->sequence_file, 'BA000019.orf37.fasta',
'Check sequence_file' );
is( $result->query_name, 'BA000019.orf37', 'Check query_name' );
is( $result->query_length, '1418', 'Check query_length' );
is( $result->query_description, '', 'Check query_description' );
is( $result->num_hits(), 2, 'Check num_hits' );
my ( $hsp, $hit );
while ( $hit = $result->next_model ) {
if ($hit->name eq 'HemolysinCabind') {
# Hit length is usually unknown for HMMSCAN and HMMSEARCH but not for NHMMER.
# When is not known, sometimes it can be deduced from domain data '[]'
is( $hit->length, 18, 'Check hit length' );
is( $hit->frac_aligned_query, 0.03 );
is( $hit->frac_aligned_hit, '1.00' );
}
my @expected = @{ shift @multi_hits };
is( ref($hit), 'Bio::Search::Hit::HMMERHit',
'Check for the correct hit reference type' );
is( $hit->name, shift @expected, 'Check hit name' );
is( $hit->description, shift @expected, 'Check for hit description' );
is( $hit->raw_score, shift @expected, 'Check hit raw_score' );
float_is(
$hit->significance,
shift @expected,
'Check hit significance'
);
is( $hit->num_hsps, shift @expected, 'Check num_hsps' );
my @hsp_list = @{ shift @expected };
while ( defined( $hsp = $hit->next_domain ) ) {
my @hsp_exp = @{ shift @hsp_list };
is( ref($hsp), 'Bio::Search::HSP::HMMERHSP',
'Check for correct hsp reference type' );
is( $hsp->hit->start,
shift @hsp_exp,
'Check for hit envfrom value'
);
is( $hsp->hit->end, shift @hsp_exp,
'Check for hit env to value' );
is( $hsp->query->start,
shift @hsp_exp,
'Check for query hmmfrom value'
);
is( $hsp->query->end,
shift @hsp_exp,
'Check for query hmm to value'
);
is( $hsp->score, shift @hsp_exp, 'Check for hsp score' );
float_is( $hsp->evalue, shift @hsp_exp,
'Check for hsp c-Evalue' );
}
}
}
$searchio = Bio::SearchIO->new(
-format => 'hmmer',
-file => test_input_file('hmmscan_sec_struct.out'),
-verbose => 1
);
@multi_hits = (
[ 'HTH_AraC',
'Bacterial regulatory helix-turn-helix proteins, AraC family',
'41.3', 6.7e-11, 2,
[ [ 'siadiAeevgfSpsyfsrlFkkytGvt', 'SLMELSRQVGLNDCTLKRGFRLVFDTT' ],
[ 'nwsiadiAeevgf-SpsyfsrlFkkytGvtPsqyr',
'EINISQAARRVGFsSRSYFATAFRKKFGINPKEFL'
]
]
],
[ 'PKSI-KS_m3',
'', '38.2', 3.8e-12, 2,
[ [ 'GPSvtVDTACSSSLvA', 'GPSVTVDTLCSSSLVA' ],
[ 'GPSvtVDTACSSSLv', 'GPNLVIDSACSSALV' ]
]
],
[ 'DUF746',
'Domain of Unknown Function (DUF746)',
'13.9', 0.023, 2,
[ [ 'rllIrlLsqplslaeaadqlgtdegiiak',
'EILIRNLENPPSLMELSRQVGLNDCTLKR'
],
[ 'plslaeaadqlgtdeg', 'EINISQAARRVGFSSR' ]
]
]
);
my $result_counter = 0;
while ( $result = $searchio->next_result ) {
$result_counter++;
if ($result_counter == 1) {
is( ref($result),
'Bio::Search::Result::HMMERResult',
'Check for the correct result reference type'
);
is( $result->algorithm, 'HMMSCAN', 'Check algorithm' );
is( $result->algorithm_version, '3.0', 'Check algorithm version' );
is( $result->hmm_name, 'Pfam-A.hmm', 'Check hmm_name' );
is( $result->sequence_file, 'BA000019.orf8.fasta', 'Check sequence_file' );
is( $result->query_name, 'BA000019.orf8', 'Check query_name' );
is( $result->query_length, 348, 'Check query_length' );
is( $result->query_description, '', 'Check query_description' );
is( $result->num_hits(), 3, 'Check num_hits' );
my ( $hsp, $hit );
while ( $hit = $result->next_model ) {
if ($hit->name eq 'PKSI-KS_m3') {
# Hit length is usually unknown for HMMSCAN and HMMSEARCH but not for NHMMER.
# When is not known, sometimes it can be deduced from domain data '[]'
is( $hit->length, 16, 'Check hit length' );
is( $hit->frac_aligned_query, 0.09 );
is( $hit->frac_aligned_hit, '1.00' );
}
my @expected = @{ shift @multi_hits };
is( ref($hit), 'Bio::Search::Hit::HMMERHit',
'Check for the correct hit reference type' );
is( $hit->name, shift @expected, 'Check hit name' );
is( $hit->description, shift @expected, 'Check for hit description' );
is( $hit->raw_score, shift @expected, 'Check hit raw_score' );
float_is(
$hit->significance,
shift @expected,
'Check hit significance'
);
is( $hit->num_hsps, shift @expected, 'Check num_hsps' );
my @hsp_list = @{ shift @expected };
while ( defined( $hsp = $hit->next_domain ) ) {
my @hsp_exp = @{ shift @hsp_list };
is( ref($hsp), 'Bio::Search::HSP::HMMERHSP',
'Check for correct hsp reference type' );
is( $hsp->hit_string, shift @hsp_exp, 'Check hit sequence' );
is( $hsp->query_string, shift @hsp_exp, 'Check query sequence' );
}
}
}
elsif ($result_counter == 2) {
is( ref($result),
'Bio::Search::Result::HMMERResult',
'Check for the correct result reference type'
);
is( $result->algorithm, 'HMMSCAN', 'Check algorithm' );
is( $result->algorithm_version, '3.0', 'Check algorithm version' );
is( $result->query_name, 'lcl|aorf_00010|P1', 'Check query_name' );
is( $result->query_length, 132, 'Check query_length' );
is( $result->query_description, 'IS481.original transposase', 'Check query_description' );
is( $result->num_hits(), 1, 'Check num_hits' );
my ( $hsp, $hit );
while ( $hit = $result->next_model ) {
is( ref($hit), 'Bio::Search::Hit::HMMERHit',
'Check for the correct hit reference type' );
is( $hit->name, 'IS481.original.hmm', 'Check hit name' );
is( $hit->description, '', 'Check for hit description' );
is( $hit->raw_score, '130.0', 'Check hit raw_score' );
float_is( $hit->significance, 3.4e-040, 'Check hit significance' );
is( $hit->num_hsps, 1, 'Check num_hsps' );
while ( defined( $hsp = $hit->next_domain ) ) {
is( ref($hsp), 'Bio::Search::HSP::HMMERHSP',
'Check for correct hsp reference type' );
is( $hsp->query_string,
'GEIETAHPSYLGSQDTFYVGNITGAGR----------------------------IYQQTFVDTYSKWDSTKLYTTKTPITAADLLNDRVLSFFA-EQGMGIIRLLTDRSTEYCSKA--ETQDYELCLALNDIEHTKTKVYHPQTNDICRRFHKA',
'Check for query string'
);
is( $hsp->hit_string,
'kRYErdhPgeLvhmDvkklgripdgGgvkighRwrgrtrgrgkrtnqsrnrglgkayvitaiDDhSRfayaeilsdettttaadfllraaayfygkigeeiitrvlTDnGaayrskkrsakhdFqealaelGIkhilTrprsPqTNGKiERFhrT',
'Check for hit string'
);
is( $hsp->homology_string,
'+++E++hP +L+++D++++g+i + G+ +y++t++D++S+ +++++++t++taad l++ ++ f+ ++++i r lTD+ ++y+sk ++ d+ +la ++I+h++T++++PqTN ++ RFh+ ',
'Check for homology string'
);
is( $hsp->posterior_string,
'579*******************88888............................****************************************.********************8..**********************************95',
'Check for posterior probability string'
);
}
}
}
}
# Make sure that you can also directly call the hmmer2 and hmmer3 subclasses
$searchio = Bio::SearchIO->new(
-format => 'hmmer2',
-file => test_input_file('hmmpfam.out')
);
is( ref($searchio), 'Bio::SearchIO::hmmer2',
'Check if loading hmmpfam output via the hmm2 parser directly works' );
is( ref( $searchio->next_result ),
'Bio::Search::Result::HMMERResult',
'Check for the correct result reference type'
);
$searchio = Bio::SearchIO->new(
-format => 'hmmer2',
-file => test_input_file('hmmsearch.out')
);
is( ref($searchio), 'Bio::SearchIO::hmmer2',
'Check if loading hmmsearch2 output via the hmm2 parser directly works' );
is( ref( $searchio->next_result ),
'Bio::Search::Result::HMMERResult',
'Check for the correct result reference type'
);
$searchio = Bio::SearchIO->new(
-format => 'hmmer3',
-file => test_input_file('hmmscan.out')
);
is( ref($searchio), 'Bio::SearchIO::hmmer3',
'Check if loading hmmscan output via the hmm3 parser directly works' );
is( ref( $searchio->next_result ),
'Bio::Search::Result::HMMERResult',
'Check for the correct result reference type'
);
$searchio = Bio::SearchIO->new(
-format => 'hmmer',
-file => test_input_file('hmmsearch3.out')
);
is( ref($searchio), 'Bio::SearchIO::hmmer3',
'Check if loading hmmsearch3 output via the hmm3 parser directly works' );
is( ref( $searchio->next_result ),
'Bio::Search::Result::HMMERResult',
'Check for the correct result reference type'
);
# Make sure that you can also specify the -version parameter directly
$searchio = Bio::SearchIO->new(
-format => 'hmmer',
-file => test_input_file('hmmpfam.out'),
-version => 2
);
is( ref($searchio), 'Bio::SearchIO::hmmer2',
'Check if selecting the correct hmmpfam parser using -version works' );
is( ref( $searchio->next_result ),
'Bio::Search::Result::HMMERResult',
'Check for the correct result reference type'
);
$searchio = Bio::SearchIO->new(
-format => 'hmmer',
-file => test_input_file('hmmsearch.out'),
-version => 2
);
is( ref($searchio), 'Bio::SearchIO::hmmer2',
'Check if selecting the correct hmmsearch2 parser using -version works' );
is( ref( $searchio->next_result ),
'Bio::Search::Result::HMMERResult',
'Check for the correct result reference type'
);
$searchio = Bio::SearchIO->new(
-format => 'hmmer3',
-file => test_input_file('hmmscan.out'),
-version => 3
);
is( ref($searchio), 'Bio::SearchIO::hmmer3',
'Check if selecting the correct hmmscan parser using -version works' );
is( ref( $searchio->next_result ),
'Bio::Search::Result::HMMERResult',
'Check for the correct result reference type'
);
$searchio = Bio::SearchIO->new(
-format => 'hmmer',
-file => test_input_file('hmmsearch3.out'),
-version => 3
);
is( ref($searchio), 'Bio::SearchIO::hmmer3',
'Check if selecting the correct hmmsearch3 parser using -version works' );
is( ref( $searchio->next_result ),
'Bio::Search::Result::HMMERResult',
'Check for the correct result reference type'
);
my $cat_command = ($^O =~ m/mswin/i) ? 'type' : 'cat';
my $pipestr = "$cat_command " . test_input_file('hmmpfam.out') . " |";
open( my $pipefh, $pipestr );
$searchio = Bio::SearchIO->new(
-format => 'hmmer',
-fh => $pipefh
);
is( ref($searchio), 'Bio::SearchIO::hmmer2',
'Check if reading from a pipe works' );
$result = $searchio->next_result;
is( ref($result),
'Bio::Search::Result::HMMERResult',
'Check for the correct result reference type'
);
is( $result->num_hits(), 2, 'Check num_hits' );
# bug 3376
{
my $in = Bio::SearchIO->new(
-format => 'hmmer',
-file => test_input_file('pfamOutput-bug3376.out')
);
my $result = $in->next_result;
my $hit = $result->next_hit;
my $hsp = $hit->next_hsp;
is( $result->query_length, 97, 'Check query_length' );
is( $hit->length, 95, 'Check hit length' );
is( $hsp->hit_string,
'svfqqqqssksttgstvtAiAiAigYRYRYRAvtWnsGsLssGvnDnDnDqqsdgLYtiYYsvtvpssslpsqtviHHHaHkasstkiiikiePr',
'bug3376'
);
}
# end bug 3376
# bug 3421 - making sure a full line of dashes in an HSP is parsed correctly
{
my $in = Bio::SearchIO->new(
-format => 'hmmer',
-file => test_input_file('hmmpfam_HSPdashline.txt')
);
my $result = $in->next_result;
my $hit = $result->next_hit;
my $hsp = $hit->next_hsp;
is( $hsp->length, '561',
'bug3421 - Check if can correctly parse an HSP with line full of dashes'
);
}
# end bug 3421
# bug 3302
{
my $in = Bio::SearchIO->new(
-format => 'hmmer',
-file => test_input_file('hmmpfam_multiresult.out')
);
my $result = $in->next_result;
$result = $in->next_result;
my $hit = $result->next_hit;
is( $hit->name, 'IS66_ORF3.uniq', 'bug3302 - Check if can parse multiresult hmmer' );
}
# end bug 3302
# HMMER 3.1 nhmmer output
{
my $in = Bio::SearchIO->new(
-format => 'hmmer',
-version => 3,
-file => test_input_file('nhmmer-3.1.out')
);
my $result = $in->next_result;
is( $result->algorithm, 'NHMMER', 'Check algorithm' );
is( $result->algorithm_version, '3.1b1', 'Check nhmmer algorithm version' );
is( $result->hmm_name,
'../HMMs/A_HA_H7_CDS_nucleotide.hmm',
'Check hmm_name'
);
is( $result->sequence_file,
'tmp.fa',
'Check sequence_file'
);
is( $result->query_name, 'A_HA_H7_CDS_nucleotide', 'Check query_name' );
is( $result->query_length, 1683, 'Check query_length' );
is( $result->query_accession, '', 'Check query_accession' );
is( $result->query_description, '', 'Check query_description' );
is( $result->num_hits(), 2, 'Check num_hits' );
my $hit = $result->next_hit;
is( ref($hit), 'Bio::Search::Hit::HMMERHit',
'Check for the correct hit reference type' );
is( $hit->name, 'seq1', 'Check nhmmer hit name' );
is( $hit->description, 'Description of seq1', 'Check nhmmer hit description' );
is( $hit->score, 148.2, 'Check nhmmer hit score' );
is( $hit->bits, 0, 'Check nhmmer hit bits (0)' );
float_is( $hit->significance, 3.2e-48, 'Check nhmmer hit significance' );
is( $hit->num_hsps, 1, 'Check num_hsps' );
# Hit length is usually unknown for HMMSCAN and HMMSEARCH but not for NHMMER.
# When is not known, sometimes it can be deduced from domain data '[]'
is( $hit->length, 151, 'Check nhmmer hit length' );
is( $hit->frac_aligned_query, 0.09 );
is( $hit->frac_aligned_hit, '1.00' );
my $hsp = $hit->next_hsp;
is( ref($hsp), 'Bio::Search::HSP::HMMERHSP',
'Check for correct hsp reference type' );
is( $hsp->hit->seq_id(), 'seq1', 'Check for nhmmer hit seq_id' );
is( $hsp->query->seq_id(), 'A_HA_H7_CDS_nucleotide', 'Check for nhmmer query seq_id' );
is( $hsp->start('hit'), 1, 'Check nhmmer hsp hit start' );
is( $hsp->end('hit'), 151, 'Check nhmmer hsp hit end' );
is( $hsp->start('query'), 258, 'Check nhmmer hsp query start' );
is( $hsp->end('query'), 411, 'Check nhmmer hsp query end' );
is( $hsp->strand('hit'), 1, 'Check nhmmer hsp hit strand' );
is( $hsp->strand('query'), 1, 'Check nhmmer hsp query strand' );
is( $hsp->score, 148.2, 'Check nhmmer hsp score' );
is( $hsp->bits, 0, 'Check nhmmer hsp bits (0)' );
float_is( $hsp->significance, 3.2e-48, 'Check nhmmer hsp evalue' );
is( $hsp->length('query'), 154, 'Check for hsp query length' );
is( $hsp->length('hit'), 151, 'Check for hsp hit length' );
is( $hsp->length('total'), 154, 'Check for hsp total length' );
is( $hsp->gaps('query'), 0, 'Check for hsp query gaps' );
is( $hsp->gaps('hit'), 3, 'Check for hsp hit gaps' );
is( $hsp->gaps('total'), 3, 'Check for hsp total gaps' );
($hit->length == 0) ?
is( $hsp->{HIT_LENGTH}, $hsp->hit->length, 'Check hit length consistency' )
: is( $hsp->{HIT_LENGTH}, $hit->length, 'Check hit length consistency' );
($result->query_length == 0) ?
is( $hsp->{QUERY_LENGTH}, $hsp->query->length, 'Check query length consistency' )
: is( $hsp->{QUERY_LENGTH}, $result->query_length, 'Check query length consistency' );
is( $hsp->num_conserved, 151 );
is( $hsp->num_identical, 146 );
is( sprintf( "%.2f", $hsp->percent_identity ), 94.81 );
is( sprintf( "%.3f", $hsp->frac_identical('query') ), 0.948 );
is( sprintf( "%.3f", $hsp->frac_identical('hit') ), 0.967 );
is( sprintf( "%.3f", $hsp->frac_identical('total') ), 0.948 );
is( sprintf( "%.3f", $hsp->frac_conserved('query') ), 0.981 );
is( sprintf( "%.3f", $hsp->frac_conserved('hit') ), '1.000' );
is( sprintf( "%.3f", $hsp->frac_conserved('total') ), 0.981 );
is( $hsp->consensus_string,
'',
'Check for consensus structure string'
);
is( $hsp->query_string,
'attcctagaattttcagctgatttaattattgagaggcgagaaggaagtaatgatgtctgttatcctgggaaattcgtaaatgaagaagctctgaggcaaattctcagggggtcaggcggaattgacaaggagacaatgggattcacatatagc',
'Check for nhmmer query string'
);
is( $hsp->homology_string,
'attcctagaattttcagc+gatttaattattgagaggcgagaaggaagt gatgtctgttatcctgggaaattcgt+aatgaagaagctctgaggcaaattctcaggg+gtcaggcggaattgacaaggagacaatgggattcac+ta+agc',
'Check for nhmmer homology string'
);
is( $hsp->hit_string,
'ATTCCTAGAATTTTCAGCCGATTTAATTATTGAGAGGCGAGAAGGAAGT---GATGTCTGTTATCCTGGGAAATTCGTGAATGAAGAAGCTCTGAGGCAAATTCTCAGGGAGTCAGGCGGAATTGACAAGGAGACAATGGGATTCACCTACAGC',
'Check for nhmmer hit string'
);
is( $hsp->posterior_string,
'689*******************************************777...***************************************************************************************************986',
'Check for nhmmer posterior probability string'
);
is( length( $hsp->homology_string ),
length( $hsp->hit_string ),
'Check if nhmmer homology string and hit string have an equal length'
);
is( length( $hsp->query_string ),
length( $hsp->homology_string ),
'Check if nhmmer query string and homology string have an equal length'
);
$hit = $result->next_hit;
is( $hit->name, 'seq2', 'Check nhmmer hit name' );
is( $hit->description, 'Description of seq2', 'Check nhmmer hit description' );
is( $hit->score, 38.6, 'Check nhmmer hit score' );
is( $hit->bits, 0, 'Check nhmmer hit bits (0)' );
float_is( $hit->significance, 3.9e-15, 'Check nhmmer hit significance' );
is( $hit->length, 60, 'Check nhmmer hit length' );
$hsp = $hit->next_hsp;
is( $hsp->hit->seq_id(), 'seq2', 'Check for nhmmer hit seq_id' );
is( $hsp->query->seq_id(), 'A_HA_H7_CDS_nucleotide', 'Check for nhmmer query seq_id' );
is( $hsp->start('query'), 34, 'Check nhmmer hsp query start' );
is( $hsp->end('query'), 92, 'Check nhmmer hsp query end' );
is( $hsp->start('hit'), 1, 'Check nhmmer hsp hit start' );
is( $hsp->end('hit'), 59, 'Check nhmmer hsp hit end' );
is( $hsp->strand('hit'), -1, 'Check nhmmer hsp hit strand' );
is( $hsp->strand('query'), 1, 'Check nhmmer hsp query strand' );
is( $hsp->score, 38.6, 'Check nhmmer hsp score' );
is( $hsp->bits, 0, 'Check nhmmer hsp bits (0)' );
float_is( $hsp->significance, 3.9e-15, 'Check nhmmer hsp evalue' );
is( $hsp->length('query'), 59, 'Check for hsp query length' );
is( $hsp->length('hit'), 59, 'Check for hsp hit length' );
is( $hsp->length('total'), 59, 'Check for hsp total length' );
is( $hsp->gaps('query'), 0, 'Check for hsp query gaps' );
is( $hsp->gaps('hit'), 0, 'Check for hsp hit gaps' );
is( $hsp->gaps('total'), 0, 'Check for hsp total gaps' );
($hit->length == 0) ?
is( $hsp->{HIT_LENGTH}, $hsp->hit->length, 'Check hit length consistency' )
: is( $hsp->{HIT_LENGTH}, $hit->length, 'Check hit length consistency' );
($result->query_length == 0) ?
is( $hsp->{QUERY_LENGTH}, $hsp->query->length, 'Check query length consistency' )
: is( $hsp->{QUERY_LENGTH}, $result->query_length, 'Check query length consistency' );
is (length($hsp->homology_string), length($hsp->query_string));
is( $hsp->consensus_string,
'',
'Check for consensus structure string'
);
is( $hsp->query_string,
'gtgatgattgcaacaaatgcagacaaaatctgccttgggcaccatgctgtgtcaaacgg',
'Check for nhmmer query string'
);
is( $hsp->homology_string,
'g+gat+att+c+acaaatgcagacaa atctgccttgggca+catgc+gtgtcaaacgg',
'Check for nhmmer homology string'
);
is( $hsp->hit_string,
'GCGATCATTCCGACAAATGCAGACAAGATCTGCCTTGGGCATCATGCCGTGTCAAACGG',
'Check for nhmmer hit string'
);
is( $hsp->posterior_string,
'6899****************************************************986',
'Check for nhmmer posterior probability string' );
is( length( $hsp->homology_string ),
length( $hsp->hit_string ),
'Check if nhmmer homology string and hit string have an equal length'
);
is( length( $hsp->query_string ),
length( $hsp->homology_string ),
'Check if nhmmer query string and homology string have an equal length'
);
}
# end HMMER 3.1 nhmmer output
# Test HIT filtering by SIGNIFICANCE
$searchio = Bio::SearchIO->new(
'-format' => 'hmmer',
'-file' => test_input_file('hmmpfam_cs.out'),
'-signif' => 1e-100
);
# NOTE: For Hmmer2, if a single model pass the HIT filter
# but it shows 2 domains, it counts as 2 hits (Glu_synthase)
my @valid = qw( GATase_2
Glu_syn_central
Glu_synthase
Glu_synthase
GXGXG );
$result = $searchio->next_result;
is( $result->num_hits(), 5, 'Check Significance filtered num_hits' );
while ( my $hit = $result->next_hit ) {
is( $hit->name, shift @valid, 'Check Significance filtered hit ID' );
}
is( @valid, 0 );
# Test HIT filtering by SCORE
$searchio = Bio::SearchIO->new(
'-format' => 'hmmer',
'-file' => test_input_file('hmmsearch.out'),
'-score' => 390
);
# NOTE: This Hmmer2 report top hit (score 393.8) have 4 domains,
# so it count as 4 hits (PAB2_ARATH)
@valid = qw( PAB2_ARATH
PAB2_ARATH
PAB2_ARATH
PAB2_ARATH );
$result = $searchio->next_result;
is( $result->num_hits(), 4, 'Check Score filtered num_hits' );
while ( my $hit = $result->next_hit ) {
is( $hit->name, shift @valid, 'Check Score filtered hit ID' );
}
is( @valid, 0 );
# Test HIT filtering by BITS
$searchio = Bio::SearchIO->new(
'-format' => 'hmmer',
'-file' => test_input_file('hmmsearch3_multi.out'),
'-bits' => 10
);
# NOTE: No HMMER report use Bits, so this will filter out everything
$result = $searchio->next_result;
is( $result->num_hits(), 0, 'Check Bits filtered num_hits' );
$result = $searchio->next_result;
is( $result->num_hits(), 0, 'Check Bits filtered num_hits' );
$result = $searchio->next_result;
is( $result->num_hits(), 0, 'Check Bits filtered num_hits' );
# Test HIT filtering by HIT_FILTER
my $filt_func = sub {
my $hit = shift;
$hit->frac_aligned_query >= 0.20;
};
$searchio = Bio::SearchIO->new(
'-format' => 'hmmer',
'-file' => test_input_file('hmmscan_multi_domain.out'),
'-hit_filter' => $filt_func
);
# NOTE: In Hmmer3 reports, the multiple domains of a model are treated
# as HSPs instead of Hits (like it is in Hmmer2 reports)
@valid = qw( PPC );
$result = $searchio->next_result;
is( $result->num_hits(), 1, 'Check Hit_filter filtered num_hits' );
while ( my $hit = $result->next_hit ) {
is( $hit->name, shift @valid, 'Check Hit_filter filtered hits ID' );
}
is( @valid, 0 );
# Test for correct parsing of results from query sequences containing stops.
# Without the patch, parsing dies with "Quantifier follows nothing in regex;" error
$searchio = Bio::SearchIO->new(
'-format' => 'hmmer',
'-file' => test_input_file('hmmscan_qry_stop.txt'),
);
eval { $searchio->next_result; };
is( $@, '', 'Correct parsing of alignments with stops' );
# Test for correct parsing of phmmer results
# Without the patch, parsing skips all lines from phmmer output
{
my $searchio = Bio::SearchIO->new(
-format => 'hmmer',
-file => test_input_file('phmmer.out')
);
my $result = $searchio->next_result;
if ( defined $result ) {
is( $result->algorithm, 'PHMMER', 'Check algorithm' );
is( $result->query_name, 'A0R3R7', 'Check query_name' );
is( $result->query_length, 762, 'Check query_length absence' );
is( $result->query_description, '', 'Check query_description' );
is( $result->num_hits(), 8, 'Check num_hits' );
my $hit = $result->next_model;
if ( defined $hit ) {
is( $hit->name, 'cath|4_0_0|1vs0A03/639-759', 'query name okay' );
is( $hit->num_hsps(), 1, 'Check num_hsps' );
}
}
}
|