Skip to content

Commit

Permalink
Fixed indentation in download_pubmlst_latest.py
Browse files Browse the repository at this point in the history
  • Loading branch information
Laura Carroll authored and Laura Carroll committed Apr 12, 2021
1 parent 1e35d3c commit 7dbc044
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 24 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -213,17 +213,17 @@ download_pubmlst_latest.py

4. Download the BTyper3 source file, and store it in your directory of choice:

To download manually, click the following URL, and then click the "Download" button: "https://github.com/lmc297/BTyper3/blob/master/archive/btyper-3.1.1.tar.gz
To download manually, click the following URL, and then click the "Download" button: "https://github.com/lmc297/BTyper3/blob/master/archive/btyper-3.1.2.tar.gz

Or with `wget`:
```
wget https://github.com/lmc297/BTyper3/raw/master/archive/btyper-3.1.1.tar.gz
wget https://github.com/lmc297/BTyper3/raw/master/archive/btyper-3.1.2.tar.gz
```

5. Extract BTyper3 program/databases

```
tar -xzvf btyper-3.1.1.tar.gz
tar -xzvf btyper-3.1.2.tar.gz
```

Note: to ensure that BTyper3 works correctly, make sure database directories (beginning with "seq_") remain in the same directory as the BTyper3 executable (stored as "btyper3").
Expand Down
Binary file added archive/btyper-3.1.2.tar.gz
Binary file not shown.
2 changes: 1 addition & 1 deletion btyper3
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@ def main():

parser.add_argument("--download_mlst_latest", help = "Optional argument for use with --mlst True; True or False; download the latest version of the seven-gene multi-locus sequence typing (MLST) scheme available in PubMLST; if this is False, BTyper3 will search for the appropriate files in the seq_mlst_db directory; default = False", nargs = "?", default = "False")

parser.add_argument("--version", action="version", version='%(prog)s 3.1.1', help="Print version")
parser.add_argument("--version", action="version", version='%(prog)s 3.1.2', help="Print version")

args = parser.parse_args()

Expand Down
40 changes: 20 additions & 20 deletions download_pubmlst_latest.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,30 +25,30 @@ def download_pubmlst(btyper3_path):
xml = btyper3_path + "seq_mlst_db/pubmlst.xml"
with open(xml, "wb") as f:
f.write(resp.content)
tree=ET.parse(xml)
root=tree.getroot()
species={}
for parent in root.iter("species"):
species[parent.text.strip()]=[]
for child in parent.iter("url"):
species[parent.text.strip()].append(child.text)
tree=ET.parse(xml)
root=tree.getroot()
species={}
for parent in root.iter("species"):
species[parent.text.strip()]=[]
for child in parent.iter("url"):
species[parent.text.strip()].append(child.text)

urlcol = species["Bacillus cereus"]
urlcol = species["Bacillus cereus"]

for u in urlcol:
for u in urlcol:


if "alleles_fasta" in u:
fname = u.split("/")[-2].strip()
resp = requests.get(u)
with open(btyper3_path + "seq_mlst_db/mlst.fas", "ab") as outfile:
outfile.write(resp.content)
if "alleles_fasta" in u:
fname = u.split("/")[-2].strip()
resp = requests.get(u)
with open(btyper3_path + "seq_mlst_db/mlst.fas", "ab") as outfile:
outfile.write(resp.content)

elif "profiles_csv" in u:
fname = "bcereus.txt"
resp = requests.get(u)
with open(btyper3_path + "seq_mlst_db/" + fname, "wb") as outfile:
outfile.write(resp.content)
elif "profiles_csv" in u:
fname = "bcereus.txt"
resp = requests.get(u)
with open(btyper3_path + "seq_mlst_db/" + fname, "wb") as outfile:
outfile.write(resp.content)


print("Finished downloading most recent PubMLST datbase at " + now.strftime("%Y-%m-%d %H:%M"))
Expand All @@ -58,7 +58,7 @@ def download_pubmlst(btyper3_path):

def main():

parser = argparse.ArgumentParser(usage = "build_btyper3_ani_db.py")
parser = argparse.ArgumentParser(usage = "download_pubmlst_latest.py")

btyper3_path = get_btyper3_path()

Expand Down

0 comments on commit 7dbc044

Please sign in to comment.