LuyiTian / scPipe

a pipeline for single cell RNA-seq data analysis
69 stars 24 forks source link

Error in sc_trim_barcode #143

Closed satzel closed 2 years ago

satzel commented 2 years ago

Hi,

I am trying to run scPipe and run into an error when executing:

sc_trim_barcode(file.path(data_dir,"combined.fastq"),
                fq_R1,
                fq_R2,
                read_structure = read_structure)

The error I get is:

_Error in rcpp_sc_trim_barcode_paired(outfq, r1, r2, readstructure$bs1, : Can't open file: ~/some/path/combined.fastq

data_dir is correctly set.

I don't quite understand, if R is supposed to create this file or if I have to create it as an empty file (tried both, didn't change anything) or what else I have to do, to make it run.

Any help would be appreciated cheers saskia

PeteHaitch commented 2 years ago

Can you please post the output of running file.path(data_dir,"combined.fastq").

satzel commented 2 years ago

Thanks for your quick reply @PeteHaitch

 file.path(data_dir,"combined.fastq")
[1] "~/some/path/combined.fastq"

When I try to put a file name directly in the command like so:

sc_trim_barcode(
    outfq = "trimmed.fastq",
    r1 = fq_R1,
    r2 = fq_R2,
    read_structure = read_structure
)

I get

Error in if (outdir != character(0) && !dir.exists(outdir)) dir.create(outdir, : missing value where TRUE/FALSE needed

as a side note, when I keep going in the script and try this


barcode_anno = "sample_index.csv"
exon_anno = "Annotation/Homo_sapiens.GRCh38.91.gff3"

sc_detect_bc(
    infq = combined_fastq,
    outcsv = barcode_anno,       # bacode annotation output file name
    bc_len = read_structure$bl2, # 16bp barcode
    max_reads = 5000000,         # only process first 5 million reads
    min_count = 100              # discard cell barcodes with few than 100 hits
)

it runs without error and the csv file is created (its empty cause the input is not right but the file is created) in the same folder I am trying to run the other command it. so it doesn't seem an issue with the output folder.

PeteHaitch commented 2 years ago

Does the directory ~/some/path actually exist on your computer? I'm guessing it doesn't. Have you copy+pasted this code from somewhere? If you want to use this exact code, then data_dir has to be a real directory on your computer.

satzel commented 2 years ago

@PeteHaitch yes it does exist on my computer

It's the same path I use to read files in and save output to, which all works fine

PeteHaitch commented 2 years ago

Okay. Can you please supply the output of sessionInfo() and, ideally, a minimal reproducible example (including example FASTQ file). It's a bit hard to help further without these details.

satzel commented 2 years ago

thanks @PeteHaitch I managed to figure it out, even though all the paths were correct it doesn't run when there is a ~ in the path...

Shians commented 2 years ago

Tilde expansion should work, I may have missed it in certain functions, will leave myself a note here to check it.