This is a test version of Biostars. For the public version, visit https://www.biostars.org.
[Waiting on OP] Convert table to text

Hi all,

I have a table like this:

CHROM   BIN_START   BIN_END  N_VARIANTS  WEIGHTED_FST    MEAN_FST
1        1          40000    418         0.0428711       0.0402737
1        20001      60000    434         0.0368677       0.0359379
1        40001      80000    420         0.0382382       0.0373063
1        60001      100000   368         0.0390281       0.0379922
1        80001      120000   379         0.0540822       0.0488926
1       100001      140000   358         0.0619048       0.0507374

So, i want to convert it to the following text:

fixedStep chrom=chr1 start=1     step=20000
0.0428711
fixedStep chrom=chr1 start=20001 step=20000
0.0368677
fixedStep chrom=chr1 start=40001 step=20000
0.0382382
fixedStep chrom=chr1 start=60001 step=20000
0.0390281
fixedStep chrom=chr1 start=80001 step=20000
0.0540822
fixedStep chrom=chr1 start=100001 step=20000

Description: chrom=chr1 = CHROM column ,. start=1 = BIN_START column ,. 0.0428711 = WEIGHTED_FST column

What is the best idea?

snp r

What have you tried? As has been mentioned multiple times, you need to demonstrate effort if you'd like for us to help you. I'll be closing this post until you edit it and add details on your efforts so far.

Hello mostafarafiepour!

OP needs to add more details, as has been asked of them in their past posts. See: C: Convert table to text

For this reason we have closed your question. This allows us to keep the site focused on the topics that the community can help with.

Cheers!

Dear RamRS,

for generat this file i use this script Which is provided by How Can I Convert Bam/Sam To Wiggle

samtools pileup fileName.bam | perl -ne 'BEGIN{print "track type=wiggle_0 name=fileName description=fileName\n"};($c, $start, undef, $depth) = split; if ($c ne $lastC) { print "variableStep chrom=$c\n"; };$lastC=$c;next unless $. % 10 ==0;print "$start\t$depth\n" unless $depth<3;'  > fileName.wig

But i can not create this file. I do not know exactly what changes should be made to this script so that I can create the file.

Edit your question, mention this detail along with the exact error that you face. What would also help is if you took a guess at why you're facing the error that you're facing. Once you do that, I will reopen the question.

But i can not create this file.

You need to learn to be more specific. We cannot guess what's happening if you don't provide us with the required information.

You have been told every thread to show us what you tried. Future questions in which you do not show any effort at all to solve your issue will be closed just like this one.

0 answers

No answers yet.

Log in to answer this question.