コード例 #1
0
static bool contains_no_zero_base_exons(Editoperation *alignment,
                                        long alignmentlength)
{
  long i, j;

  for (i = 1; i < alignmentlength - 1; i++) {
    if (is_insertion(alignment[i])) {
      /* editoperation is Insertion, check for surrounding Introns */
      if (is_intron(alignment[i-1])) {
        /* intron to the left -> go to the right */
        for (j = i + 1; j < alignmentlength; j++) {
          if (is_intron(alignment[j])) {
            /* Insertion is surrounded by Introns -> return false */
            return false;
          }          else if (!is_insertion(alignment[j]))
            break; /* Insertions are not surrounded by Introns */
        }      }
    }
  }
  /* no zero base exons -> return true */
  return true;
}
コード例 #2
0
ファイル: 1035.c プロジェクト: Pandoraemon/PAT_basic
int main()
{
    int A[105]= {0};
    int B[105]= {0};
    int C[105]= {0};
    int n,i,j;
    int step;
    scanf("%d",&n);
    for(i=0; i<n; i++)
    {
        scanf("%d",&A[i]);
        C[i]=A[i];
    }
    for(i=0; i<n; i++)
    {
        scanf("%d",&B[i]);
    }
    step=is_insertion(C,B,n);
    if(step)
    {
        insertion_sort(A,step+2);
        printf("Insertion Sort\n");
        for(i=0; i<n; i++)
        {
            printf("%d",A[i]);
            if(i<n-1)
            {
                printf(" ");
            }
        }
        printf("\n");
    } else if(step=is_Merge(A,B,n))
    {
        Merge_sort_b(A,n,step+1);
        printf("Merge Sort\n");
        for(i=0; i<n; i++)
        {
            printf("%d",A[i]);
            if(i<n-1)
            {
                printf(" ");
            }
        }
        printf("\n");
    }




    return 0;
}
コード例 #3
0
/* The following function removes zero base exons in <alignment>.
   That is, a continuous stretch of insertions between two introns is moved past
   the intron(s) to the right.
   This is necessary for the gthcomputescores() function to work correctly.
   Otherwise one would get exons with borders (i, i-1) which can not be
   processed by the successive functions. */
void gt_remove_zero_base_exons(Editoperation *alignment, long alignmentlength,
                            GthStat *stat)
{
  long i, j;
  for (i = 1; i < alignmentlength - 1; i++) {
    if (is_insertion(alignment[i])) {
      /* editoperation is insertion, check for surrounding introns */
      if (is_intron(alignment[i-1])) {
        /* intron to the left -> go to the right */
        for (j = i + 1; j < alignmentlength; j++) {
          if (is_intron(alignment[j])) {
            /* Insertion(s) surrounded by Introns -> move insertion(s) past the
               (complete) intron */
            while (j < alignmentlength) {
              Editoperation tmp_eop;

              /* swap */
              tmp_eop = alignment[i];
              alignment[i] = alignment[j];
              alignment[j] = tmp_eop;
              i++;
              j++;
              if (!is_intron(alignment[j]))
                break;
            }
            /* increase counter */
            gth_stat_increment_numofremovedzerobaseexons(stat);
            break;
          }
          else if (!is_insertion(alignment[j]))
            break; /* Insertions are not surrounded by Introns */
        }
      }
    }
  }
}