Last active
December 12, 2015 00:18
-
-
Save bmpvieira/4683075 to your computer and use it in GitHub Desktop.
This script fetches sequences from MycorWeb Blast result links.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# getMycorSequences.coffee | |
# This script fetches sequences from MycorWeb Blast result links. | |
# | |
# links file must be provided and can be obtained with getMycorLinks.coffee: | |
# https://gist.github.com/4683065 | |
# | |
# Dependencies: casperjs | |
# Usage: casperjs getMycorSequences.coffee fileWithLinks | |
# Example: casperjs getMycorSequences.coffee sequencesLinks:0-4275.txt | |
# Author: Bruno Vieira ([email protected]) | |
# License: MIT | |
fs = require 'fs' | |
casper = require('casper').create() | |
sequencesLinks = fs.read(casper.cli.args[0]).toString().split('\n') | |
outputFile = "#{casper.cli.args[0]}.fasta" | |
casper.start() | |
casper.then -> | |
for sequenceLink in sequencesLinks | |
@thenOpen sequenceLink, -> | |
if sequenceLink isnt '' | |
sequence = @getHTML('pre').replace('>', '>').replace(/<br>/g, '\n') | |
fs.write outputFile, "#{sequence}\n", 'a' | |
casper.run() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment