Mercurial > repos > matt-shirley > sra_fetch
comparison sra_fetch.py @ 1:aa7ab53c53bf draft
Started working on the python FTP script.
| author | matt-shirley |
|---|---|
| date | Tue, 13 Nov 2012 22:32:13 -0500 |
| parents | |
| children | be22544bfafa |
comparison
equal
deleted
inserted
replaced
| 0:abdb4762ebcb | 1:aa7ab53c53bf |
|---|---|
| 1 from ftplib import FTP | |
| 2 import os, sys, os.path | |
| 3 | |
| 4 # Get accession number from argument | |
| 5 accession = sys.argv[1] | |
| 6 prefix = accession[0:2].uppercase() | |
| 7 middle = accession[3:5] | |
| 8 suffix = accession[6:8] | |
| 9 | |
| 10 ftp = FTP('ftp.ncbi.nlm.nih.gov') | |
| 11 | |
| 12 def handleDownload(block): | |
| 13 file.write(block) | |
| 14 | |
| 15 ftp.login() | |
| 16 ftp.cwd('/sra/sra-instant/reads/BySample/sra/ |
