This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Help required in making a script work for NGS data analysis pipeline

How to make work the following script? I got this code from some tutorial and I have no idea how to make it work? Is it a perl script or python? how to execute it. Kindly help me out in this regard . Thanks

$ for left_fq in /data/reads/NA19240/*_1.fq; do
$ right_fq=${left_fq/_1.fq/_2.fq}
$ lane_id=$(basename ${left_fq/_1.fq})
$ rtg format -f fastq -q sanger -o ${lane_id} -l ${left_fq} -r $
{right_fq} --sam-rg "@RG\tID:${lane_id}\tSM:NA19240\tPL:ILLUMINA"
$ done
ngs code

Hmm . Can you kindly elaborate a little more? like how can i make this script work? pasting in notepad? .bat extension?

Oh, I did not notice you may use windows. That would be very complicated I think.

2 answers

Hi Adnan,

As Pierre says, it is bash script.

To fully understand it, you should first get some insights of linux bash commands, such ls, cd. Supposing you are following a tutorial, you should have some .fq files at /data/reads/NA19240/. They should name as *_1.fq and *_2.fq. And you should have a software called rtg, which may mentioned in the tutorial.

Then you should be able to run it.

To run, either type the whole following code in command line:

for left_fq in /data/reads/NA19240/*_1.fq; do right_fq=${left_fq/_1.fq/_2.fq}; lane_id=$(basename ${left_fq/_1.fq}); rtg format -f fastq -q sanger -o ${lane_id} -l ${left_fq} -r ${right_fq} --sam-rg "@RG\tID:${lane_id}\tSM:NA19240\tPL:ILLUMINA"; done

or: type for left_fq in /data/reads/NA19240/*_1.fq; do then press "Enter" or "Return" on your keyboard. And do the same for the following lines. IGNORE the $ signs at the start of each line. It is just the sign indicating that you should run the rest part in your command line.

Hope this can help you.

Sorry. This reply presumes that you can try this on a Linux or Unix machine. And if you are going to use some other bioinformatics tools. I highly suggest that you use Linux to follow those tutorials. You can try Ubuntu, it is a free system.

Or Cygwin in Windows..

Log in to answer this question.