Skip to content

Commit

Permalink
fixed fs_matrix not making it into probab_pair
Browse files Browse the repository at this point in the history
  • Loading branch information
cnotred committed Mar 28, 2023
1 parent 78b0d56 commit cd06c91
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 17 deletions.
28 changes: 17 additions & 11 deletions lib/dp_lib/util_dp_drivers.c
Original file line number Diff line number Diff line change
Expand Up @@ -198,17 +198,22 @@ Constraint_list *seq2list ( Job_TC *job)
|| strm ( mode, "blast_pair") || strm (mode, "lalign_blast_pair") \
|| strm ( mode, "viterbi_pair") || strm (mode, "slow_pair") || strm(mode, "glocal_pair") || strm (mode, "biphasic_pair") \
|| strm ( mode, "islow_pair") || strm (mode, "tm_slow_pair") || strm (mode, "r_slow_pair") \
|| strm ( mode, "lalign_id_pair")|| strm (mode, "tm_lalign_id_pair") || strm (mode , "lalign_len_pair") || strm(mode, "fs_lalign_id_pair") \
|| strm ( mode, "lalign_id_pair")|| strm (mode, "tm_lalign_id_pair") || strm (mode , "lalign_len_pair")\
|| strm (mode, "prrp_aln") || strm ( mode, "test_pair") \
|| strm (mode, "cdna_fast_pair") || strm (mode, "diaa_slow_pair") || strm (mode, "monoaa_slow_pair")\
|| strncmp (mode,"cdna_fast_pair",14)==0 \
)
{

A=fast_pair (job);
RCL=aln2constraint_list ((A->A)?A->A:A, CL,weight);
}

else if ( strm (mode, "fs_lalign_id_pair"))
{
set_string_variable ("fix_seq_seq_with_template", "_E_");
A=fast_pair (job);
RCL=aln2constraint_list ((A->A)?A->A:A, CL,weight);
unset_string_variable ("fix_seq_seq_with_template");
}
else if ( strm ( mode, "subop1_pair") || strm ( mode, "subop_pair") )
{
A=fast_pair (job);
Expand Down Expand Up @@ -552,11 +557,11 @@ Constraint_list *method2pw_cl (TC_method *M, Constraint_list *CL)
PW_CL->evaluate_residue_pair=evaluate_matrix_score;
PW_CL->extend_jit=0;

if (get_string_variable ("fs_matrix"))
PW_CL->M=read_matrice (get_string_variable ("fs_matrix"));
else
PW_CL->M=read_matrice ("idmat");
if (get_string_variable ("fs_matrix"))sprintf (PW_CL->method_matrix,"%s",get_string_variable ("fs_matrix"));
else sprintf (PW_CL->method_matrix,"idmat");



if (int_variable_isset ("fs_gop") && get_int_variable("fs_gop")<0)
PW_CL->gop=get_int_variable("fs_gop");
else
Expand Down Expand Up @@ -2585,7 +2590,7 @@ Alignment * fast_pair (Job_TC *job)
}
else
buf[s]=S->seq[s];

A->seq_al[a]=csprintf (A->seq_al[a], "%s", S->seq[s]);
A->name[a]=csprintf (A->name[a], "%s", (CL->S)->name[s]);

Expand Down Expand Up @@ -4079,7 +4084,7 @@ int sa_align_groups (Alignment *A, Constraint_list *CL, int *used, int minid, in
if (A->nseq==n) return -1;
if (!ls){ls=declare_int (2, n); ns=(int*)vcalloc (3, sizeof (int));}
if (!f)f=declare_int (n,n);
HERE ("***** 1******");


sa_get_next_group (A, CL,used,&s0, &s1,f);
if (g0==-1) return -1;
Expand Down Expand Up @@ -5816,12 +5821,13 @@ int pair_wise (Alignment *A, int*ns, int **l_s,Constraint_list *CL )
Pwfunc function;



if (read_size_int (ns, sizeof (int))==3 && ns[2]!=-1)
{

return pair_wise_ms(A,ns,l_s,CL);
}

/*Make sure evaluation functions update their cache if needed*/
A=update_aln_random_tag (A);

Expand Down
11 changes: 7 additions & 4 deletions lib/dp_lib/util_dp_suboptimal_nw.c
Original file line number Diff line number Diff line change
Expand Up @@ -1436,7 +1436,8 @@ Constraint_list *ProbaMatrix2CL (Alignment *A, int *ns, int **ls, int NumMatrixT
int a;
static float F=4; //potential number of full suboptimal alignmnents incorporated in the library
static int tot_old, tot_new;



if (!A)
{
free_int (list, -1);list=NULL;
Expand All @@ -1445,7 +1446,7 @@ Constraint_list *ProbaMatrix2CL (Alignment *A, int *ns, int **ls, int NumMatrixT
vfree(entry); entry=NULL;
return NULL;
}

I=strlen (A->seq_al[ls[0][0]]);
J=strlen (A->seq_al[ls[1][0]]);

Expand All @@ -1465,18 +1466,20 @@ Constraint_list *ProbaMatrix2CL (Alignment *A, int *ns, int **ls, int NumMatrixT


totalProb = ComputeTotalProbability (I,J,NumMatrixTypes, NumInsertStates,forward, backward);

ij = 0;
for (list_n=0,ij=0,i =0; i <= I; i++)
{
for (j =0; j <= J; j++, ij+=NumMatrixTypes)
{
v= EXP (MIN(LOG_ONE,(forward[ij] + backward[ij] - totalProb)));

if (v>thr)//Conservative reduction of the list size to speed up the sorting
{
list[list_n][0]=i;
list[list_n][1]=j;
list[list_n][2]=(int)((float)v*(float)NORM_F);

list_n++;
}
if (v>0.01)old_n++;
Expand Down Expand Up @@ -2002,7 +2005,7 @@ float ** get_emitPairs (char *mat, char *alp, float **p, float *s)
else if (strm (rmat, mat))return p;

sprintf (rmat,"%s", mat);

M=read_matrice (mat);
l=strlen (alp);

Expand Down
11 changes: 9 additions & 2 deletions lib/util_lib/aln_convertion_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -5579,6 +5579,9 @@ int **fix_seq_seq (Sequence *S0, Sequence *Sx)
char *use_template;

//Trigger fixing with a template rather than the sequence itself
//currently not used


use_template=get_string_variable ("fix_seq_seq_with_template");

index=(int**)vcalloc ( S0->nseq, sizeof (int*));
Expand All @@ -5591,7 +5594,10 @@ int **fix_seq_seq (Sequence *S0, Sequence *Sx)
if (i!=-1)
{
seq=Sx->seq[i];
if (use_template)seq=seq2E_template_string (Sx,i);
if (use_template)
{
seq=seq2E_template_string (Sx,i);
}
if (!seq) seq=Sx->seq[i];
}

Expand All @@ -5609,8 +5615,9 @@ int **fix_seq_seq (Sequence *S0, Sequence *Sx)
int nr0=0;
int nr1=0;
Alignment *B;

//HERE ("\n%s\n%s\n\n",S0->seq[s0],seq);
B=align_two_sequences (S0->seq[s0], seq, const_cast<char*>( (strm(S0->type, "PROTEIN"))?"blosum62mt":"idmat"), -4,-1, "myers_miller_pair_wise");
//print_aln (B);
for (c=0; c<B->len_aln; c++)
{

Expand Down

0 comments on commit cd06c91

Please sign in to comment.