git-svn-id: file:///home/git/hedgehog.fhcrc.org/bioconductor/trunk/madman/Rpacks/gmapR@91007 bc3139a8-67e5-0310-9ffc-ced21a209358
... | ... |
@@ -1,4 +1,4 @@ |
1 |
-static char rcsid[] = "$Id: bamtally.c 135743 2014-05-09 16:58:57Z twu $"; |
|
1 |
+static char rcsid[] = "$Id: bamtally.c 136268 2014-05-14 22:04:03Z michafla $"; |
|
2 | 2 |
#ifdef HAVE_CONFIG_H |
3 | 3 |
#include <config.h> |
4 | 4 |
#endif |
... | ... |
@@ -5037,7 +5037,7 @@ Bamtally_iit (Bamreader_T bamreader, char *desired_chr, char *bam_lacks_chr, |
5037 | 5037 |
/*quality_score_adj*/0,min_depth,variant_strands, |
5038 | 5038 |
/*genomic_diff_p*/false,/*signed_counts_p*/false,ignore_query_Ns_p, |
5039 | 5039 |
print_indels_p,/*print_totals_p*/false,/*print_cycles_p*/false, |
5040 |
- /*print_quality_scores_p*/false,/*print_mapq_scores_p*/false,/*print_xs_scores_p*/print_xs_scores_p, |
|
5040 |
+ /*print_quality_scores_p*/false,/*print_mapq_scores_p*/false,print_xs_scores_p, |
|
5041 | 5041 |
/*want_genotypes_p*/false,verbosep,readlevel_p,max_softclip, |
5042 | 5042 |
print_noncovered_p,/*bamfile*/NULL); |
5043 | 5043 |
/* Reverse lists so we can specify presortedp == true */ |
... | ... |
@@ -5087,7 +5087,7 @@ Bamtally_iit (Bamreader_T bamreader, char *desired_chr, char *bam_lacks_chr, |
5087 | 5087 |
/*genomic_diff_p*/false,/*signed_counts_p*/false, |
5088 | 5088 |
ignore_query_Ns_p, print_indels_p,/*print_totals_p*/false, |
5089 | 5089 |
/*print_cycles_p*/false, |
5090 |
- /*print_quality_scores_p*/false,/*print_mapq_scores_p*/false,/*print_xs_scores_p*/print_xs_scores_p, |
|
5090 |
+ /*print_quality_scores_p*/false,/*print_mapq_scores_p*/false,print_xs_scores_p, |
|
5091 | 5091 |
/*want_genotypes_p*/false,verbosep,readlevel_p,max_softclip, |
5092 | 5092 |
print_noncovered_p,/*bamfile*/NULL); |
5093 | 5093 |
} |
... | ... |
@@ -1,4 +1,4 @@ |
1 |
-static char rcsid[] = "$Id: dynprog.c 133253 2014-04-15 18:56:11Z twu $"; |
|
1 |
+static char rcsid[] = "$Id: dynprog.c 136514 2014-05-16 17:59:19Z twu $"; |
|
2 | 2 |
#ifdef HAVE_CONFIG_H |
3 | 3 |
#include <config.h> |
4 | 4 |
#endif |
... | ... |
@@ -75,11 +75,7 @@ static char rcsid[] = "$Id: dynprog.c 133253 2014-04-15 18:56:11Z twu $"; |
75 | 75 |
|
76 | 76 |
#define FULLMATCH 3 |
77 | 77 |
#define HALFMATCH 1 |
78 |
-#ifdef PMAP |
|
79 | 78 |
#define AMBIGUOUS 0 |
80 |
-#else |
|
81 |
-#define AMBIGUOUS -1 |
|
82 |
-#endif |
|
83 | 79 |
|
84 | 80 |
|
85 | 81 |
/* These values were set to -5, -4, -3, but this led to chopped ends |
... | ... |
@@ -764,6 +760,7 @@ Pairdistance_T **pairdistance_array[NMISMATCHTYPES]; |
764 | 760 |
Pairdistance_T **pairdistance_array_plus_128[NMISMATCHTYPES]; |
765 | 761 |
#endif |
766 | 762 |
bool **consistent_array; |
763 |
+int *nt_to_int_array; |
|
767 | 764 |
|
768 | 765 |
|
769 | 766 |
bool |
... | ... |
@@ -854,6 +851,16 @@ Dynprog_init (Mode_T mode) { |
854 | 851 |
int i, j, ptr; |
855 | 852 |
int c, c1, c2; |
856 | 853 |
|
854 |
+ nt_to_int_array = (int *) CALLOC(128,sizeof(int)); |
|
855 |
+ for (j = 0; j < 128; j++) { |
|
856 |
+ nt_to_int_array[j] = 4; |
|
857 |
+ } |
|
858 |
+ nt_to_int_array['A'] = nt_to_int_array['a'] = 0; |
|
859 |
+ nt_to_int_array['C'] = nt_to_int_array['c'] = 1; |
|
860 |
+ nt_to_int_array['G'] = nt_to_int_array['g'] = 2; |
|
861 |
+ nt_to_int_array['T'] = nt_to_int_array['t'] = 3; |
|
862 |
+ |
|
863 |
+ |
|
857 | 864 |
consistent_array = (bool **) CALLOC(128,sizeof(bool *)); |
858 | 865 |
consistent_array[0] = (bool *) CALLOC(128*128,sizeof(bool)); |
859 | 866 |
ptr = 0; |
... | ... |
@@ -898,6 +905,11 @@ Dynprog_init (Mode_T mode) { |
898 | 905 |
} |
899 | 906 |
#endif |
900 | 907 |
|
908 |
+ for (c = 'A'; c < 'Z'; c++) { |
|
909 |
+ permute_cases(c,c,FULLMATCH); |
|
910 |
+ } |
|
911 |
+ |
|
912 |
+ /* Exceptions */ |
|
901 | 913 |
permute_cases('U','T',FULLMATCH); |
902 | 914 |
|
903 | 915 |
permute_cases('R','A',HALFMATCH); |
... | ... |
@@ -944,16 +956,16 @@ Dynprog_init (Mode_T mode) { |
944 | 956 |
permute_cases('X','A',AMBIGUOUS); |
945 | 957 |
permute_cases('X','G',AMBIGUOUS); |
946 | 958 |
|
959 |
+ permute_cases('N','N',AMBIGUOUS); /* Needed to start dynprog procedures with 0 at (0,0) */ |
|
960 |
+ permute_cases('X','X',AMBIGUOUS); /* Needed to start dynprog procedures with 0 at (0,0) */ |
|
961 |
+ |
|
962 |
+ |
|
947 | 963 |
if (mode == CMET_STRANDED || mode == CMET_NONSTRANDED) { |
948 | 964 |
/* Query-T can match Genomic-C */ |
949 | 965 |
permute_cases_oneway('T','C',FULLMATCH); |
950 | 966 |
permute_cases_oneway('A','G',FULLMATCH); |
951 | 967 |
} |
952 | 968 |
|
953 |
- for (c = 'A'; c < 'Z'; c++) { |
|
954 |
- permute_cases(c,c,FULLMATCH); |
|
955 |
- } |
|
956 |
- |
|
957 | 969 |
#ifndef HAVE_SSE4_1 |
958 | 970 |
#ifdef PREUC |
959 | 971 |
for (i = 0; i < NMISMATCHTYPES; i++) { |
... | ... |
@@ -1010,6 +1022,7 @@ Dynprog_term (void) { |
1010 | 1022 |
*/ |
1011 | 1023 |
FREE(consistent_array[0]); |
1012 | 1024 |
FREE(consistent_array); |
1025 |
+ FREE(nt_to_int_array); |
|
1013 | 1026 |
|
1014 | 1027 |
return; |
1015 | 1028 |
} |
... | ... |
@@ -1678,274 +1691,3 @@ Dynprog_traceback_std (List_T pairs, int *nmatches, int *nmismatches, int *nopen |
1678 | 1691 |
#endif |
1679 | 1692 |
|
1680 | 1693 |
|
1681 |
-char * |
|
1682 |
-Dynprog_tokens_string (List_T tokens) { |
|
1683 |
- char *string, *token, *q; |
|
1684 |
- int stringlength = 0; |
|
1685 |
- List_T p; |
|
1686 |
- |
|
1687 |
- for (p = tokens; p != NULL; p = List_next(p)) { |
|
1688 |
- token = (char *) List_head(p); |
|
1689 |
- stringlength += strlen(token); |
|
1690 |
- } |
|
1691 |
- string = (char *) MALLOC((stringlength+1) * sizeof(char)); |
|
1692 |
- |
|
1693 |
- q = string; |
|
1694 |
- for (p = tokens; p != NULL; p = List_next(p)) { |
|
1695 |
- token = (char *) List_head(p); |
|
1696 |
- strcpy(q,token); |
|
1697 |
- q += strlen(token); |
|
1698 |
- } |
|
1699 |
- *q = '\0'; |
|
1700 |
- return string; |
|
1701 |
-} |
|
1702 |
- |
|
1703 |
- |
|
1704 |
-void |
|
1705 |
-Dynprog_tokens_free (List_T *tokens) { |
|
1706 |
- List_T p; |
|
1707 |
- char *token; |
|
1708 |
- |
|
1709 |
- for (p = *tokens; p != NULL; p = List_next(p)) { |
|
1710 |
- token = (char *) List_head(p); |
|
1711 |
- FREE(token); |
|
1712 |
- } |
|
1713 |
- List_free(&(*tokens)); |
|
1714 |
- |
|
1715 |
- return; |
|
1716 |
-} |
|
1717 |
- |
|
1718 |
-static List_T |
|
1719 |
-push_token (bool *startp, List_T tokens, char *token) { |
|
1720 |
- char *copy; |
|
1721 |
- |
|
1722 |
- copy = (char *) CALLOC(strlen(token)+1,sizeof(char)); |
|
1723 |
- strcpy(copy,token); |
|
1724 |
- |
|
1725 |
- *startp = false; |
|
1726 |
- return List_push(tokens,(void *) copy); |
|
1727 |
-} |
|
1728 |
- |
|
1729 |
- |
|
1730 |
- |
|
1731 |
-char * |
|
1732 |
-Dynprog_cigar_std (int *finalc, Direction32_T **directions_nogap, Direction32_T **directions_Egap, Direction32_T **directions_Fgap, |
|
1733 |
- int r, int c, char *rsequence, char *gsequence, char *gsequence_alt, |
|
1734 |
- char *nindels, int queryoffset, int genomeoffset, bool revp, |
|
1735 |
- Univcoord_T chroffset, Univcoord_T chrhigh) { |
|
1736 |
- char *cigar; |
|
1737 |
- List_T tokens = NULL; |
|
1738 |
- char token[10]; |
|
1739 |
- int Mlength = 0, Ilength = 0, Mlength_postins = 0; |
|
1740 |
- int insertion_width = 0; |
|
1741 |
- bool startp = true; |
|
1742 |
- |
|
1743 |
- int dist; |
|
1744 |
- Direction32_T dir; |
|
1745 |
- |
|
1746 |
- debug(printf("Starting Dynprog_cigar_std at r=%d,c=%d (roffset=%d, goffset=%d)\n",r,c,queryoffset,genomeoffset)); |
|
1747 |
- |
|
1748 |
-#if 0 |
|
1749 |
- /* Handle initial indel */ |
|
1750 |
- if ((dir = directions_nogap[c][r]) == DIAG) { |
|
1751 |
- /* Not an indel. Do nothing. */ |
|
1752 |
- |
|
1753 |
- } else if (dir == HORIZ) { |
|
1754 |
- dist = 1; |
|
1755 |
- while (c > 1 && directions_Egap[c][r] != DIAG) { |
|
1756 |
- dist++; |
|
1757 |
- c--; |
|
1758 |
- } |
|
1759 |
- c--; |
|
1760 |
- /* dir = directions_nogap[c][r]; */ |
|
1761 |
- |
|
1762 |
- sprintf(token,"0M"); |
|
1763 |
- tokens = push_token(&startp,tokens,token); |
|
1764 |
- sprintf(token,"%dD",dist); |
|
1765 |
- tokens = push_token(&startp,tokens,token); |
|
1766 |
- |
|
1767 |
- } else { |
|
1768 |
- /* Must be VERT */ |
|
1769 |
- dist = 1; |
|
1770 |
- while (r > 1 && directions_Fgap[c][r] != DIAG) { |
|
1771 |
- dist++; |
|
1772 |
- r--; |
|
1773 |
- } |
|
1774 |
- r--; |
|
1775 |
- /* dir = directions_nogap[c][r]; */ |
|
1776 |
- |
|
1777 |
- sprintf(token,"0M"); |
|
1778 |
- tokens = push_token(&startp,tokens,token); |
|
1779 |
- sprintf(token,"%dI",dist); |
|
1780 |
- tokens = push_token(&startp,tokens,token); |
|
1781 |
- } |
|
1782 |
-#endif |
|
1783 |
- |
|
1784 |
- *finalc = c; |
|
1785 |
- while (c > 0) { /* dir != STOP */ |
|
1786 |
- if (r == 0) { |
|
1787 |
- /* Ignore gap in row 0 */ |
|
1788 |
- if (Ilength > 0 && Ilength != insertion_width) { |
|
1789 |
- if (Mlength_postins > 0) { |
|
1790 |
- sprintf(token,"%dM",Mlength_postins); |
|
1791 |
- tokens = push_token(&startp,tokens,token); |
|
1792 |
- } |
|
1793 |
- sprintf(token,"%dS",Ilength); |
|
1794 |
- tokens = push_token(&startp,tokens,token); |
|
1795 |
- if (Mlength > 0) { |
|
1796 |
- sprintf(token,"%dM",Mlength); |
|
1797 |
- tokens = push_token(&startp,tokens,token); |
|
1798 |
- } |
|
1799 |
- } else { |
|
1800 |
- if (Ilength > 0) { |
|
1801 |
- sprintf(token,"%dM",Mlength_postins); |
|
1802 |
- tokens = push_token(&startp,tokens,token); |
|
1803 |
- sprintf(token,"%dI",Ilength); |
|
1804 |
- tokens = push_token(&startp,tokens,token); |
|
1805 |
- } |
|
1806 |
- if (1 || Mlength > 0) { |
|
1807 |
- sprintf(token,"%dM",Mlength); |
|
1808 |
- tokens = push_token(&startp,tokens,token); |
|
1809 |
- } |
|
1810 |
- } |
|
1811 |
- |
|
1812 |
- *finalc = c; |
|
1813 |
- tokens = List_reverse(tokens); |
|
1814 |
- cigar = Dynprog_tokens_string(List_reverse(tokens)); |
|
1815 |
- Dynprog_tokens_free(&tokens); |
|
1816 |
- |
|
1817 |
- return cigar; |
|
1818 |
- |
|
1819 |
- } else if ((dir = directions_nogap[c][r]) == DIAG) { |
|
1820 |
- /* printf("At r %d, c %d (%c), dir is DIAG, nindels %d\n",r,c,gsequence[c],nindels[c-1]); */ |
|
1821 |
- |
|
1822 |
- if (nindels[c-1] < 0) { |
|
1823 |
- /* Genome modified with a deletion */ |
|
1824 |
- if (startp == true && Ilength > 0 && Ilength != insertion_width) { |
|
1825 |
- /* Incomplete insertion at beginning. Mlength_postins should be 0. */ |
|
1826 |
- sprintf(token,"%dS",Ilength); |
|
1827 |
- tokens = push_token(&startp,tokens,token); |
|
1828 |
- sprintf(token,"%dM",Mlength); |
|
1829 |
- tokens = push_token(&startp,tokens,token); |
|
1830 |
- } else { |
|
1831 |
- if (Ilength > 0) { |
|
1832 |
- sprintf(token,"%dM",Mlength_postins); |
|
1833 |
- tokens = push_token(&startp,tokens,token); |
|
1834 |
- sprintf(token,"%dI",Ilength); |
|
1835 |
- tokens = push_token(&startp,tokens,token); |
|
1836 |
- } |
|
1837 |
- if (1 || Mlength > 0) { |
|
1838 |
- sprintf(token,"%dM",Mlength); |
|
1839 |
- tokens = push_token(&startp,tokens,token); |
|
1840 |
- } |
|
1841 |
- } |
|
1842 |
- Mlength = 1; |
|
1843 |
- |
|
1844 |
- sprintf(token,"%dD",-nindels[c-1]); |
|
1845 |
- tokens = push_token(&startp,tokens,token); |
|
1846 |
- |
|
1847 |
- } else if (nindels[c-1] > 0) { |
|
1848 |
- insertion_width = nindels[c-1]; |
|
1849 |
- if (Ilength == 0) { |
|
1850 |
- Mlength_postins = Mlength; /* Cannot push M yet, since I could change to S */ |
|
1851 |
- Mlength = 0; |
|
1852 |
- } |
|
1853 |
- Ilength += 1; |
|
1854 |
- /* printf("Incrementing Ilength to be %d\n",Ilength); */ |
|
1855 |
- |
|
1856 |
- } else { |
|
1857 |
- Mlength += 1; |
|
1858 |
- /* printf("Incrementing Mlength to be %d\n",Mlength); */ |
|
1859 |
- } |
|
1860 |
- r--; c--; |
|
1861 |
- |
|
1862 |
- } else if (dir == HORIZ) { |
|
1863 |
- /* printf("At r %d, c %d, dir is HORIZ\n",r,c); */ |
|
1864 |
- |
|
1865 |
- if (startp == true && Ilength > 0 && Ilength != insertion_width) { |
|
1866 |
- /* Incomplete insertion at beginning. Mlength_postins should be 0. */ |
|
1867 |
- sprintf(token,"%dS",Ilength); |
|
1868 |
- tokens = push_token(&startp,tokens,token); |
|
1869 |
- sprintf(token,"%dM",Mlength); |
|
1870 |
- tokens = push_token(&startp,tokens,token); |
|
1871 |
- } else { |
|
1872 |
- if (Ilength > 0) { |
|
1873 |
- sprintf(token,"%dM",Mlength_postins); |
|
1874 |
- tokens = push_token(&startp,tokens,token); |
|
1875 |
- sprintf(token,"%dI",Ilength); |
|
1876 |
- tokens = push_token(&startp,tokens,token); |
|
1877 |
- } |
|
1878 |
- if (1 || Mlength > 0) { |
|
1879 |
- sprintf(token,"%dM",Mlength); |
|
1880 |
- tokens = push_token(&startp,tokens,token); |
|
1881 |
- } |
|
1882 |
- } |
|
1883 |
- Mlength = 0; |
|
1884 |
- |
|
1885 |
- dist = 1; |
|
1886 |
- while (c > 1 && directions_Egap[c][r] != DIAG) { |
|
1887 |
- dist++; |
|
1888 |
- c--; |
|
1889 |
- } |
|
1890 |
- c--; |
|
1891 |
- /* dir = directions_nogap[c][r]; */ |
|
1892 |
- |
|
1893 |
- sprintf(token,"%dD",dist); |
|
1894 |
- tokens = push_token(&startp,tokens,token); |
|
1895 |
- |
|
1896 |
- } else { |
|
1897 |
- /* Must be VERT */ |
|
1898 |
- /* printf("At r %d, c %d, dir is VERT\n",r,c); */ |
|
1899 |
- if (Ilength == 0) { |
|
1900 |
- if (1 || Mlength > 0) { |
|
1901 |
- sprintf(token,"%dM",Mlength); |
|
1902 |
- tokens = push_token(&startp,tokens,token); |
|
1903 |
- Mlength = 0; |
|
1904 |
- } |
|
1905 |
- } |
|
1906 |
- |
|
1907 |
- Ilength += 1; |
|
1908 |
- while (r > 1 && directions_Fgap[c][r] != DIAG) { |
|
1909 |
- Ilength += 1; |
|
1910 |
- r--; |
|
1911 |
- } |
|
1912 |
- r--; |
|
1913 |
- /* dir = directions_nogap[c][r]; */ |
|
1914 |
- |
|
1915 |
- sprintf(token,"%dI",Ilength); |
|
1916 |
- tokens = push_token(&startp,tokens,token); |
|
1917 |
- Ilength = 0; |
|
1918 |
- } |
|
1919 |
- } |
|
1920 |
- |
|
1921 |
- if (Ilength > 0 && Ilength != insertion_width) { |
|
1922 |
- if (Mlength_postins > 0) { |
|
1923 |
- sprintf(token,"%dM",Mlength_postins); |
|
1924 |
- tokens = push_token(&startp,tokens,token); |
|
1925 |
- } |
|
1926 |
- sprintf(token,"%dS",Ilength); |
|
1927 |
- tokens = push_token(&startp,tokens,token); |
|
1928 |
- if (Mlength > 0) { |
|
1929 |
- sprintf(token,"%dM",Mlength); |
|
1930 |
- tokens = push_token(&startp,tokens,token); |
|
1931 |
- } |
|
1932 |
- } else { |
|
1933 |
- if (Ilength > 0) { |
|
1934 |
- sprintf(token,"%dM",Mlength_postins); |
|
1935 |
- tokens = push_token(&startp,tokens,token); |
|
1936 |
- sprintf(token,"%dI",Ilength); |
|
1937 |
- tokens = push_token(&startp,tokens,token); |
|
1938 |
- } |
|
1939 |
- if (1 || Mlength > 0) { |
|
1940 |
- sprintf(token,"%dM",Mlength); |
|
1941 |
- tokens = push_token(&startp,tokens,token); |
|
1942 |
- } |
|
1943 |
- } |
|
1944 |
- |
|
1945 |
- *finalc = c; |
|
1946 |
- tokens = List_reverse(tokens); |
|
1947 |
- cigar = Dynprog_tokens_string(List_reverse(tokens)); |
|
1948 |
- Dynprog_tokens_free(&tokens); |
|
1949 |
- |
|
1950 |
- return cigar; |
|
1951 |
-} |
... | ... |
@@ -1,4 +1,4 @@ |
1 |
-/* $Id: dynprog.h 133170 2014-04-14 23:43:26Z twu $ */ |
|
1 |
+/* $Id: dynprog.h 136514 2014-05-16 17:59:19Z twu $ */ |
|
2 | 2 |
#ifndef DYNPROG_INCLUDED |
3 | 3 |
#define DYNPROG_INCLUDED |
4 | 4 |
|
... | ... |
@@ -54,9 +54,11 @@ typedef int Direction32_T; |
54 | 54 |
#define DIAG 0 /* Pre-dominant case. Directions_alloc clears to this value. */ |
55 | 55 |
|
56 | 56 |
#define NEG_INFINITY_8 (-128) |
57 |
+#define POS_INFINITY_8 (127) |
|
57 | 58 |
#define MAX_CHAR (127) |
58 | 59 |
|
59 | 60 |
#define NEG_INFINITY_16 (-32768) |
61 |
+#define POS_INFINITY_16 (32767) |
|
60 | 62 |
#define MAX_SHORT (32767) |
61 | 63 |
|
62 | 64 |
/* We can allow -128 and -32768 for NEG_INFINITY in SIMD procedures, |
... | ... |
@@ -85,6 +87,7 @@ extern Pairdistance_T **pairdistance_array[NMISMATCHTYPES]; |
85 | 87 |
extern Pairdistance_T **pairdistance_array_plus_128[NMISMATCHTYPES]; |
86 | 88 |
#endif |
87 | 89 |
extern bool **consistent_array; |
90 |
+extern int *nt_to_int_array; |
|
88 | 91 |
|
89 | 92 |
|
90 | 93 |
struct Space_single_T { |
... | ... |
@@ -171,14 +174,6 @@ Dynprog_tokens_string (List_T tokens); |
171 | 174 |
extern void |
172 | 175 |
Dynprog_tokens_free (List_T *tokens); |
173 | 176 |
|
174 |
-extern char * |
|
175 |
-Dynprog_cigar_std (int *finalc, Direction32_T **directions_nogap, Direction32_T **directions_Egap, |
|
176 |
- Direction32_T **directions_Fgap, |
|
177 |
- int r, int c, char *rsequence, char *gsequence, char *gsequence_alt, |
|
178 |
- char *nindels, int queryoffset, int genomeoffset, bool revp, |
|
179 |
- Univcoord_T chroffset, Univcoord_T chrhigh); |
|
180 |
- |
|
181 |
- |
|
182 | 177 |
#undef T |
183 | 178 |
#endif |
184 | 179 |
|
... | ... |
@@ -1,4 +1,4 @@ |
1 |
-static char rcsid[] = "$Id: dynprog_simd.c 133254 2014-04-15 18:56:28Z twu $"; |
|
1 |
+static char rcsid[] = "$Id: dynprog_simd.c 136516 2014-05-16 18:00:16Z twu $"; |
|
2 | 2 |
#ifdef HAVE_CONFIG_H |
3 | 3 |
#include <config.h> |
4 | 4 |
#endif |
... | ... |
@@ -17,6 +17,18 @@ static char rcsid[] = "$Id: dynprog_simd.c 133254 2014-04-15 18:56:28Z twu $"; |
17 | 17 |
#endif |
18 | 18 |
|
19 | 19 |
#include "mem.h" |
20 |
+#include "assert.h" |
|
21 |
+ |
|
22 |
+ |
|
23 |
+#define LAZY_INDEL 1 /* Don't advance to next coordinate on final indel, since could go over chromosome bounds. */ |
|
24 |
+ |
|
25 |
+/* Row 0 and column 0 directions */ |
|
26 |
+/* Was useful in finding a saturation bug, but can fail because of saturation */ |
|
27 |
+#ifdef CHECK1 |
|
28 |
+#define check1(x) x |
|
29 |
+#else |
|
30 |
+#define check1(x) |
|
31 |
+#endif |
|
20 | 32 |
|
21 | 33 |
|
22 | 34 |
#ifdef DEBUG |
... | ... |
@@ -31,13 +43,19 @@ static char rcsid[] = "$Id: dynprog_simd.c 133254 2014-04-15 18:56:28Z twu $"; |
31 | 43 |
#define debug2(x) |
32 | 44 |
#endif |
33 | 45 |
|
34 |
-/* F loop */ |
|
46 |
+/* Fgap */ |
|
35 | 47 |
#ifdef DEBUG3 |
36 | 48 |
#define debug3(x) x |
37 | 49 |
#else |
38 | 50 |
#define debug3(x) |
39 | 51 |
#endif |
40 | 52 |
|
53 |
+#ifdef DEBUG8 |
|
54 |
+#define debug8(x) x |
|
55 |
+#else |
|
56 |
+#define debug8(x) |
|
57 |
+#endif |
|
58 |
+ |
|
41 | 59 |
#ifdef DEBUG14 |
42 | 60 |
#define debug14(x) x |
43 | 61 |
#else |
... | ... |
@@ -52,13 +70,13 @@ static char rcsid[] = "$Id: dynprog_simd.c 133254 2014-04-15 18:56:28Z twu $"; |
52 | 70 |
|
53 | 71 |
|
54 | 72 |
|
55 |
-/************************************************************************ |
|
56 |
- * Debugging procedures |
|
57 |
- ************************************************************************/ |
|
58 |
- |
|
73 |
+#include "complement.h" |
|
59 | 74 |
#define NEG_INFINITY_DISPLAY -99 |
60 | 75 |
|
61 | 76 |
|
77 |
+/************************************************************************ |
|
78 |
+ * Debugging procedures |
|
79 |
+ ************************************************************************/ |
|
62 | 80 |
|
63 | 81 |
#ifdef DEBUG15 |
64 | 82 |
/* For debugging of SIMD procedures*/ |
... | ... |
@@ -87,20 +105,27 @@ print_vector_16 (__m128i x, int r, int c, char *label) { |
87 | 105 |
#endif |
88 | 106 |
|
89 | 107 |
|
90 |
-#if defined(DEBUG2) || defined(DEBUG14) |
|
108 |
+#if defined(DEBUG14) || defined(DEBUG2) |
|
91 | 109 |
static void |
92 | 110 |
Matrix8_print (Score8_T **matrix, int rlength, int glength, char *rsequence, |
93 | 111 |
char *gsequence, char *gsequencealt, |
94 |
-#ifdef DEBUG14 |
|
95 |
- int goffset, Univcoord_T chroffset, Univcoord_T chrhigh, bool watsonp, |
|
96 |
-#endif |
|
97 | 112 |
bool revp, int lband, int uband) { |
98 | 113 |
int i, j; |
99 |
- char g_alt; |
|
114 |
+ char g, g_alt; |
|
100 | 115 |
|
101 | 116 |
_mm_lfence(); |
102 | 117 |
|
118 |
+ /* j */ |
|
119 |
+ printf(" "); /* For i */ |
|
120 |
+ printf(" "); |
|
121 |
+ for (j = 0; j <= glength; ++j) { |
|
122 |
+ printf(" %2d ",j); |
|
123 |
+ } |
|
124 |
+ printf("\n"); |
|
125 |
+ |
|
126 |
+ |
|
103 | 127 |
if (gsequence) { |
128 |
+ printf(" "); /* For i */ |
|
104 | 129 |
printf(" "); |
105 | 130 |
for (j = 0; j <= glength; ++j) { |
106 | 131 |
if (j == 0) { |
... | ... |
@@ -112,23 +137,27 @@ Matrix8_print (Score8_T **matrix, int rlength, int glength, char *rsequence, |
112 | 137 |
printf("\n"); |
113 | 138 |
} |
114 | 139 |
|
115 |
-#if 0 |
|
116 |
- printf(" "); |
|
117 |
- for (j = 0; j <= glength; ++j) { |
|
118 |
- if (j == 0) { |
|
119 |
- printf(" "); |
|
120 |
- } else { |
|
121 |
- if (revp == false) { |
|
122 |
- printf(" %c ",get_genomic_nt(&g_alt,goffset+j-1,chroffset,chrhigh,watsonp)); |
|
140 |
+ if (gsequencealt != gsequence) { |
|
141 |
+ printf(" "); /* For i */ |
|
142 |
+ printf(" "); |
|
143 |
+ for (j = 0; j <= glength; ++j) { |
|
144 |
+ if (j == 0) { |
|
145 |
+ printf(" "); |
|
123 | 146 |
} else { |
124 |
- printf(" %c ",get_genomic_nt(&g_alt,goffset+1-j,chroffset,chrhigh,watsonp)); |
|
147 |
+ g = revp ? gsequence[-j+1] : gsequence[j-1]; |
|
148 |
+ g_alt = revp ? gsequencealt[-j+1] : gsequencealt[j-1]; |
|
149 |
+ if (g == g_alt) { |
|
150 |
+ printf(" %c ",' '); |
|
151 |
+ } else { |
|
152 |
+ printf(" %c ",g_alt); |
|
153 |
+ } |
|
125 | 154 |
} |
126 | 155 |
} |
156 |
+ printf("\n"); |
|
127 | 157 |
} |
128 |
- printf("\n"); |
|
129 |
-#endif |
|
130 | 158 |
|
131 | 159 |
for (i = 0; i <= rlength; ++i) { |
160 |
+ printf("%2d ",i); |
|
132 | 161 |
if (i == 0) { |
133 | 162 |
printf(" "); |
134 | 163 |
} else { |
... | ... |
@@ -152,19 +181,114 @@ Matrix8_print (Score8_T **matrix, int rlength, int glength, char *rsequence, |
152 | 181 |
return; |
153 | 182 |
} |
154 | 183 |
|
184 |
+static void |
|
185 |
+Matrix8_print_ud (Score8_T **matrix, int rlength, int glength, char *rsequence, |
|
186 |
+ char *gsequence, char *gsequencealt, |
|
187 |
+ bool revp, int band, bool upperp) { |
|
188 |
+ int i, j; |
|
189 |
+ char g, g_alt; |
|
190 |
+ |
|
191 |
+ _mm_lfence(); |
|
192 |
+ |
|
193 |
+ /* j */ |
|
194 |
+ printf(" "); /* For i */ |
|
195 |
+ printf(" "); |
|
196 |
+ for (j = 0; j <= glength; ++j) { |
|
197 |
+ printf(" %2d ",j); |
|
198 |
+ } |
|
199 |
+ printf("\n"); |
|
200 |
+ |
|
201 |
+ if (gsequence) { |
|
202 |
+ printf(" "); /* For i */ |
|
203 |
+ printf(" "); |
|
204 |
+ for (j = 0; j <= glength; ++j) { |
|
205 |
+ if (j == 0) { |
|
206 |
+ printf(" "); |
|
207 |
+ } else { |
|
208 |
+ printf(" %c ",revp ? gsequence[-j+1] : gsequence[j-1]); |
|
209 |
+ } |
|
210 |
+ } |
|
211 |
+ printf("\n"); |
|
212 |
+ } |
|
213 |
+ |
|
214 |
+ if (gsequencealt != gsequence) { |
|
215 |
+ printf(" "); /* For i */ |
|
216 |
+ printf(" "); |
|
217 |
+ for (j = 0; j <= glength; ++j) { |
|
218 |
+ if (j == 0) { |
|
219 |
+ printf(" "); |
|
220 |
+ } else { |
|
221 |
+ g = revp ? gsequence[-j+1] : gsequence[j-1]; |
|
222 |
+ g_alt = revp ? gsequencealt[-j+1] : gsequencealt[j-1]; |
|
223 |
+ if (g == g_alt) { |
|
224 |
+ printf(" %c ",' '); |
|
225 |
+ } else { |
|
226 |
+ printf(" %c ",g_alt); |
|
227 |
+ } |
|
228 |
+ } |
|
229 |
+ } |
|
230 |
+ printf("\n"); |
|
231 |
+ } |
|
232 |
+ |
|
233 |
+ for (i = 0; i <= rlength; ++i) { |
|
234 |
+ printf("%2d ",i); |
|
235 |
+ if (i == 0) { |
|
236 |
+ printf(" "); |
|
237 |
+ } else { |
|
238 |
+ printf("%c ",revp ? rsequence[-i+1] : rsequence[i-1]); |
|
239 |
+ } |
|
240 |
+ if (upperp == true) { |
|
241 |
+ for (j = 0; j <= glength; ++j) { |
|
242 |
+ if (j < i) { |
|
243 |
+ printf(" . "); |
|
244 |
+ } else if (j > i + band) { |
|
245 |
+ printf(" . "); |
|
246 |
+ } else if (matrix[j][i] < NEG_INFINITY_DISPLAY) { |
|
247 |
+ printf("%3d ",NEG_INFINITY_DISPLAY); |
|
248 |
+ } else { |
|
249 |
+ printf("%3d ",matrix[j][i]); |
|
250 |
+ } |
|
251 |
+ } |
|
252 |
+ } else { |
|
253 |
+ for (j = 0; j <= glength; ++j) { |
|
254 |
+ if (i < j) { |
|
255 |
+ printf(" . "); |
|
256 |
+ } else if (i > j + band) { |
|
257 |
+ printf(" . "); |
|
258 |
+ } else if (matrix[i][j] < NEG_INFINITY_DISPLAY) { |
|
259 |
+ printf("%3d ",NEG_INFINITY_DISPLAY); |
|
260 |
+ } else { |
|
261 |
+ printf("%3d ",matrix[i][j]); |
|
262 |
+ } |
|
263 |
+ } |
|
264 |
+ } |
|
265 |
+ printf("\n"); |
|
266 |
+ } |
|
267 |
+ printf("\n"); |
|
268 |
+ |
|
269 |
+ return; |
|
270 |
+} |
|
271 |
+ |
|
272 |
+ |
|
155 | 273 |
static void |
156 | 274 |
Matrix16_print (Score16_T **matrix, int rlength, int glength, char *rsequence, |
157 | 275 |
char *gsequence, char *gsequencealt, |
158 |
-#ifdef DEBUG14 |
|
159 |
- int goffset, Univcoord_T chroffset, Univcoord_T chrhigh, bool watsonp, |
|
160 |
-#endif |
|
161 | 276 |
bool revp, int lband, int uband) { |
162 | 277 |
int i, j; |
163 |
- char g_alt; |
|
278 |
+ char g, g_alt; |
|
164 | 279 |
|
165 | 280 |
_mm_lfence(); |
166 | 281 |
|
282 |
+ /* j */ |
|
283 |
+ printf(" "); /* For i */ |
|
284 |
+ printf(" "); |
|
285 |
+ for (j = 0; j <= glength; ++j) { |
|
286 |
+ printf(" %2d ",j); |
|
287 |
+ } |
|
288 |
+ printf("\n"); |
|
289 |
+ |
|
167 | 290 |
if (gsequence) { |
291 |
+ printf(" "); /* For i */ |
|
168 | 292 |
printf(" "); |
169 | 293 |
for (j = 0; j <= glength; ++j) { |
170 | 294 |
if (j == 0) { |
... | ... |
@@ -176,23 +300,27 @@ Matrix16_print (Score16_T **matrix, int rlength, int glength, char *rsequence, |
176 | 300 |
printf("\n"); |
177 | 301 |
} |
178 | 302 |
|
179 |
-#if 0 |
|
180 |
- printf(" "); |
|
181 |
- for (j = 0; j <= glength; ++j) { |
|
182 |
- if (j == 0) { |
|
183 |
- printf(" "); |
|
184 |
- } else { |
|
185 |
- if (revp == false) { |
|
186 |
- printf(" %c ",get_genomic_nt(&g_alt,goffset+j-1,chroffset,chrhigh,watsonp)); |
|
303 |
+ if (gsequencealt != gsequence) { |
|
304 |
+ printf(" "); /* For i */ |
|
305 |
+ printf(" "); |
|
306 |
+ for (j = 0; j <= glength; ++j) { |
|
307 |
+ if (j == 0) { |
|
308 |
+ printf(" "); |
|
187 | 309 |
} else { |
188 |
- printf(" %c ",get_genomic_nt(&g_alt,goffset+1-j,chroffset,chrhigh,watsonp)); |
|
310 |
+ g = revp ? gsequence[-j+1] : gsequence[j-1]; |
|
311 |
+ g_alt = revp ? gsequencealt[-j+1] : gsequencealt[j-1]; |
|
312 |
+ if (g == g_alt) { |
|
313 |
+ printf(" %c ",' '); |
|
314 |
+ } else { |
|
315 |
+ printf(" %c ",g_alt); |
|
316 |
+ } |
|
189 | 317 |
} |
190 | 318 |
} |
319 |
+ printf("\n"); |
|
191 | 320 |
} |
192 |
- printf("\n"); |
|
193 |
-#endif |
|
194 | 321 |
|
195 | 322 |
for (i = 0; i <= rlength; ++i) { |
323 |
+ printf("%2d ",i); |
|
196 | 324 |
if (i == 0) { |
197 | 325 |
printf(" "); |
198 | 326 |
} else { |
... | ... |
@@ -216,105 +344,115 @@ Matrix16_print (Score16_T **matrix, int rlength, int glength, char *rsequence, |
216 | 344 |
return; |
217 | 345 |
} |
218 | 346 |
|
219 |
-#endif |
|
220 |
- |
|
221 |
-#if defined(DEBUG2) || defined(DEBUG14) |
|
222 | 347 |
static void |
223 |
-Directions8_print (Direction8_T **directions_nogap, Direction8_T **directions_Egap, Direction8_T **directions_Fgap, |
|
224 |
- int rlength, int glength, char *rsequence, char *gsequence, char *gsequence_alt, |
|
225 |
-#ifdef DEBUG14 |
|
226 |
- int goffset, Univcoord_T chroffset, Univcoord_T chrhigh, bool watsonp, |
|
227 |
-#endif |
|
228 |
- bool revp, int lband, int uband) { |
|
348 |
+Matrix16_print_ud (Score16_T **matrix, int rlength, int glength, char *rsequence, |
|
349 |
+ char *gsequence, char *gsequencealt, |
|
350 |
+ bool revp, int band, bool upperp) { |
|
229 | 351 |
int i, j; |
230 |
- char g_alt; |
|
352 |
+ char g, g_alt; |
|
231 | 353 |
|
232 | 354 |
_mm_lfence(); |
233 | 355 |
|
356 |
+ /* j */ |
|
357 |
+ printf(" "); /* For i */ |
|
358 |
+ printf(" "); |
|
359 |
+ for (j = 0; j <= glength; ++j) { |
|
360 |
+ printf(" %2d ",j); |
|
361 |
+ } |
|
362 |
+ printf("\n"); |
|
363 |
+ |
|
234 | 364 |
if (gsequence) { |
365 |
+ printf(" "); /* For i */ |
|
235 | 366 |
printf(" "); |
236 | 367 |
for (j = 0; j <= glength; ++j) { |
237 | 368 |
if (j == 0) { |
238 |
- printf(" "); |
|
369 |
+ printf(" "); |
|
239 | 370 |
} else { |
240 |
- printf(" %c ",revp ? gsequence[-j+1] : gsequence[j-1]); |
|
371 |
+ printf(" %c ",revp ? gsequence[-j+1] : gsequence[j-1]); |
|
241 | 372 |
} |
242 | 373 |
} |
243 | 374 |
printf("\n"); |
244 | 375 |
} |
245 | 376 |
|
246 |
-#if 0 |
|
247 |
- printf(" "); |
|
248 |
- for (j = 0; j <= glength; ++j) { |
|
249 |
- if (j == 0) { |
|
250 |
- printf(" "); |
|
251 |
- } else { |
|
252 |
- if (revp == false) { |
|
253 |
- printf(" %c ",get_genomic_nt(&g_alt,goffset+j-1,chroffset,chrhigh,watsonp)); |
|
377 |
+ if (gsequencealt != gsequence) { |
|
378 |
+ printf(" "); /* For i */ |
|
379 |
+ printf(" "); |
|
380 |
+ for (j = 0; j <= glength; ++j) { |
|
381 |
+ if (j == 0) { |
|
382 |
+ printf(" "); |
|
254 | 383 |
} else { |
255 |
- printf(" %c ",get_genomic_nt(&g_alt,goffset+1-j,chroffset,chrhigh,watsonp)); |
|
384 |
+ g = revp ? gsequence[-j+1] : gsequence[j-1]; |
|
385 |
+ g_alt = revp ? gsequencealt[-j+1] : gsequencealt[j-1]; |
|
386 |
+ if (g == g_alt) { |
|
387 |
+ printf(" %c ",' '); |
|
388 |
+ } else { |
|
389 |
+ printf(" %c ",g_alt); |
|
390 |
+ } |
|
256 | 391 |
} |
257 | 392 |
} |
393 |
+ printf("\n"); |
|
258 | 394 |
} |
259 |
- printf("\n"); |
|
260 |
-#endif |
|
261 | 395 |
|
262 | 396 |
for (i = 0; i <= rlength; ++i) { |
397 |
+ printf("%2d ",i); |
|
263 | 398 |
if (i == 0) { |
264 | 399 |
printf(" "); |
265 | 400 |
} else { |
266 | 401 |
printf("%c ",revp ? rsequence[-i+1] : rsequence[i-1]); |
267 | 402 |
} |
268 |
- for (j = 0; j <= glength; ++j) { |
|
269 |
- if (j < i - lband) { |
|
270 |
- printf(" "); |
|
271 |
- } else if (j > i + uband) { |
|
272 |
- printf(" "); |
|
273 |
- } else { |
|
274 |
- if (directions_Egap[j][i] == DIAG) { |
|
275 |
- printf("D"); |
|
276 |
- } else { |
|
277 |
- /* Must be HORIZ */ |
|
278 |
- printf("H"); |
|
279 |
- } |
|
280 |
- printf("|"); |
|
281 |
- if (directions_nogap[j][i] == DIAG) { |
|
282 |
- printf("D"); |
|
283 |
- } else if (directions_nogap[j][i] == HORIZ) { |
|
284 |
- printf("H"); |
|
403 |
+ if (upperp == true) { |
|
404 |
+ for (j = 0; j <= glength; ++j) { |
|
405 |
+ if (j < i) { |
|
406 |
+ printf(" . "); |
|
407 |
+ } else if (j > i + band) { |
|
408 |
+ printf(" . "); |
|
409 |
+ } else if (matrix[j][i] < NEG_INFINITY_DISPLAY) { |
|
410 |
+ printf("%3d ",NEG_INFINITY_DISPLAY); |
|
285 | 411 |
} else { |
286 |
- /* Must be VERT */ |
|
287 |
- printf("V"); |
|
412 |
+ printf("%3d ",matrix[j][i]); |
|
288 | 413 |
} |
289 |
- printf("|"); |
|
290 |
- if (directions_Fgap[j][i] == DIAG) { |
|
291 |
- printf("D"); |
|
414 |
+ } |
|
415 |
+ } else { |
|
416 |
+ for (j = 0; j <= glength; ++j) { |
|
417 |
+ if (i < j) { |
|
418 |
+ printf(" . "); |
|
419 |
+ } else if (i > j + band) { |
|
420 |
+ printf(" . "); |
|
421 |
+ } else if (matrix[i][j] < NEG_INFINITY_DISPLAY) { |
|
422 |
+ printf("%3d ",NEG_INFINITY_DISPLAY); |
|
292 | 423 |
} else { |
293 |
- /* Must be VERT */ |
|
294 |
- printf("V"); |
|
424 |
+ printf("%3d ",matrix[i][j]); |
|
295 | 425 |
} |
296 | 426 |
} |
297 |
- printf(" "); |
|
298 | 427 |
} |
299 | 428 |
printf("\n"); |
300 | 429 |
} |
301 | 430 |
printf("\n"); |
431 |
+ |
|
302 | 432 |
return; |
303 | 433 |
} |
434 |
+#endif |
|
304 | 435 |
|
436 |
+#if defined(DEBUG14) || defined(DEBUG2) |
|
305 | 437 |
static void |
306 |
-Directions16_print (Direction16_T **directions_nogap, Direction16_T **directions_Egap, Direction16_T **directions_Fgap, |
|
307 |
- int rlength, int glength, char *rsequence, char *gsequence, char *gsequence_alt, |
|
308 |
-#ifdef DEBUG14 |
|
309 |
- int goffset, Univcoord_T chroffset, Univcoord_T chrhigh, bool watsonp, |
|
310 |
-#endif |
|
311 |
- bool revp, int lband, int uband) { |
|
438 |
+Directions8_print (Direction8_T **directions_nogap, Direction8_T **directions_Egap, Direction8_T **directions_Fgap, |
|
439 |
+ int rlength, int glength, char *rsequence, char *gsequence, char *gsequencealt, |
|
440 |
+ bool revp, int lband, int uband) { |
|
312 | 441 |
int i, j; |
313 |
- char g_alt; |
|
442 |
+ char g, g_alt; |
|
314 | 443 |
|
315 | 444 |
_mm_lfence(); |
316 | 445 |
|
446 |
+ /* j */ |
|
447 |
+ printf(" "); /* For i */ |
|
448 |
+ printf(" "); |
|
449 |
+ for (j = 0; j <= glength; ++j) { |
|
450 |
+ printf(" %2d ",j); |
|
451 |
+ } |
|
452 |
+ printf("\n"); |
|
453 |
+ |
|
317 | 454 |
if (gsequence) { |
455 |
+ printf(" "); /* For i */ |
|
318 | 456 |
printf(" "); |
319 | 457 |
for (j = 0; j <= glength; ++j) { |
320 | 458 |
if (j == 0) { |
... | ... |
@@ -326,23 +464,27 @@ Directions16_print (Direction16_T **directions_nogap, Direction16_T **directions |
326 | 464 |
printf("\n"); |
327 | 465 |
} |
328 | 466 |
|
329 |
-#if 0 |
|
330 |
- printf(" "); |
|
331 |
- for (j = 0; j <= glength; ++j) { |
|
332 |
- if (j == 0) { |
|
333 |
- printf(" "); |
|
334 |
- } else { |
|
335 |
- if (revp == false) { |
|
336 |
- printf(" %c ",get_genomic_nt(&g_alt,goffset+j-1,chroffset,chrhigh,watsonp)); |
|
467 |
+ if (gsequencealt != gsequence) { |
|
468 |
+ printf(" "); /* For i */ |
|
469 |
+ printf(" "); |
|
470 |
+ for (j = 0; j <= glength; ++j) { |
|
471 |
+ if (j == 0) { |
|
472 |
+ printf(" "); |
|
337 | 473 |
} else { |
338 |
- printf(" %c ",get_genomic_nt(&g_alt,goffset+1-j,chroffset,chrhigh,watsonp)); |
|
474 |
+ g = revp ? gsequence[-j+1] : gsequence[j-1]; |
|
475 |
+ g_alt = revp ? gsequencealt[-j+1] : gsequencealt[j-1]; |
|
476 |
+ if (g == g_alt) { |
|
477 |
+ printf(" %c ",' '); |
|
478 |
+ } else { |
|
479 |
+ printf(" %c ",g_alt); |
|
480 |
+ } |
|
339 | 481 |
} |
340 | 482 |
} |
483 |
+ printf("\n"); |
|
341 | 484 |
} |
342 |
- printf("\n"); |
|
343 |
-#endif |
|
344 | 485 |
|
345 | 486 |
for (i = 0; i <= rlength; ++i) { |
487 |
+ printf("%2d ",i); |
|
346 | 488 |
if (i == 0) { |
347 | 489 |
printf(" "); |
348 | 490 |
} else { |
... | ... |
@@ -385,53 +527,360 @@ Directions16_print (Direction16_T **directions_nogap, Direction16_T **directions |
385 | 527 |
return; |
386 | 528 |
} |
387 | 529 |
|
388 |
-#endif |
|
389 |
- |
|
390 |
- |
|
391 |
- |
|
392 |
-#ifdef DEBUG14 |
|
393 | 530 |
static void |
394 |
-banded_matrix8_compare (Score8_T **matrix1, Score32_T **matrix2, int rlength, int glength, |
|
395 |
- int lband, int uband, char *rsequence, char *gsequence, char *gsequence_alt, |
|
396 |
- int goffset, Univcoord_T chroffset, Univcoord_T chrhigh, bool watsonp, |
|
397 |
- bool revp) { |
|
398 |
- int r, c, rlo, rhigh; |
|
399 |
- |
|
400 |
- for (c = 1; c <= glength; c++) { |
|
401 |
- if ((rlo = c - uband) < 1) { |
|
402 |
- rlo = 1; |
|
403 |
- }; |
|
531 |
+Directions8_print_ud (Direction8_T **directions_nogap, Direction8_T **directions_Egap, |
|
532 |
+ int rlength, int glength, char *rsequence, char *gsequence, char *gsequencealt, |
|
533 |
+ bool revp, int band, bool upperp) { |
|
534 |
+ int i, j; |
|
535 |
+ char g, g_alt; |
|
404 | 536 |
|
405 |
- if ((rhigh = c + lband) > rlength) { |
|
406 |
- rhigh = rlength; |
|
407 |
- } |
|
537 |
+ _mm_lfence(); |
|
408 | 538 |
|
409 |
- for (r = rlo; r <= rhigh; r++) { |
|
410 |
- if (matrix1[c][r] <= NEG_INFINITY_8 + 30 && matrix2[c][r] <= NEG_INFINITY_8 + 30) { |
|
411 |
- /* Okay */ |
|
412 |
- } else if (matrix1[c][r] != matrix2[c][r]) { |
|
413 |
- printf("At %d,%d, value %d != value %d\n",r,c,matrix1[c][r],matrix2[c][r]); |
|
539 |
+ /* j */ |
|
540 |
+ printf(" "); /* For i */ |
|
541 |
+ printf(" "); |
|
542 |
+ for (j = 0; j <= glength; ++j) { |
|
543 |
+ printf(" %2d ",j); |
|
544 |
+ } |
|
545 |
+ printf("\n"); |
|
414 | 546 |
|
415 |
- Matrix8_print(matrix1,rlength,glength,rsequence,gsequence,gsequence_alt, |
|
416 |
- goffset,chroffset,chrhigh,watsonp,revp,lband,uband); |
|
417 |
- Dynprog_Matrix32_print(matrix2,rlength,glength,rsequence,gsequence,gsequence_alt, |
|
418 |
- goffset,chroffset,chrhigh,watsonp,revp,lband,uband); |
|
419 |
- exit(9); |
|
547 |
+ if (gsequence) { |
|
548 |
+ printf(" "); /* For i */ |
|
549 |
+ printf(" "); |
|
550 |
+ for (j = 0; j <= glength; ++j) { |
|
551 |
+ if (j == 0) { |
|
552 |
+ printf(" "); |
|
553 |
+ } else { |
|
554 |
+ printf(" %c ",revp ? gsequence[-j+1] : gsequence[j-1]); |
|
420 | 555 |
} |
421 | 556 |
} |
557 |
+ printf("\n"); |
|
422 | 558 |
} |
423 | 559 |
|
424 |
- return; |
|
425 |
-} |
|
426 |
- |
|
427 |
-static void |
|
428 |
-banded_matrix16_compare (Score16_T **matrix1, Score32_T **matrix2, int rlength, int glength, |
|
429 |
- int lband, int uband, char *rsequence, char *gsequence, char *gsequence_alt, |
|
430 |
- int goffset, Univcoord_T chroffset, Univcoord_T chrhigh, bool watsonp, |
|
431 |
- bool revp) { |
|
432 |
- int r, c, rlo, rhigh; |
|
560 |
+ if (gsequencealt != gsequence) { |
|
561 |
+ printf(" "); /* For i */ |
|
562 |
+ printf(" "); |
|
563 |
+ for (j = 0; j <= glength; ++j) { |
|
564 |
+ if (j == 0) { |
|
565 |
+ printf(" "); |
|
566 |
+ } else { |
|
567 |
+ g = revp ? gsequence[-j+1] : gsequence[j-1]; |
|
568 |
+ g_alt = revp ? gsequencealt[-j+1] : gsequencealt[j-1]; |
|
569 |
+ if (g == g_alt) { |
|
570 |
+ printf(" %c ",' '); |
|
571 |
+ } else { |
|
572 |
+ printf(" %c ",g_alt); |
|
573 |
+ } |
|
574 |
+ } |
|
575 |
+ } |
|
576 |
+ printf("\n"); |
|
577 |
+ } |
|
433 | 578 |
|
434 |
- for (c = 1; c <= glength; c++) { |
|
579 |
+ for (i = 0; i <= rlength; ++i) { |
|
580 |
+ printf("%2d ",i); |
|
581 |
+ if (i == 0) { |
|
582 |
+ printf(" "); |
|
583 |
+ } else { |
|
584 |
+ printf("%c ",revp ? rsequence[-i+1] : rsequence[i-1]); |
|
585 |
+ } |
|
586 |
+ if (upperp == true) { |
|
587 |
+ for (j = 0; j <= glength; ++j) { |
|
588 |
+ if (j < i) { |
|
589 |
+ printf(" "); |
|
590 |
+ } else if (j > i + band) { |
|
591 |
+ printf(" "); |
|
592 |
+ } else { |
|
593 |
+ if (directions_Egap[j][i] == DIAG) { |
|
594 |
+ printf("D"); |
|
595 |
+ } else { |
|
596 |
+ printf("-"); |
|
597 |
+ } |
|
598 |
+ printf("|"); |
|
599 |
+ if (directions_nogap[j][i] == DIAG) { |
|
600 |
+ printf("D"); |
|
601 |
+ } else { |
|
602 |
+ printf("-"); |
|
603 |
+ } |
|
604 |
+ } |
|
605 |
+ printf(" "); /* For Fgap */ |
|
606 |
+ printf(" "); |
|
607 |
+ } |
|
608 |
+ } else { |
|
609 |
+ for (j = 0; j <= glength; ++j) { |
|
610 |
+ printf(" "); /* For Fgap */ |
|
611 |
+ if (i < j) { |
|
612 |
+ printf(" "); |
|
613 |
+ } else if (i > j + band) { |
|
614 |
+ printf(" "); |
|
615 |
+ } else { |
|
616 |
+ if (directions_nogap[i][j] == DIAG) { |
|
617 |
+ printf("D"); |
|
618 |
+ } else { |
|
619 |
+ printf("-"); |
|
620 |
+ } |
|
621 |
+ printf("|"); |
|
622 |
+ if (directions_Egap[i][j] == DIAG) { |
|
623 |
+ printf("D"); |
|
624 |
+ } else { |
|
625 |
+ printf("-"); |
|
626 |
+ } |
|
627 |
+ } |
|
628 |
+ printf(" "); |
|
629 |
+ } |
|
630 |
+ } |
|
631 |
+ printf("\n"); |
|
632 |
+ } |
|
633 |
+ printf("\n"); |
|
634 |
+ return; |
|
635 |
+} |
|
636 |
+ |
|
637 |
+ |
|
638 |
+static void |
|
639 |
+Directions16_print (Direction16_T **directions_nogap, Direction16_T **directions_Egap, Direction16_T **directions_Fgap, |
|
640 |
+ int rlength, int glength, char *rsequence, char *gsequence, char *gsequencealt, |
|
641 |
+ bool revp, int lband, int uband) { |
|
642 |
+ int i, j; |
|
643 |
+ char g, g_alt; |
|
644 |
+ |
|
645 |
+ _mm_lfence(); |
|
646 |
+ |
|
647 |
+ /* j */ |
|
648 |
+ printf(" "); /* For i */ |
|
649 |
+ printf(" "); |
|
650 |
+ for (j = 0; j <= glength; ++j) { |
|
651 |
+ printf(" %2d ",j); |
|
652 |
+ } |
|
653 |
+ printf("\n"); |
|
654 |
+ |
|
655 |
+ if (gsequence) { |
|
656 |
+ printf(" "); /* For i */ |
|
657 |
+ printf(" "); |
|
658 |
+ for (j = 0; j <= glength; ++j) { |
|
659 |
+ if (j == 0) { |
|
660 |
+ printf(" "); |
|
661 |
+ } else { |
|
662 |
+ printf(" %c ",revp ? gsequence[-j+1] : gsequence[j-1]); |
|
663 |
+ } |
|
664 |
+ } |
|
665 |
+ printf("\n"); |
|
666 |
+ } |
|
667 |
+ |
|
668 |
+ if (gsequencealt != gsequence) { |
|
669 |
+ printf(" "); /* For i */ |
|
670 |
+ printf(" "); |
|
671 |
+ for (j = 0; j <= glength; ++j) { |
|
672 |
+ if (j == 0) { |
|
673 |
+ printf(" "); |
|
674 |
+ } else { |
|
675 |
+ g = revp ? gsequence[-j+1] : gsequence[j-1]; |
|
676 |
+ g_alt = revp ? gsequencealt[-j+1] : gsequencealt[j-1]; |
|
677 |
+ if (g == g_alt) { |
|
678 |
+ printf(" %c ",' '); |
|
679 |
+ } else { |
|
680 |
+ printf(" %c ",g_alt); |
|
681 |
+ } |
|
682 |
+ } |
|
683 |
+ } |
|
684 |
+ printf("\n"); |
|
685 |
+ } |
|
686 |
+ |
|
687 |
+ for (i = 0; i <= rlength; ++i) { |
|
688 |
+ printf("%2d ",i); |
|
689 |
+ if (i == 0) { |
|
690 |
+ printf(" "); |
|
691 |
+ } else { |
|
692 |
+ printf("%c ",revp ? rsequence[-i+1] : rsequence[i-1]); |
|
693 |
+ } |
|
694 |
+ for (j = 0; j <= glength; ++j) { |
|
695 |
+ if (j < i - lband) { |
|
696 |
+ printf(" "); |
|
697 |
+ } else if (j > i + uband) { |
|
698 |
+ printf(" "); |
|
699 |
+ } else { |
|
700 |
+ if (directions_Egap[j][i] == DIAG) { |
|
701 |
+ printf("D"); |
|
702 |
+ } else { |
|
703 |
+ /* Must be HORIZ */ |
|
704 |
+ printf("H"); |
|
705 |
+ } |
|
706 |
+ printf("|"); |
|
707 |
+ if (directions_nogap[j][i] == DIAG) { |
|
708 |
+ printf("D"); |
|
709 |
+ } else if (directions_nogap[j][i] == HORIZ) { |
|
710 |
+ printf("H"); |
|
711 |
+ } else { |
|
712 |
+ /* Must be VERT */ |
|
713 |
+ printf("V"); |
|
714 |
+ } |
|
715 |
+ printf("|"); |
|
716 |
+ if (directions_Fgap[j][i] == DIAG) { |
|
717 |
+ printf("D"); |
|
718 |
+ } else { |
|
719 |
+ /* Must be VERT */ |
|
720 |
+ printf("V"); |
|
721 |
+ } |
|
722 |
+ } |
|
723 |
+ printf(" "); |
|
724 |
+ } |
|
725 |
+ printf("\n"); |
|
726 |
+ } |
|
727 |
+ printf("\n"); |
|
728 |
+ return; |
|
729 |
+} |
|
730 |
+ |
|
731 |
+static void |
|
732 |
+Directions16_print_ud (Direction16_T **directions_nogap, Direction16_T **directions_Egap, |
|
733 |
+ int rlength, int glength, char *rsequence, char *gsequence, char *gsequencealt, |
|
734 |
+ bool revp, int band, bool upperp) { |
|
735 |
+ int i, j; |
|
736 |
+ char g, g_alt; |
|
737 |
+ |
|
738 |
+ _mm_lfence(); |
|
739 |
+ |
|
740 |
+ /* j */ |
|
741 |
+ printf(" "); /* For i */ |
|
742 |
+ printf(" "); |
|
743 |
+ for (j = 0; j <= glength; ++j) { |
|
744 |
+ printf(" %2d ",j); |
|
745 |
+ } |
|
746 |
+ printf("\n"); |
|
747 |
+ |
|
748 |
+ if (gsequence) { |
|
749 |
+ printf(" "); /* For i */ |
|
750 |
+ printf(" "); |
|
751 |
+ for (j = 0; j <= glength; ++j) { |
|
752 |
+ if (j == 0) { |
|
753 |
+ printf(" "); |
|
754 |
+ } else { |
|
755 |
+ printf(" %c ",revp ? gsequence[-j+1] : gsequence[j-1]); |
|
756 |
+ } |
|
757 |
+ } |
|
758 |
+ printf("\n"); |
|
759 |
+ } |
|
760 |
+ |
|
761 |
+ if (gsequencealt != gsequence) { |
|
762 |
+ printf(" "); /* For i */ |
|
763 |
+ printf(" "); |
|
764 |
+ for (j = 0; j <= glength; ++j) { |
|
765 |
+ if (j == 0) { |
|
766 |
+ printf(" "); |
|
767 |
+ } else { |
|
768 |
+ g = revp ? gsequence[-j+1] : gsequence[j-1]; |
|
769 |
+ g_alt = revp ? gsequencealt[-j+1] : gsequencealt[j-1]; |
|
770 |
+ if (g == g_alt) { |
|
771 |
+ printf(" %c ",' '); |
|
772 |
+ } else { |
|
773 |
+ printf(" %c ",g_alt); |
|
774 |
+ } |
|
775 |
+ } |
|
776 |
+ } |
|
777 |
+ printf("\n"); |
|
778 |
+ } |
|
779 |
+ |
|
780 |
+ for (i = 0; i <= rlength; ++i) { |
|
781 |
+ printf("%2d ",i); |
|
782 |
+ if (i == 0) { |
|
783 |
+ printf(" "); |
|
784 |
+ } else { |
|
785 |
+ printf("%c ",revp ? rsequence[-i+1] : rsequence[i-1]); |
|
786 |
+ } |
|
787 |
+ if (upperp == true) { |
|
788 |
+ for (j = 0; j <= glength; ++j) { |
|
789 |
+ if (j < i) { |
|
790 |
+ printf(" "); |
|
791 |
+ } else if (j > i + band) { |
|
792 |
+ printf(" "); |
|
793 |
+ } else { |
|
794 |
+ if (directions_Egap[j][i] == DIAG) { |
|
795 |
+ printf("D"); |
|
796 |
+ } else { |
|
797 |
+ printf("-"); |
|
798 |
+ } |
|
799 |
+ printf("|"); |
|
800 |
+ if (directions_nogap[j][i] == DIAG) { |
|
801 |
+ printf("D"); |
|
802 |
+ } else { |
|
803 |
+ printf("-"); |
|
804 |
+ } |
|
805 |
+ } |
|
806 |
+ printf(" "); /* For Fgap */ |
|
807 |
+ printf(" "); |
|
808 |
+ } |
|
809 |
+ } else { |
|
810 |
+ for (j = 0; j <= glength; ++j) { |
|
811 |
+ printf(" "); /* For Fgap */ |
|
812 |
+ if (i < j) { |
|
813 |
+ printf(" "); |
|
814 |
+ } else if (i > j + band) { |
|
815 |
+ printf(" "); |
|
816 |
+ } else { |
|
817 |
+ if (directions_nogap[i][j] == DIAG) { |
|
818 |
+ printf("D"); |
|
819 |
+ } else { |
|
820 |
+ printf("-"); |
|
821 |
+ } |
|
822 |
+ printf("|"); |
|
823 |
+ if (directions_Egap[i][j] == DIAG) { |
|
824 |
+ printf("D"); |
|
825 |
+ } else { |
|
826 |
+ printf("-"); |
|
827 |
+ } |
|
828 |
+ } |
|
829 |
+ printf(" "); |
|
830 |
+ } |
|
831 |
+ } |
|
832 |
+ printf("\n"); |
|
833 |
+ } |
|
834 |
+ printf("\n"); |
|
835 |
+ return; |
|
836 |
+} |
|
837 |
+#endif |
|
838 |
+ |
|
839 |
+ |
|
840 |
+ |
|
841 |
+#ifdef DEBUG14 |
|
842 |
+static void |
|
843 |
+banded_matrix8_compare (Score8_T **matrix1, Score32_T **matrix2, int rlength, int glength, |
|
844 |
+ int lband, int uband, char *rsequence, char *gsequence, char *gsequence_alt, |
|
845 |
+ int goffset, Univcoord_T chroffset, Univcoord_T chrhigh, bool watsonp, |
|
846 |
+ bool revp) { |
|
847 |
+ int r, c, rlo, rhigh; |
|
848 |
+ |
|
849 |
+ for (c = 1; c <= glength; c++) { |
|
850 |
+ if ((rlo = c - uband) < 1) { |
|
851 |
+ rlo = 1; |
|
852 |
+ }; |
|
853 |
+ |
|
854 |
+ if ((rhigh = c + lband) > rlength) { |
|
855 |
+ rhigh = rlength; |
|
856 |
+ } |
|
857 |
+ |
|
858 |
+ for (r = rlo; r <= rhigh; r++) { |
|
859 |
+ if (matrix1[c][r] <= NEG_INFINITY_8 + 30 && matrix2[c][r] <= NEG_INFINITY_8 + 30) { |
|
860 |
+ /* Okay */ |
|
861 |
+ } else if (matrix1[c][r] != matrix2[c][r]) { |
|
862 |
+ printf("At %d,%d, value %d != value %d\n",r,c,matrix1[c][r],matrix2[c][r]); |
|
863 |
+ |
|
864 |
+ Matrix8_print(matrix1,rlength,glength,rsequence,gsequence,gsequence_alt, |
|
865 |
+ revp,lband,uband); |
|
866 |
+ Dynprog_Matrix32_print(matrix2,rlength,glength,rsequence,gsequence,gsequence_alt, |
|
867 |
+ goffset,chroffset,chrhigh,watsonp,revp,lband,uband); |
|
868 |
+ exit(9); |
|
869 |
+ } |
|
870 |
+ } |
|
871 |
+ } |
|
872 |
+ |
|
873 |
+ return; |
|
874 |
+} |
|
875 |
+ |
|
876 |
+static void |
|
877 |
+banded_matrix16_compare (Score16_T **matrix1, Score32_T **matrix2, int rlength, int glength, |
|
878 |
+ int lband, int uband, char *rsequence, char *gsequence, char *gsequence_alt, |
|
879 |
+ int goffset, Univcoord_T chroffset, Univcoord_T chrhigh, bool watsonp, |
|
880 |
+ bool revp) { |
|
881 |
+ int r, c, rlo, rhigh; |
|
882 |
+ |
|
883 |
+ for (c = 1; c <= glength; c++) { |
|
435 | 884 |
if ((rlo = c - uband) < 1) { |
436 | 885 |
rlo = 1; |
437 | 886 |
}; |
... | ... |
@@ -748,12 +1197,6 @@ banded_directions16_compare_Fgap (Direction16_T **directions1, Direction32_T **d |
748 | 1197 |
* End of debugging procedures |
749 | 1198 |
************************************************************************/ |
750 | 1199 |
|
751 |
-/************************************************************************ |
|
752 |
- * Note: These procedures expect SIMD registers to start at |
|
753 |
- * coordinate 1, not 0, and are different from the SIMD procedures |
|
754 |
- * for GMAP/GSNAP. This is because we want row 0 to be a special |
|
755 |
- * case with no gap penalties. |
|
756 |
- ************************************************************************/ |
|
757 | 1200 |
|
758 | 1201 |
|
759 | 1202 |
#if defined(HAVE_SSE4_1) || defined(HAVE_SSE2) |
... | ... |
@@ -766,13 +1209,13 @@ aligned_score8_alloc (int rlength, int glength, void **ptrs, void *space) { |
766 | 1209 |
matrix = (Score8_T **) ptrs; |
767 | 1210 |
|
768 | 1211 |
ptr = (Score8_T *) space; |
769 |
- matrix[0] = &(ptr[SIMD_NCHARS - 1]); /* Want aligned row to be r = 1, 17, ... */ |
|
1212 |
+ matrix[0] = ptr; /* Want aligned row to be r = 0, 16, ... */ |
|
770 | 1213 |
for (c = 1; c <= glength; c++) { |
771 |
- ptr += rlength + SIMD_NCHARS; |
|
772 |
- matrix[c] = &(ptr[SIMD_NCHARS - 1]); /* Want aligned row to be r = 1, 17, ... */ |
|
1214 |
+ ptr += rlength; |
|
1215 |
+ matrix[c] = ptr; /* Want aligned row to be r = 0, 16, ... */ |
|
773 | 1216 |
} |
774 |
-#ifdef DEBUG2 |
|
775 |
- memset((void *) matrix[0],0,(glength+1)*(rlength+SIMD_NCHARS)*sizeof(Score8_T)); |
|
1217 |
+#if defined(DEBUG2) && defined(DEBUG14) |
|
1218 |
+ memset((void *) matrix[0],0,(glength+1)*rlength*sizeof(Score8_T)); |
|
776 | 1219 |
#endif |
777 | 1220 |
|
778 | 1221 |
return matrix; |
... | ... |
@@ -787,13 +1230,13 @@ aligned_directions8_alloc (int rlength, int glength, void **ptrs, void *space) { |
787 | 1230 |
matrix = (Score8_T **) ptrs; |
788 | 1231 |
|
789 | 1232 |
ptr = (Score8_T *) space; |
790 |
- matrix[0] = &(ptr[SIMD_NCHARS - 1]); /* Want aligned row to be r = 1, 17, ... */ |
|
1233 |
+ matrix[0] = ptr; /* Want aligned row to be r = 0, 16, ... */ |
|
791 | 1234 |
for (c = 1; c <= glength; c++) { |
792 |
- ptr += rlength + SIMD_NCHARS; |
|
793 |
- matrix[c] = &(ptr[SIMD_NCHARS - 1]); /* Want aligned row to be r = 1, 17, ... */ |
|
1235 |
+ ptr += rlength; |
|
1236 |
+ matrix[c] = ptr; /* Want aligned row to be r = 0, 16, ... */ |
|
794 | 1237 |
} |
795 |
-#ifdef DEBUG2 |
|
796 |
- memset((void *) matrix[0],/*DIAG*/0,(glength+1)*(rlength+SIMD_NCHARS)*sizeof(Score8_T)); |
|
1238 |
+#if defined(DEBUG2) && defined(DEBUG14) |
|
1239 |
+ memset((void *) matrix[0],/*DIAG*/0,(glength+1)*rlength*sizeof(Score8_T)); |
|
797 | 1240 |
#endif |
798 | 1241 |
|
799 | 1242 |
return matrix; |
... | ... |
@@ -808,12 +1251,12 @@ aligned_directions8_calloc (int rlength, int glength, void **ptrs, void *space) |
808 | 1251 |
matrix = (Score8_T **) ptrs; |
809 | 1252 |
|
810 | 1253 |
ptr = (Score8_T *) space; |
811 |
- matrix[0] = &(ptr[SIMD_NCHARS - 1]); /* Want aligned row to be r = 1, 17, ... */ |
|
1254 |
+ matrix[0] = ptr; /* Want aligned row to be r = 0, 16, ... */ |
|
812 | 1255 |
for (c = 1; c <= glength; c++) { |
813 |
- ptr += rlength + SIMD_NCHARS; |
|
814 |
- matrix[c] = &(ptr[SIMD_NCHARS - 1]); /* Want aligned row to be r = 1, 17, ... */ |
|
1256 |
+ ptr += rlength; |
|
1257 |
+ matrix[c] = ptr; /* Want aligned row to be r = 0, 16, ... */ |
|
815 | 1258 |
} |
816 |
- memset((void *) matrix[0],/*DIAG*/0,(glength+1)*(rlength+SIMD_NCHARS)*sizeof(Score8_T)); |
|
1259 |
+ memset((void *) matrix[0],/*DIAG*/0,(glength+1)*rlength*sizeof(Score8_T)); |
|
817 | 1260 |
|
818 | 1261 |
return matrix; |
819 | 1262 |
} |
... | ... |
@@ -829,14 +1272,15 @@ aligned_score16_alloc (int rlength, int glength, void **ptrs, void *space) { |
829 | 1272 |
matrix = (Score16_T **) ptrs; |
830 | 1273 |
|
831 | 1274 |
ptr = (Score16_T *) space; |
832 |
- matrix[0] = &(ptr[SIMD_NSHORTS - 1]); /* Want aligned row to be r = 1, 9, 17, ... */ |
|
1275 |
+ matrix[0] = ptr; /* Want aligned row to be r = 0, 8, 16, ... */ |
|
833 | 1276 |
for (c = 1; c <= glength; c++) { |
834 |
- ptr += rlength + SIMD_NSHORTS; |
|
835 |
- matrix[c] = &(ptr[SIMD_NSHORTS - 1]); /* Want aligned row to be r = 1, 9, 17, ... */ |
|
1277 |
+ ptr += rlength; |
|
1278 |
+ matrix[c] = ptr; /* Want aligned row to be r = 0, 8, 16, ... */ |
|
836 | 1279 |
} |
837 | 1280 |
#ifdef DEBUG2 |
838 |
- memset((void *) matrix[0],0,(glength+1)*(rlength+SIMD_NSHORTS)*sizeof(Score16_T)); |
|
1281 |
+ memset((void *) matrix[0],0,(glength+1)*rlength*sizeof(Score16_T)); |
|
839 | 1282 |
#endif |
1283 |
+ |
|
840 | 1284 |
return matrix; |
841 | 1285 |
} |
842 | 1286 |
|
... | ... |
@@ -849,13 +1293,13 @@ aligned_directions16_alloc (int rlength, int glength, void **ptrs, void *space) |
849 | 1293 |
matrix = (Score16_T **) ptrs; |
850 | 1294 |
|
851 | 1295 |
ptr = (Score16_T *) space; |
852 |
- matrix[0] = &(ptr[SIMD_NSHORTS - 1]); /* Want aligned row to be r = 1, 9, 17, ... */ |
|
1296 |
+ matrix[0] = ptr; /* Want aligned row to be r = 0, 8, 16, ... */ |
|
853 | 1297 |
for (c = 1; c <= glength; c++) { |
854 |