SEQanswers

Go Back   SEQanswers > Bioinformatics > Bioinformatics



Similar Threads
Thread Thread Starter Forum Replies Last Post
BEDtools v2.14.3 installation issue for OSX Lion? : bamToBed grimmer Bioinformatics 2 11-21-2011 07:21 PM
Do anyone have compiled Mac OSX version of helisphere? feng Bioinformatics 0 07-28-2011 01:16 PM
How to assign more CPU cores to terminal on Mac? harrike General 1 04-14-2011 10:56 AM
64bit dindel on mac osx csoong Bioinformatics 0 01-02-2011 08:30 AM
xgrid with Mac OSx feng Bioinformatics 0 11-28-2010 08:55 AM

Reply
 
Thread Tools
Old 03-21-2012, 11:24 AM   #1
qnc
Member
 
Location: London

Join Date: Jun 2010
Posts: 51
Default Mac OSX Lion Terminal Version 2.2.2 (303) Problems

Hi,

The genomeCoverageBed program made each line without the "Chr" start making it hard to use in UCSC Genome browser.

i.e.
17 422997 422999 26
17 422999 423001 27
17 423001 423003 29


There are over 10,000,000 lines so how do I add "chr" to the beginning of each like this:

chr17 422997 422999 26
chr17 422999 423001 27
chr17 423001 423003 29


I have tried:

awk '{print "chr"$1,$2,$3,$4}' inputFile.bed > outputFile.bed
awk '/^/{print "chr"$1,$2,$3,$4}' inputFile.bed > outputFile.bed
sed -i .bak 's/^/chr/'inputFile.bed > outputFile.bed
sed -i '''s/^/chr/' inputFile.bed > outputFile.bed
sed 's/^/^chr/' inputFile.bed > outputFile.bed
and others…

All of which do the first line and nothing more?


When I use $ head ch17.txt | od -c

I get lots of weird charters

0000000 t r a c k t y p e = b e d G r
0000020 a p h n a m e = V a n i t a
0000040 c o l o r = 0 , 1 2 8 , 0 \n 1 7
0000060 \t 3 9 7 1 4 2 \t 3 9 7 1 5 2 \t 1
0000100 \n 1 7 \t 3 9 7 1 5 2 \t 3 9 7 1 7
0000120 1 \t 2 \n 1 7 \t 3 9 7 1 7 1 \t 3 9
0000140 7 1 8 3 \t 3 \n 1 7 \t 3 9 7 1 8 3
0000160 \t 3 9 7 1 9 2 \t 4 \n 1 7 \t 3 9 7
0000200 1 9 2 \t 3 9 7 2 0 2 \t 3 \n 1 7 \t
0000220 3 9 7 2 0 2 \t 3 9 7 2 2 1 \t 2 \n
0000240 1 7 \t 3 9 7 2 2 1 \t 3 9 7 2 3 3
0000260 \t 1 \n 1 7 \t 3 9 7 5 7 5 \t 3 9 7
0000300 6 2 7 \t 1 \n 1 7 \t 3 9 7 7 7 1 \t
0000320 3 9 7 7 9 6 \t 1 \n
0000331

Are people finding this problem as well and has anyone got a solution so that my BEDTools files can be used on UCSC Genome Browser?
qnc is offline   Reply With Quote
Old 03-21-2012, 11:58 AM   #2
westerman
Rick Westerman
 
Location: Purdue University, Indiana, USA

Join Date: Jun 2008
Posts: 1,104
Default

Your methods (at least some of them) should work. Perhaps a Mac OS-X problem?

On linux I get:

Code:
prompt> cat t.tmp
17  422997  422999  26
17  422999  423001  27
17  423001  423003  29

prompt> sed 's/^/chr/' t.tmp 
chr17  422997  422999  26
chr17  422999  423001  27
chr17  423001  423003  29
Ditto for Solaris-OS (which does not use gsed -- the linux default). My Mac is not available but it is hard to see that such a basic program such as sed used in such a basic manner giving many problems.
westerman is offline   Reply With Quote
Old 03-21-2012, 12:09 PM   #3
dpryan
Devon Ryan
 
Location: Freiburg, Germany

Join Date: Jul 2011
Posts: 3,479
Default

To add to what Rick wrote, I don't see any weird characters in the example output you showed. The control characters and character number stuff one would expect when piping through od.
dpryan is offline   Reply With Quote
Old 03-21-2012, 12:18 PM   #4
qnc
Member
 
Location: London

Join Date: Jun 2010
Posts: 51
Default

Quote:
Originally Posted by westerman View Post
Your methods (at least some of them) should work. Perhaps a Mac OS-X problem?

On linux I get:

Code:
prompt> cat t.tmp
17  422997  422999  26
17  422999  423001  27
17  423001  423003  29

prompt> sed 's/^/chr/' t.tmp 
chr17  422997  422999  26
chr17  422999  423001  27
chr17  423001  423003  29
Ditto for Solaris-OS (which does not use gsed -- the linux default). My Mac is not available but it is hard to see that such a basic program such as sed used in such a basic manner giving many problems.
Thanks guys so what should I do is there another terminal I can use or do I reinstall it.

How hard is it to turn a PC into linux etc?
qnc is offline   Reply With Quote
Old 03-21-2012, 12:47 PM   #5
dpryan
Devon Ryan
 
Location: Freiburg, Germany

Join Date: Jul 2011
Posts: 3,479
Default

I just tested on my home laptop and the first 3 commands you posted work fine (more or less, you told sed to edit in place so I changed things to make more sense) under OS X (10.6.8, though 10.7 is unlikely to be different). Either there's something very odd with your OS X installation or you're doing something else wrong.

The difficulty of installing linux on a PC varies a lot with your past experience. If you've never done it before and are unlucky in having some obscure software then it can be difficult. Otherwise it's not terribly difficult. But I've been using various *nixes for about 15 years...
dpryan is offline   Reply With Quote
Old 03-22-2012, 04:47 AM   #6
qnc
Member
 
Location: London

Join Date: Jun 2010
Posts: 51
Default

Quote:
Originally Posted by dpryan View Post
I just tested on my home laptop and the first 3 commands you posted work fine (more or less, you told sed to edit in place so I changed things to make more sense) under OS X (10.6.8, though 10.7 is unlikely to be different). Either there's something very odd with your OS X installation or you're doing something else wrong.

The difficulty of installing linux on a PC varies a lot with your past experience. If you've never done it before and are unlucky in having some obscure software then it can be difficult. Otherwise it's not terribly difficult. But I've been using various *nixes for about 15 years...

Got some advice from this thread and so giving that a go. (http://seqanswers.com/forums/showthr...8420#post68420)

I think I'll get a proper unix installed as well. no harm in having that working and it will also mean that my main mac is free to work on other things.

What would you recommend as a os and things that I might need to get.

Was going for 1TB hard drive is that enough or should I get more.

Doing Whole Exome sequencing so getting files of around 10GB.

Do you set it up as a ftp server for things like Galaxy?

Want to get a reasonably good platform.
qnc is offline   Reply With Quote
Old 03-22-2012, 05:44 AM   #7
dpryan
Devon Ryan
 
Location: Freiburg, Germany

Join Date: Jul 2011
Posts: 3,479
Default

Any Linux distribution would work, Ubunutu is one of the more popular ones at the moment. Storage size depends mostly on what you'll be doing, there are other threads on this forum with suggestions on that. I've never used Galaxy, it's easier for me to just directly use the programs for which it's a front-end.
dpryan is offline   Reply With Quote
Old 03-22-2012, 09:05 AM   #8
cliffbeall
Senior Member
 
Location: Ohio

Join Date: Jan 2010
Posts: 144
Default

Is it too obvious to suggest line endings? Mac default now should be new lines, but I know the old style CRs still get used sometimes. Excel and Filemaker will both do this.

This still trips me up on occasion. tr "\r" "\n" then pipe to the command you want.
cliffbeall is offline   Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off




All times are GMT -8. The time now is 10:32 PM.


Powered by vBulletin® Version 3.8.9
Copyright ©2000 - 2018, vBulletin Solutions, Inc.
Single Sign On provided by vBSSO