Question: randomly sequence cleavage - average length constraint
2
gravatar for stephaniepierson83
2.6 years ago by
France
stephaniepierson8320 wrote:

Dear all,

I would like to randomly cleave sequences of length (Ln) until the average length of the resulting framents is 50 nt (+/- 2 nt)

I started it with perl , but i've some problems with the average length constraint ...

I wanted to select a random position in [0 ... sequence length] and calculate the length of created segments. But i think it's not the right way to do.

Any suggestions ?

 

sequence next-gen perl • 743 views
ADD COMMENTlink modified 2.6 years ago by dylan.storey60 • written 2.6 years ago by stephaniepierson8320
1
gravatar for Csaba Kerepesi
2.6 years ago by
Hungary
Csaba Kerepesi320 wrote:

One perl solution if there is no overlap:

$Ln=1000;
for ($i=int(rand(50))+1;$i<=$Ln;$i=$i+50) {
        printf "%d\n",$i+1-int(rand(3));
}

 

 
ADD COMMENTlink modified 2.6 years ago • written 2.6 years ago by Csaba Kerepesi320
0
gravatar for Ram
2.6 years ago by
Ram12k
New York
Ram12k wrote:

I'd follow this approach:

  1. Allowable length = 48 .. 52
  2. Iterate through each sequence. For each sequence,
    • if len(seq)<52, skip to next sequence. Else,
    • pick a random number (call it point) between 0 and len(seq)-1
    • if len(seq)-1 - point >=52, pick substring 3' of point, with length randomly picked between 48 and 52
    • add to a new list "pool_1" the sequence 5' of point and 3' of point+length picked above (these are the flanking fragments)
  3. Repeat above operation on pool_1, this time picking substrings 5' of chosen point and adding the fragments to "pool_2".
  4. Repeat until both pool_1 and pool_2 are filled with fragments less than 52 in total length

 

ADD COMMENTlink modified 2.6 years ago • written 2.6 years ago by Ram12k

I can't put constraint on fragment length. They could be 1 nt or 2nt ...

ADD REPLYlink written 2.6 years ago by stephaniepierson8320
0
gravatar for dylan.storey
2.6 years ago by
dylan.storey60
United States
dylan.storey60 wrote:

If you're concerned with performance , use unpack instead of substring. 

ADD COMMENTlink written 2.6 years ago by dylan.storey60
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 600 users visited in the last hour