Question: why is my txt file empty ?
0
gravatar for F
3.2 years ago by
F3.1k
Iran
F3.1k wrote:

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
[izadi@lbox161 tophat_out]$ 

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

txt sam bam myposts • 1.8k views
ADD COMMENTlink modified 3.2 years ago • written 3.2 years ago by F3.1k
1
gravatar for F
3.2 years ago by
F3.1k
Iran
F3.1k wrote:

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 COMMENTlink written 3.2 years ago by F3.1k
1
gravatar for James Ashmore
3.2 years ago by
James Ashmore2.5k
UK/Edinburgh/MRC Centre for Regenerative Medicine
James Ashmore2.5k wrote:

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 COMMENTlink modified 3.2 years ago • written 3.2 years ago by James Ashmore2.5k

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 REPLYlink modified 3.2 years ago • written 3.2 years ago by F3.1k
1

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 REPLYlink written 3.2 years ago by James Ashmore2.5k

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 REPLYlink written 3.2 years ago by F3.1k
1

Can you show me a sample of your SAM file?

samtools view your_file.bam
ADD REPLYlink written 3.2 years ago by James Ashmore2.5k
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1720 users visited in the last hour