Good morning everybody, I need you expertise : In fact I'm trying to write a script using python object oriented programming to perform STARsolo to generate count matrix of differentially expressed genes (exons only that's why I used --quantMode GeneCounts ) but I have an erro that I can not solve ( the bash command line works )
this is the bash command line:
/opt/conda/envs/scRNA_seq_env/bin/STAR --outSAMattributes All \
--outSAMtype BAM Unsorted \
--quantMode GeneCounts \
--readFilesCommand gunzip -c \
--runThreadN 7 \
--outReadsUnmapped Fastx \
--outMultimapperOrder Random \
--genomeDir /home/output/genome_index \
--readFilesIn home/pbmc_1k_v3_fastqs/pbmc_1k_v3_S1_L001_R2_001.fastq.gz,/home/pbmc_1k_v3_fastqs/pbmc_1k_v3_S1_L002_R2_001.fastq.gz /home/pbmc_1k_v3_fastqs/pbmc_1k_v3_S1_L001_R1_001.fastq.gz,/home/pbmc_1k_v3_fastqs/pbmc_1k_v3_S1_L002_R1_001.fastq.gz \
--outFileNamePrefix home/output/testou_testou_sh \
--soloType CB_UMI_Simple \
--soloCBwhitelist home/cellranger-7.1.0/lib/python/cellranger/barcodes/3M-february-2018.txt \
--soloUMIlen 12 \
--soloCBlen 16 \
--soloUMIstart 17 \
--soloCBstart 1 \
--soloBarcodeReadLength 28 \
--soloUMIfiltering MultiGeneUMI_CR \
--soloUMIdedup 1MM_CR \
--clipAdapterType CellRanger4 \
--outFilterScoreMin 30 \
--soloCBmatchWLtype 1MM_multi_Nbase_pseudocounts \
--soloCellFilter EmptyDrops_CR
OOP version where I get the error:
import subprocess
class StarCommand:
def __init__(self, genome_dir, output_prefix, read_files, threads=7):
self.genome_dir = genome_dir
self.output_prefix = output_prefix
self.read_files = read_files
self.threads = threads
self.command = ["/opt/conda/envs/scRNA_seq_env/bin/STAR",
"--outSAMattributes", "All",
"--outSAMtype", "BAM", "Unsorted",
"--quantMode", "GeneCounts",
"--readFilesCommand", "gunzip -c",
"--runThreadN", str(self.threads),
"--outReadsUnmapped", "Fastx",
"--outMultimapperOrder", "Random",
"--genomeDir", self.genome_dir,
"--readFilesIn", self.read_files,
"--outFileNamePrefix", self.output_prefix,
"--soloType", "CB_UMI_Simple",
"--soloCBwhitelist", "home/cellranger-7.1.0/lib/python/cellranger/barcodes/3M-february-2018.txt",
"--soloUMIlen", "12",
"--soloCBlen", "16",
"--soloUMIstart", "17",
"--soloCBstart", "1",
"--soloBarcodeReadLength", "28",
"--soloUMIfiltering", "MultiGeneUMI_CR",
"--soloUMIdedup", "1MM_CR",
"--clipAdapterType", "CellRanger4",
"--outFilterScoreMin", "30",
"--soloCBmatchWLtype", "1MM_multi_Nbase_pseudocounts",
"--soloCellFilter", "EmptyDrops_CR"]
def run_command(self):
try:
subprocess.run(self.command, check=True)
print("STAR command finished successfully!")
except subprocess.CalledProcessError as e:
print(f"STAR command failed with exit code {e.returncode}:")
print(e.output)
genome_dir = "/home/output/genome_index"
output_prefix = "/home/output/testou_testou_sh"
read_files = "/home/pbmc_1k_v3_fastqs/pbmc_1k_v3_S1_L001_R2_001.fastq.gz,/home/pbmc_1k_v3_fastqs/pbmc_1k_v3_S1_L002_R2_001.fastq.gz /home/pbmc_1k_v3_fastqs/pbmc_1k_v3_S1_L001_R1_001.fastq.gz,/home/pbmc_1k_v3_fastqs/pbmc_1k_v3_S1_L002_R1_001.fastq.gz"
star_command = StarCommand(genome_dir, output_prefix, read_files)
star_command.run_command()
the error:
EXITING: because of fatal INPUT file error: could not open read file: /home/pbmc_1k_v3_fastqs/pbmc_1k_v3_S1_L002_R2_001.fastq.gz /home/pbmc_1k_v3_S1_L001_R1_001.fastq.gz
SOLUTION: check that this file exists and has read permision.
Mar 16 09:22:35 ...... FATAL ERROR, exiting
STAR command failed with exit code 102:
None
thank you in advance
my files are readable because the bash command line works perfectly :/
Are those files in two separate directories? That is what is in the error message. On command line version they are in the same directory or so it looks.
In command line version you seem to be missing a leading
/
beforehome
but that may be a copy paste error since you say that line works.and
no they are in the same directory I just missed copying the script here but I do it right in my terminal and keep having the same error :/
This exatly how my codes looks like and the error generated : (bash script works )
this is the bash command line:
OOP version where I get the error:
the error:
thank you in advance