This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Writing scripts for a single vs all chromosomes

I'm new to RNA-seq data sets (and programming in general) and so far have only analyzed sample data from a single chromosome from various papers. My question is, aside from the amount of time required to process the samples, how much different would a basic shell script look? For instance, here is a simple script I wrote for aligning data from a single chromosome:

    set -euo pipefail
SAMPLES=chrX_data/files.txt
mkdir -p sam
CPUS=8
IDX=chrX_data/indexes/chrX_tran
for SAMPLE in $(cat $SAMPLES)
do
    R1=chrX_data/samples/${SAMPLE}_chrX_1.fastq
    R2=chrX_data/samples/${SAMPLE}_chrX_2.fastq
    SAM=${SAMPLE}_chrX.sam

    hisat2 -p $CPUS --dta -x $IDX -1 $R1 -2 $R2 -S $SAM
done

How much would I have to re-work this script for data from all chromosomes? Assuming I use an Illumina sequencer, does each chromosome have its own fastq file which would require me to concatenate them or does all the data from one sample come in one fastq file (assuming single end reads)?

rna-seq script shell

If answers were helpful, feel free to upvote and accept:

enter image description here

2 answers

All of the data will come in a single fastq file per sample (or two files for paired end data). The chromosome information cannot be determined until after mapping.

So for sample 1 you'll either have sample1.fastq for single end or sample1_R1.fastq and sample1_R2.fastq for a paired end library. I don't see anything in the sample script that would need to be changed to account for a larger analysis assuming you have the proper index generated (and as always >8 CPUs will allow faster mapping).

A fastq or bam is not chromosome-specific unless someone aligns it and picks out the reads aligning to one chromosome. So you generally won't be looping through multiple files for a single sample. You'll just align one sample's fastq to the whole genome, and have one bam for the whole genome.

Log in to answer this question.