bowtie2, and python script
2
0
Entering edit mode
22 months ago
qudrat.nii ▴ 40

Hello, Everytime I run my script it shows "bad file descriptor" in terminal. Following is my script. Please help

import os
import subprocess
import shlex
fastq1 = []
fastq2 = []
path = os.listdir('kud')
for files in path:
    if '_1' in files:
        fastq1.append(files)
    if '_2' in files:
        fastq2.append(files)
for i,j in zip(fastq1,fastq2):
    command = "bowtie2 -x bt2_base -1 i -2 j -S z.sam"
    cmd = shlex.split(command)
    subprocess.run(cmd,shell=False,stdout=subprocess.PIPE,stderr=subprocess.PIPE,universal_newlines=True)
and python bowtie2 script • 1.5k views
ADD COMMENT
1
Entering edit mode
22 months ago
Asaf 10k

Just a guess - the file names you are passing don't have the directory name ('kud') but I don't know.

Anyhow, I would highly suggest to avoid running such scripts and using proper workflow managing software such as nextflow, snakemake or other. 99% chance that what you are trying to run was already implemented in nf-core and you just need to run the pipeline.

ADD COMMENT
3
Entering edit mode
22 months ago
barslmn ★ 2.3k

This is still related to your old thread. bowtie2, and python script. Why start a new one?

You're trying to use variables inside a string.

x = 5
s = "x"
print(s)

This will just print string x and not the int 5. In your example you're setting command string with literal characters i and j and not with their values. Instead, you just do some string formatting.

# here are some examples.
x = 5
y = 6
s = f"x is {x} y is {y}"

You can read more about string formatting in python docs.

ADD COMMENT
0
Entering edit mode

Even after string formating, i.e f"(-1 {i} -2 {j})" it is showing problem of "bowtie2-align exited with value 2\n')"

ADD REPLY
1
Entering edit mode

Why do you have parenthesis? Shouldn't look like this?

f"-1 {i} -2 {j}"
ADD REPLY

Login before adding your answer.

Traffic: 2161 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6