txt file to bigwig
2
0
Entering edit mode
9.1 years ago
tanni93 ▴ 50

Hi all,

After scanning my FastA file for motifs MEME had outputted a txt file --> I now need this in bigwig format in order to analyze regions in IGV. How can I convert a text file to a bigwig file?

Any help is appreciated!

MEME bigwig • 6.2k views
ADD COMMENT
0
Entering edit mode

What does your text file look like? Could you paste a short example?

ADD REPLY
0
Entering edit mode

sample lines:

#pattern name    sequence name    start    stop    strand    score    p-value    q-value    matched sequence
1    mm9_chr14_48902729_48903386_+    562    576    -    22.5574    6.73e-09    0.182    GCATGTCCAGGCATG
1    mm9_chr9_54962288_54963350_+    779    793    -    22.0164    1.17e-08    0.182    GCAAGCCCAGACATG
1    mm9_chr3_80861952_80862800_+    384    398    -    21.5082    2.38e-08    0.244    ACAAGCCCAGGCATG
1    mm9_chr1_137651753_137653400_+    559    573    -    21.1148    4.07e-08    0.244    GCTTGTCCAGACATG
1    mm9_chr5_111972284_111973197_+    414    428    -    21.0492    4.31e-08
ADD REPLY
0
Entering edit mode

sample lines:

#pattern name    sequence name    start    stop    strand    score    p-value    q-value    matched sequence
1    mm9_chr14_48902729_48903386_+    562    576    -    22.5574    6.73e-09    0.182    GCATGTCCAGGCATG
1    mm9_chr9_54962288_54963350_+    779    793    -    22.0164    1.17e-08    0.182    GCAAGCCCAGACATG
1    mm9_chr3_80861952_80862800_+    384    398    -    21.5082    2.38e-08    0.244    ACAAGCCCAGGCATG
1    mm9_chr1_137651753_137653400_+    559    573    -    21.1148    4.07e-08    0.244    GCTTGTCCAGACATG
1    mm9_chr5_111972284_111973197_+    414    428    -    21.0492    4.31e-08
ADD REPLY
2
Entering edit mode

to me wiggle file wouldn't be a good options, from what I understand wiggle file is good for representing something at a given genomic position, although position can span multiple bases.. I'm pretty sure you'll be better off investigating bed format and trying to convert your text file into bed, which also has bigBed - binary version. I believe IGV and other viewers accept those formats. In fact your file is essentially bed file, all you need to do is to chop last few columns out. You might want to keep score values in. For more look here https://genome.ucsc.edu/FAQ/FAQformat.html#format1

ADD REPLY
0
Entering edit mode

Hi all,

I am new to these kind of analysis and appreciate any guidance on my issue here: I have analyzed peakcalling .txt files that are ready for plotting and visualization and I want to use deeptools with linux command line for meta-profile heatmaps and other possible tools here, since my files are all .txt and contain all peak information with 19 columns as below:

PeakID (cmd=annotatePeaks.pl CHA-1_peaks.narrowPeak hg38) | Chr | Start | End | Strand | Peak Score | Focus Ratio/Region Size | Annotation | Detailed Annotation | Distance to TSS | Nearest PromoterID | Entrez ID | Nearest Unigene | Nearest Refseq | Nearest Ensembl | Gene Name | Gene Alias | Gene Description | Gene Type

can somebody help me with the common steps and workflow to convert .txt file to bed and bigwig files to do further analysis like DE and also visualize by using the deeptools?

I really appreciate any guidance.

Best Sogand

ADD REPLY
0
Entering edit mode

Please stop asking questions in existing threads. Delete these two comments and open a new question with all the necessary details to understand your data and elaborate what you need.

ADD REPLY
0
Entering edit mode

Hi, I tried to delete my comment but can't see any delete/remove option here!

Thanks

ADD REPLY
0
Entering edit mode

Click on edit. That should open the edit window which will have a Delete button at bottom right to delete the comment/reply.

ADD REPLY
1
Entering edit mode
9.1 years ago

Hi Tanni93,

Most likely you will need to do some custom scripting in your preferred language (python..?)... Like jotan1982 mentioned you should post head of the file you are trying to make your wiggle file from, this may help us to provide you with more specific answer. I personally don't know of any tools that convert any text files into wiggle file.

Don't get confused about bigWig and wig files. What you want is to convert your text file into wiggle file (.wig). Here is specification on how wiggle file should look like http://genome.ucsc.edu/goldenpath/help/wiggle.html. Wiggle file is just flat text file that follows some specifications. You then will need to download wigToBigWig tool that will convert your wiggle file into binary version - bigWig file. Here https://genome.ucsc.edu/goldenpath/help/bigWig.html you can find more information on how to make bigWig from wig and also a link to directory to where you can download wigToBigWig tool.

A note aside; I have fairly recently played around with wiggle files and IGV and as far as I can tell IGV didn't handle my wiggle file with two separate track, i.e track for forward reads and track for reverse reads all in one file..IGV would only display the last track in the file, whereas UCSC browser displayed both track no problem. I didn't try to convert to bigWig. (yes thats another point that I just realised IGV can handle wiggle file fine).

Its rather had to tell what format you should use, since very little information is provided about your file, but maybe different file format might be more appropriate e.g bed format, should also be handled by IGV.

Cheers,
Kirill

ADD COMMENT
0
Entering edit mode

Thank you Kirill! Very helpful advice!

ADD REPLY
0
Entering edit mode
8.5 years ago
Dataman ▴ 380

As Kirill mentioned, BED format is a better option. Here is my Python script which does the BED conversion for you. Note that this script is for demonstration purpose and you need to change the code a bit to get your desired output. Also note that part of your data is missing, however, you can also concatenate them together and for instance put them on the 4th column of your result file.

fin = open('my_orig_file.txt', 'r')
fout = open('my_bed_file.bed', 'w')
next(fin)
for l in fin:
    cols = l.strip().split('\t')
    fout.write('%s\t%s\t%s\t%s\t%s\t%s\n' %(cols[0], cols[2], cols[3], cols[1], cols[5], cols[4]))    
fin.close()
fout.close()

Assumptions:

  1. I have assumed that the columns in your file is tab-separated that is why .split('\t'). You can change it accordingly.

This is how one of the rows will look like in the IGV:

enter image description here

ADD COMMENT
0
Entering edit mode

Dataman Why did you delete this answer?

ADD REPLY

Login before adding your answer.

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