grep DNA after a pattern
HI,
I have DNA sequences like these :

and I want to keep all sequences after this pattern "ACTTAAGTGTATGTAAACTTCCGACTTCAACTG" beginning with "TA". I tried
grep -v "ACTTAAGTGTATGTAAACTTCCGACTTCAACTG" file.txt
but it does not work.
Kindly help.
• 2,596 views
•
link
3 answers
Your code (grep -v) selects only lines that do not have the string ACTTAAGTGTATGTAAACTTCCGACTTCAACTG, so zero. If you want to select only ACTTAAGTGTATGTAAACTTCCGACTTCAACTG followed by AT, but dropping the ACTTAAGTGTATGTAAACTTCCGACTTCAACTG string, you can use grep in combo with sed.
grep "ACTTAAGTGTATGTAAACTTCCGACTTCAACTGTA" file.txt | sed "s/ACTTAAGTGTATGTAAACTTCCGACTTCAACTGTA/TA/g"
• 0 views
•
link
• 0 views
•
link
• 0 views
•
link
Log in to answer this question.
Please go through this post to add images properly in the post
A: How to add images to a Biostars post
Also, do you want to get rid of "
ACTTAAGTGTATGTAAACTTCCGACTTCAACTG" ?Not sure what you mean. If you want sequences that start with the pattern followed by TA then look for the whole thing, i.e. ACTTAAGTGTATGTAAACTTCCGACTTCAACTGTA
What about
awk -F "ACTTAAGTGTATGTAAACTTCCGACTTCAACTGTA" '{print "TA"$2}'.Split sequence if contains the query and TA at the end, if so print TA and everything downstream of it.
the first one worked : awk -F "ACTTAAGTGTATGTAAACTTCCGACTTCAACTG" '{print $2}' file.txt but has lots of empty spaces
I want to keep all the sequences after this pattern.
@ lakhujanivijay yes