Following some sequence expressions, a fragment (sub-range) can be specified using coordinates. Here are some rules pertaining to sequence fragments:

- Each coordinate is specified by a “site expression.”

- Integral coordinates are supported. The first base has index 1.

- The full expression is always evaluated left-to-right.

- A sub-range applies to all sequences in a multi-file sequence. Ranges are re-evaluated for each member of the set to which they are applied.

Objective | Expression | Examples |
---|---|---|

Read right from coordinates a to b, inclusive | `(a > b)` `(a,b)` |
`$B=alpha.fasta(1,414)` `$F=alpha.fasta(%i+3, 414)` `$C1=$A(1,414)=$A(1 > 414)` |

Circle right | `(b > a)` |
`$E1=$A(414 > 1)` |

Circle the reverse complement | `(a<b)` |
`$E2=$A(1<414)` |

Read the reverse complement left from coordinates b to a | `(b<a)` |
`$D1=$A(414<1)` |

Specify the left end and right end bases | `lend` `rend` |
`$D=$A(lend,rend)` `$D=$A(lend+1, rend+1)` |

Reference a base position relative to the left end of the sequence. (Note that “left” can only be used to specify the coordinate on the right-hand side.) | `left` |
`out.fasta = in.fasta(lend, lend + 12)` |

See the image below for a visual representation of the different sequence segments.

Coordinates can also be specified by the results of one or more searches for matching sequence. The value of a search is a coordinate. Site expressions can include both searches and integral expressions, all evaluated left-to-right.

IUPAC ambiguity codes are recognized both in the sequence and in the expression. For example, typing AAS (where S = C or G) into an expression will cause SeqNinja to look for the first instance of AAC or AAG in the sequence. Conversely, typing AAC into an expression will cause SeqNinja to look for the first instance of AAC, as well as any combination of bases and ambiguity codes that would allow for AAC (e.g., AAS, WWM, etc.).

In the following search examples, $A=“AAAGGGCATCCCTTT”:

Objective | Expression | Examples | Result |
---|---|---|---|

For left position, start at lend, search forward | `(lend > > "sequence", rend)` |
`$A(lend > > "CAT",rend)` |
CATCCCTTT |

For right position, start at lend, search forward | `(lend,lend > > "sequence")` |
`$A(lend, lend > > "CAT")` |
AAAGGGCAT |

For left position, start at rend, search reverse complement | `(rend<<"sequence", rend)` |
`$A(rend<<"ATG", rend)` |
CATCCCTTT |

For right position, start at rend, search reverse complement | `(lend,rend<<"sequence")` |
`$A(lend, rend<<"ATG")` |
AAAGGGCAT |

Search forward implicitly from lend | `("sequence", rend)` |
`$A("CAT", rend)` |
CATCCCTTT |

Search forward implicitly from left position in direction/strand of single arrow | `(lend+number > "sequence")` |
`$A(lend+3 > "CAT")` |
GGGCAT |

Search forward implicitly from right position in direction/strand of single arrow | `(rend<"sequence")` |
`$A(rend<"ATG")` |
AAAGGGATG |

Look forward for first “CC”, then look forward from there to next “T” (chained search) | `(lend > > "seq a" > > "seq b", rend)` |
`$A(lend > > "CC" > > "T", rend)` |
TTT |

Find ambiguity code matches | `("sequence", rend)` |
`$A("CAN", rend)` `$A("CAW", rend)` |
CATCCCTTT |

Search for “CAT” and add 3; this mixes search operators with arithmetic | `("sequence"+number, rend)` |
`$A("CAT"+3, rend)` |
CCCTTT |

Need more help with this?

Contact DNASTAR