R list path command only returns some of the files, but not all

42 Views Asked by At

I'm working on analyzing some fastq files in R for 16s work. I have a previous script from someone that has successfully done this before, but when I did:

path_1 <- "set to my WD"

then went to get a list of the files in the path using

list.files(path_1)

only 33 of the 204 are returned. However, when I do:

list.files(all.files=TRUE)

all of my files show. I'm not sure if I can go forward with the analysis or not. I know for the next steps it's not working. I go to sort them with the command below and only get 15 or 16 of them that show up as sorted.

Fs_1 <- sort(list.files(path_1, pattern="_R1_001.fastq.gz", full.names = TRUE))
Rs_1 <- sort(list.files(path_1, pattern= "_R2_001.fastq.gz", full.names = TRUE))

I'm wondering why all my files are not showing with list.files(path_1) because this seems to be affecting my downstream workflow. I'm hoping to get all 204 of my files to appear and be sorted correctly so I can continue with my analysis.

For example this was

# found:
CF10_S9_L001_R1_001.fastq.gz
CF10_S9_L001_R2_001.fastq.gz

# not found:
CF8_S7_L001_R1_001.fastq.gz
CF8_S7_L001_R2_001.fastq.gz
1

There are 1 best solutions below

0
Laeanna On

I found out the folder was synced to icloud. Once I downloaded to my computer it worked.