Text Filtering in Automator

Hi there,

I wonder if you could help me. I'm trying to filter a very large text file for lines containing any one of four letters. The parts of the file I want to filter are lines that are 100 characters long, with no spaces, and contain one of four letters (C, T, A and/or G). I would ideally like to extract these 100-character lines of text, so that I can save them into a new document.

I would be so grateful if someone might guide me on how I could get automator to do this for me.

Thank you so much in advance!

Sharklel48

15" Unibody MBP, iMac, iBook, iPhone 4, Mac OS X (10.6.5)

Posted on Dec 7, 2010 5:16 PM

Reply
18 replies

Dec 14, 2010 8:29 AM in response to red_menace

Thank you so much red_menace! That was so helpful, and very kind of you to spend time helping me out and explaining it all for me. That worked right away!

I just ran it in Applescript Editor, and it gave me exactly what I was after. I have the sequences in the format I need them in, now! I really can't thank you enough! You have helped me big time!

Thank you so, so much!

Sharklel

Jan 10, 2011 3:36 PM in response to red_menace

Hi Red_Menace,

It's me again with a similar sort of question. Your AppleScript was extremely helpful, so many thanks for that.

I now need to do something else, and was wondering if you'd be kind enough to help me. Do you have any idea how I might be able to insert a simple '>' character above each line, and not have a line's space? This is for a different purpose, so the first script is still invaluable to me. I tried looking at this myself, but I have absolutely no idea how to do it, and have had no luck with browsing forums etc.

For instance, could it be incorporated into the script you gave me above? I'm just looking to turn something like this:

ACATGGTGAAACCCCGTCTCTACTAAAAATACAAANCAGCCAGGTGTGGTGGCATGTACCTGTAATTCCAGCTACTTGGG AGGCTGAGGAAAAAGAACCACTTAAACC

TCACCCCAGCCTTGGGTTGAGCTGCTCCTCACACCNGCGCCGGGCCGGGCCCCGGCCTTTCTGCCTCAATACGCCTGCCA CCTTCCCCACTCCTGCCCTCACAACCTC

TGAGCCTTGGGGTACTCCAATTTTTGGAAGTCAAGNGATGATGAGGAACCAGCCGAGTGGATTGGCAAAGGGGAGTGAGA ATGACAGCATAATAAACAGCAACTTTCT

into something like this:


ACATGGTGAAACCCCGTCTCTACTAAAAATACAAANCAGCCAGGTGTGGTGGCATGTACCTGTAATTCCAGCTACTTGGG AGGCTGAGGAAAAAGAACCACTTAAACC

TCACCCCAGCCTTGGGTTGAGCTGCTCCTCACACCNGCGCCGGGCCGGGCCCCGGCCTTTCTGCCTCAATACGCCTGCCA CCTTCCCCACTCCTGCCCTCACAACCTC

TGAGCCTTGGGGTACTCCAATTTTTGGAAGTCAAGNGATGATGAGGAACCAGCCGAGTGGATTGGCAAAGGGGAGTGAGA ATGACAGCATAATAAACAGCAACTTTCT

Your help would be hugely appreciated, and I can't thank you enough for helping me before.

Thanks, and happy New Year!

Sharklel

Jan 10, 2011 3:42 PM in response to red_menace

Sorry, the desired output didn't come out right.

I meant this (imagine there are no single quotes around the > - I don't post on forums regularly, so I haven't figured out how to do that cool green box thing yet!) :
'>'
ACATGGTGAAACCCCGTCTCTACTAAAAATACAAANCAGCCAGGTGTGGTGGCATGTACCTGTAATTCCAGCTACTTGGG AGGCTGAGGAAAAAGAACCACTTAAACC
'>'
TCACCCCAGCCTTGGGTTGAGCTGCTCCTCACACCNGCGCCGGGCCGGGCCCCGGCCTTTCTGCCTCAATACGCCTGCCA CCTTCCCCACTCCTGCCCTCACAACCTC
'>'
TGAGCCTTGGGGTACTCCAATTTTTGGAAGTCAAGNGATGATGAGGAACCAGCCGAGTGGATTGGCAAAGGGGAGTGAGA ATGACAGCATAATAAACAGCAACTTTCT

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Text Filtering in Automator

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.