Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
linuxcommandline
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Bio-IT Workshops
linuxcommandline
Commits
46202f4b
Commit
46202f4b
authored
9 years ago
by
Toby Hodges
Browse files
Options
Downloads
Patches
Plain Diff
added reverse complement example using sed y/ACGT/UGCA/ and rev.
parent
62927ffd
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
linux_intermediate/commandlinetools.rst
+22
-0
22 additions, 0 deletions
linux_intermediate/commandlinetools.rst
with
22 additions
and
0 deletions
linux_intermediate/commandlinetools.rst
+
22
−
0
View file @
46202f4b
...
...
@@ -203,6 +203,28 @@ Note the difference:
# echo "ACCAAGCATTGGAGGAATATCGTAGGTAAA" | sed 's/A/_/g'
_CC__GC_TTGG_GG__T_TCGT_GGT___
You can use transliteration to replace all instances of a character with another character.
For example, to switch Thymines to Uridines in a sequence:
::
# echo "AGTGGCTAAGTCCCTTTAATCAGG" | sed 'y/T/U/'
AGUGGCUAAGTCCCUUUAAUCAGG
In the pattern specified in the ``sed`` command, each character in the first set is replaced
with the character in the equivalent position in the second set. For example, to get the
reverse transcript of a DNA sequence:
::
# echo "AGTGGCTAAGTCCCTTTAATCAGG" | sed 'y/ACGT/UGCA/'
UCACCGAUUCAGGGAAAUUAGUCC
This is the complementary sequence, but we wanted the reverse complement, so we need to use
the Linux command ``rev`` to reverse the output of the ``sed`` command:
::
# echo "AGTGGCTAAGTCCCTTTAATCAGG" | sed 'y/ACGT/UGCA/' | rev
CCUGAUUAAAGGGACUUAGCCACU
When used on a file, sed prints the file to standard output, replacing text as it goes
along:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment