This is a test version of Biostars. For the public version, visit https://www.biostars.org.
how to seperate gene info

Hello, When I am trying to do samtools on each of sequence, I met the problem of seperating them. I have file gene.info which contain contents:

ENA|MBYW01000151|MBYW01000151.1 34978   35427
ENA|MBYW01000151|MBYW01000151.1 36152   36476

what I want to have is them separate,

file1 with content ENA|MBYW01000151|MBYW01000151.1 34978 35427

file2 with contnet ENA|MBYW01000151|MBYW01000151.1 36152 36476

I thought it will be easy to achieve with cut command, but

 cat geneinfo.txt | cut -f 1
 ENA|MBYW01000151|MBYW01000151.1
 ENA|MBYW01000151|MBYW01000151.1

 cat geneinfo.txt | cut -f 2
 34978
 36152

 cat geneinfo.txt | cut -f 3
 35427
 36476

which is really wield, I don't know why?

Thanks for your helping.

for more information, geneinfo.txt is obtained by run

blastn -query S288C_YLL052C_AQY2_genomic.fsa -db beer001.fa -outfmt "6 sseqid send sstart" >> geneinfo.txt
sequencing

head -n 1 gene.info > file1

head -n 2 gene.info > file2

I am trying to do samtools on each of sequence

What does that mean?

samtool is a tool to clip certain regions of genes.

1 answer

cut cuts by column, not by line. If you want each line in single files, then you should go for something like this:

awk '{print > "file"NR}' geneinfo.txt

being NR the row number.

Thanks for your help.

Log in to answer this question.