0

I have data files in the form of pairs.e.g. Sample_27931_RNAX_R1.fastq.gz & FASTQ/Sample_27931_RNAX_R2.fastq.gz belong to one Sample.Below I have shown the data for 3 samples,each having pairs R1 and R2.

For running the analysis,I create a list of the paths of them separately.So list1 contains all the R1's and list2 contains all the R2's.

Here is the list1 for 3 samples

$TMPDIR/FASTQ/Sample_27931_RNAX_R1.fastq.gz 
$TMPDIR/FASTQ/Sample_28891_RNAX_R1.fastq.gz 
$TMPDIR/FASTQ/Sample_28897_RNAX_R1.fastq.gz

Here is the list2 for 3 samples

$TMPDIR/FASTQ/Sample_27931_RNAX_R2.fastq.gz
$TMPDIR/FASTQ/Sample_28891_RNAX_R2.fastq.gz
$TMPDIR/FASTQ/Sample_28897_RNAX_R2.fastq.gz

I want to create configuration files for each Sample(total 3). The configuration file needs to created separately for each sample.

e.g. A Sample config file is below:

**fastq1        = $TMPDIR/FASTQ/Sample_27931_RNAX_R1.fastq.gz**
**fastq2        = $TMPDIR/FASTQ/Sample_27931_RNAX_R2.fastq.gz**

mailto         = [email protected]
thread_no      = 8

detect_integration = yes   # if no is provided, VirusFinder will not detect virus integrations
detect_mutation    = no   # if no is provided, VirusFinder will not detect viral mutations

The fastq1 and fastq2 parameters need to be changed using the paths from the list1 and list2 but the rest of the content remains same.How to I create multiple config files using the list1 and list2? the name of config files should be automatically taken from the name of the sample such as Sample_27931_RNAX.config.txt for Sample_27931_RNAX. Any suggestions or link to any similar posts will be nice.I was not able to find similar posts.

Thanks,

Ron

1 Answer 1

1
#!/bin/bash
while IFS= read -r samp1; do

b=${samp1%_R1.fastq.gz} samp2=${b}_R2.fastq.gz

cat - <<eof > "${b##*/}.cfg"
**fastq1        = $samp1**
**fastq2        = $samp2**

mailto         = [email protected]
thread_no      = 8

detect_integration = yes  # if no is provided, VirusFinder will not detect virus integrations
detect_mutation    = no   # if no is provided, VirusFinder will not detect viral
eof
done < LIST1

Note that List2 is really not necessary, as we are able to graft the name of the second sample fastq from the first itself.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .