why is my txt file empty ?
2
0
Entering edit mode
9.3 years ago
zizigolu ★ 4.3k

Sorry friends,

I tried to convert a sam file produced by tophat2 to txt but the output txt file is empty...why?

[izadi@lbox161 tophat_out]$ cat accepted_hits.sam |grep -v ^@| awk '{print $3}' > accepted_hits.txt

Any suggestion please? I need the txt file for biophysconnector package

I also tried another command with bed file but the output txt is empty again

cat file.bed | awk '{print $1}' > file.txt
sam bam • 4.9k views
ADD COMMENT
1
Entering edit mode
9.2 years ago
zizigolu ★ 4.3k

actually both of used commands worked but the issue was that the first there was no gene id in first column in which i expect to be extracted then normally the produced txt file seemed empty!!! i donno why when i used bed produced from converting the tophat2 bam the txt file was empty while when used the bed from bowtie2, the txt file was not empty..

ADD COMMENT
1
Entering edit mode
9.3 years ago
James Ashmore ★ 3.5k

TopHat outputs BAM files not SAM files - if you've converted the BAM file to a SAM file can you show me the command you used?

ADD COMMENT
0
Entering edit mode

yes of course and the produced sam is not empty

the command:

[izadi@lbox161 ouput1]$ $SAM/samtools view -h accepted_hits.bam > accepted_hits.sam

do you know please how I can produce a txt file???? because I could display the average of reads by biophysconnector that needs two txt files from RNA-seq and ribo-seq and a bed file from ribo seq..then this package could extract the average of reads and show the graph...but I cant produce the txt file with sam nor bed

ADD REPLY
1
Entering edit mode

Providing there are actual alignments in your BAM file and TopHat didn't encounter errors you should be able to do the following:

samtools view your_file.bam | awk '{print $3}' > your_file.txt

This will give you a text file with the name of the reference sequence that your reads aligned to

ADD REPLY
0
Entering edit mode

thank you,

I tried your command but the txt file is empty again

just one column

I
I
I
I
I
I

so on

ADD REPLY
1
Entering edit mode

Can you show me a sample of your SAM file?

samtools view your_file.bam
ADD REPLY

Login before adding your answer.

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