# Need Coding Help

**URL:** <https://help.c-moor.org/t/need-coding-help/466>\
**Category:** Help\
**Tags:** R\
**Created:** [February 26, 2025, 3:59am UTC](https://help.c-moor.org/t/need-coding-help/466 "2025-02-26T03:59:45Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![graceekalle](https://avatars.discourse-cdn.com/v4/letter/g/919ad9/32.png) [@graceekalle](https://help.c-moor.org/u/graceekalle)\
**Post date:** [February 26, 2025, 3:59am UTC](https://help.c-moor.org/t/need-coding-help/466/1 "2025-02-26T03:59:45Z")

</div>

Hi!  
I am trying to work through a coding tutorial on R on a public restroom bacteria dataset. I’ll link it here: [DIY: public restroom bacteria](https://joey711.github.io/phyloseq-demo/Restroom-Biogeography.html)

As I am importing my data ( The `zipfile` has been moved to a new location: [https://nam11.safelinks.protection.outlook.com/?url=ftp%3A%2F%2Fftp.microbio.me%2Fpub%2Frestroom-data%2Fstudy\_1335\_split\_library\_seqs\_and\_mapping.zip&data=05|02|gekalle1%40live.ndm.edu|ba59b1ac561f4e345f7b08dd5123cb13|23e76ce8053b4267b0d3b497df4bbaf8|1|0|638755936343802153|Unknown|TWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D|0|||&sdata=dLjocUyCZ3uq8OBJk7MdF1Eo9s2Jgj12RjusiVdVSj0%3D&reserved=0](https://nam11.safelinks.protection.outlook.com/?url=ftp%3A%2F%2Fftp.microbio.me%2Fpub%2Frestroom-data%2Fstudy_1335_split_library_seqs_and_mapping.zip&data=05%7C02%7Cgekalle1%40live.ndm.edu%7Cba59b1ac561f4e345f7b08dd5123cb13%7C23e76ce8053b4267b0d3b497df4bbaf8%7C1%7C0%7C638755936343802153%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=dLjocUyCZ3uq8OBJk7MdF1Eo9s2Jgj12RjusiVdVSj0%3D&reserved=0))

I am met with an error message: \<trying URL  
Content type ‘unknown’ length 14700487 bytes (14.0 MB)\>

I cannot continue on with the turorial unless I figure this out! Help!

Thank you so much!

---

<div class="post-metadata">

**Author:** ![ValerieG](https://avatars.discourse-cdn.com/v4/letter/v/c2a13f/32.png) [@ValerieG](https://help.c-moor.org/u/ValerieG)\
**Post date:** [February 26, 2025, 1:39pm UTC](https://help.c-moor.org/t/need-coding-help/466/2 "2025-02-26T13:39:17Z")

</div>

Hi,

Yes, the demo data location is now different from the original location. The new location is here:  
ftp://ftp.microbio.me/pub/restroom-data/study\_1335\_split\_library\_seqs\_and\_mapping.zip

So, try running the following set of commands which worked for me:

#Download first  
zipftp = “ftp://ftp.microbio.me/pub/restroom-data/study\_1335\_split\_library\_seqs\_and\_mapping.zip”

#Follow the tutorial’s instructions to process the file further so your file of interested will be the biom file:

zipfile = tempfile(“RestroomBiogeography”)

download.file(zipftp, zipfile)

import\_dir ← tempdir()

unzip(zipfile, exdir = import\_dir)

biomfile = paste0(import\_dir, “/study\_1335\_closed\_reference\_otu\_table.biom”)

biom = import\_biom(biomfile, parseFunction = parse\_taxonomy\_greengenes)

#Test the final imported file  
biom

#biom file should look like this

phyloseq-class experiment-level object  
otu\_table() OTU Table: [4467 taxa and 109 samples]  
tax\_table() Taxonomy Table: [4467 taxa by 7 taxonomic ranks]

---

<div class="post-metadata">

**Author:** ![graceekalle](https://avatars.discourse-cdn.com/v4/letter/g/919ad9/32.png) [@graceekalle](https://help.c-moor.org/u/graceekalle)\
**Post date:** [February 26, 2025, 8:21pm UTC](https://help.c-moor.org/t/need-coding-help/466/3 "2025-02-26T20:21:02Z")

</div>

Hi Valerie,  
The first command is working,the ziptfile= tempfile action is working as well but when I try to do the download.file (zipftp, zipfile). This is the message I got :download.file(zipftp, zipfile)  
trying URL ‘ftp://ftp.microbio.me/pub/restroom-data/study\_1335\_split\_library\_seqs\_and\_mapping.zip’  
Content type ‘unknown’ length 14700487 bytes (14.0 MB)  
Error in download.file(zipftp, zipfile) :  
cannot open URL ‘ftp://ftp.microbio.me/pub/restroom-data/study\_1335\_split\_library\_seqs\_and\_mapping.zip’

My PI, Dr. Kerr, tried as well and got the same error message.

What do we do?

---

<div class="post-metadata">

**Author:** ![graceekalle](https://avatars.discourse-cdn.com/v4/letter/g/919ad9/32.png) [@graceekalle](https://help.c-moor.org/u/graceekalle)\
**Post date:** [February 26, 2025, 8:21pm UTC](https://help.c-moor.org/t/need-coding-help/466/4 "2025-02-26T20:21:41Z")

</div>

contuniation of error message:

In addition: Warning messages:  
1: In download.file(zipftp, zipfile) :  
downloaded length 0 != reported length 0  
2: In download.file(zipftp, zipfile) :  
URL ‘ftp://ftp.microbio.me/pub/restroom-data/study\_1335\_split\_library\_seqs\_and\_mapping.zip’: Timeout of 60 seconds was reached

---

<div class="post-metadata">

**Author:** ![ValerieG](https://avatars.discourse-cdn.com/v4/letter/v/c2a13f/32.png) [@ValerieG](https://help.c-moor.org/u/ValerieG)\
**Post date:** [February 27, 2025, 2:24pm UTC](https://help.c-moor.org/t/need-coding-help/466/5 "2025-02-27T14:24:40Z")

</div>

Hi. Here is the solution that should alternatively work:

a) Use pre-downloaded .zip file instead of downloading it from the website: Download the file (we renamed to “restroom.zip”) using the link below (instead of the one provided in the website).

> **[restroom.zip](https://drive.google.com/file/d/1_0LF56ITO0nL09VYOPHoLEvhD4qT7SO6/view?usp=share_link)**
>
> Google Drive file.

#After download, I dragged the file to the **Desktop** (you can use a different directory)  
#After download, the folder you downloaded will be called “ **restroom** ”.

b) Follow the adjusted code below to load the file. Note, I downloaded the folder to my Desktop, so in the code below, you will see that, but you can set a different directory. I suggest to set working directory to the directory where your restroom.zip file will be. In my case it’s ~/Desktop/C-MOOR/Phyloseq.

```auto
#Load phyloseq
 library(phyloseq)

#Set working directory to Desktop
setwd("~/Desktop/")

#Import data
zipfile2 = ("~/Desktop/restroom.zip")

#create the temporary directory for the unpacked file(s) from the .zip file.
import_dir <- tempdir()

#Import from the sample data file.
sdfile = paste0(import_dir, "/study_1335_mapping_file.txt")
sample_metadata = import_qiime_sample_data(sdfile)

#Import from the .biom file.
biomfile = paste0(import_dir, "/study_1335_closed_reference_otu_table.biom")
biom = import_biom(biomfile, parseFunction = parse_taxonomy_greengenes)
biom

```

c) Let us know if that works and we can continue troubleshooting.

---

<div class="post-metadata">

**Author:** ![graceekalle](https://avatars.discourse-cdn.com/v4/letter/g/919ad9/32.png) [@graceekalle](https://help.c-moor.org/u/graceekalle)\
**Post date:** [March 6, 2025, 8:29pm UTC](https://help.c-moor.org/t/need-coding-help/466/6 "2025-03-06T20:29:59Z")

</div>

Hi Valerie,  
We were able to figure it out! Your adjusted code helped a lot! There was 1 code that we forgot to do and it was to unzip the file but once we fixed that it was smooth sailing! thank you so much!
