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
| int main()
{
int mrna_length = 1000 ;
int n_cut = 36 ;
simulation(mrna_length, n_cut);
return 0;
}
int simulation(int mrna_length, int n_cut)
{
int i,j,n_cut
double *cutpoint; /* tableau contenant tous les positions (clivees ou pas) */
int *cut; /* tableau contenant uniquement les positions clivees */
cutpoint=(double *)malloc((size_t)((mrna_coverage+10)*sizeof(double)));
for(i=0;i<=mrna_length;i++)cutpoint[i]=0; /* initialise cutpoint a 0 */
cut=(int *)malloc((size_t)((n_cut+10)*sizeof(int)));
for(i=0;i<=n_cut;i++)cut[i]=0;
for(i=0;i<n_cut;i++){ /* ici n_cut est utilise de façon a avoir le nombre requis de fragments ... */
j = 1 + (int) ((mrna_length-1) * (rand() / (RAND_MAX + 1.0))); /* choisi aleatoirement n_cut positions dans le fragment */
if(cutpoint[j]==1)i--;else cutpoint[j]=1; /* cutpoint est fixe a 1 pour les positions clivees */
}
for(i=0,j=1;i<=mrna_length;i++)if(cutpoint[i]==1)cut[j++]=i; cut[0]=0; cut[j]=mrna_length; /* je store dans cut les positions clivees de façon a pouvoir recuperer des positions qui se suivent (start et stop des fragments)*/
} |
Partager