Create matrix from ReadsPerGene.out.tab files
0
0
Entering edit mode
2.8 years ago
Yihan • 0

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 • 1.4k views
ADD COMMENT
0
Entering edit mode
 for i in *ReadsPerGene.out.tab; do cut ...
ADD REPLY
0
Entering edit mode

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
ADD REPLY
0
Entering edit mode

Please show us your full command.

ADD REPLY
0
Entering edit mode
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
ADD REPLY
0
Entering edit mode

Can you get this to work without the loop?

ADD REPLY
0
Entering edit mode

Yes. I figured it out! Thank you

ADD REPLY
0
Entering edit mode

What was the problem?

ADD REPLY

Login before adding your answer.

Traffic: 2454 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