General musings from the MacVector team about sequence analysis, molecular biology, the Mac in general and of course your favorite sequence analysis app for the Mac!

Batch auto annotation of blank sequences with MacVector and AppleScript

Over the past few releases we’ve been making more MacVector tools to be scriptable with AppleScript. The latest is Auto Annotation.

Auto Annotation is a great tool for curating your sequences. For example if you receive a unannotated sequence then you can scan it against other sequences to find. Blasting an unknown sequence, fetching the hits, then annotating your unknown sequence against those hits is a good way to find out information about your unknown sequence too. Plus you can also give sequences a consistent look and feel. For example making all CDS features to be green, or all AMP genes to be a blue arrow.

However, it only works on one sequence at a time.

The following script will take a folder of blank sequences, then scan them against a curated folder of annotated sequences. It will add any annotation it finds.

The script is very simple and could be enhanced much more. But it serves as a basis if you need to develop your own scripts. If you need any assistance with developing scripts for a specific purpose, please do email support. We will be happy to help.

set inputFolder to (choose folder with prompt "Select Folder of MV files to annotate:")
set LibraryFolder to (choose folder with prompt "Select Folder containing your curated library of sequences to use")

tell application "Finder"
	set AllFiles to every file of folder inputFolder
end tell

tell application "MacVector"
	repeat with f in AllFiles
		--Now open the file
		open f
		delay 0.3 -- wait a little bit until MV has opened the file
		set docRef to (a reference to the first document)
		set modifiable of docRef to 1 -- unlock
		annotate docRef replacing existing features by searching LibraryFolder with recursion
		-- get files considered in annotate results of docRef
		save docRef
		close docRef
	end repeat
end tell

There’s a longer version of the script in the MacVector application folder.

This entry was posted in Uncategorized and tagged , . Bookmark the permalink. Trackbacks are closed, but you can post a comment.

Post a Comment

Your email is never published nor shared. Required fields are marked *

You may use these HTML tags and attributes <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>