Mercurial > repos > matt-shirley > sra_fetch
changeset 1:aa7ab53c53bf draft
Started working on the python FTP script.
author | matt-shirley |
---|---|
date | Tue, 13 Nov 2012 22:32:13 -0500 |
parents | abdb4762ebcb |
children | be22544bfafa |
files | sra_fetch.py |
diffstat | 1 files changed, 16 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sra_fetch.py Tue Nov 13 22:32:13 2012 -0500 @@ -0,0 +1,16 @@ +from ftplib import FTP +import os, sys, os.path + +# Get accession number from argument +accession = sys.argv[1] +prefix = accession[0:2].uppercase() +middle = accession[3:5] +suffix = accession[6:8] + +ftp = FTP('ftp.ncbi.nlm.nih.gov') + +def handleDownload(block): + file.write(block) + +ftp.login() +ftp.cwd('/sra/sra-instant/reads/BySample/sra/