This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Create matrix from ReadsPerGene.out.tab files

I'm trying to create a matrix from the raw counts of genes.

Here is the script. It's a nano file and I ran it with srun command.

#!/bin/bash

#SBATCH --mem=64G   for i in *ReadsPerGene.out.tab;

cut -f1,4 $i | grep -v "_" > data/deseq2/counts_4thcol/`basename $i
 ReadsPerGene.out.tab`_counts.txt;

 done

Because I got "permission denied" error from running this nano file, I tried to run it line by line. However, then I got this error

 -bash: syntax error near unexpected token `cut'

I'm wondering what I can do to make cut be recognized?

star

Thank you. I tried this, and seems like the file is created but I got this:

-bash: data/deseq2/counts_4thcol/E2715-CSC_S35_merged_counts.txt: No such file or directory

Please show us your full command.

for i in_alignment/*ReadsPerGene.out.tab;
do
  cut -f1,4 $i | grep -v "_" > data/deseq2/counts_4thcol/`basename $i ReadsPerGene.out.tab`_counts.txt;
done

Can you get this to work without the loop?

Yes. I figured it out! Thank you

What was the problem?

0 answers

No answers yet.

Log in to answer this question.