![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Problem doing string search in Tablet | salmonella | Bioinformatics | 2 | 06-26-2011 10:03 AM |
About Mosaik Assembler Consensus String | Iris Cristata | Bioinformatics | 3 | 07-05-2010 10:24 AM |
Help please, regulatory elements | johnshembb | Bioinformatics | 1 | 04-29-2010 10:57 AM |
generate CIGAR string from 2 sequences? | bbimber | Bioinformatics | 0 | 03-20-2010 10:44 AM |
Tag (string) Compression Techniques | foolishbrat | Bioinformatics | 2 | 01-09-2009 09:32 PM |
![]() |
|
Thread Tools |
![]() |
#1 |
Member
Location: US Join Date: Nov 2011
Posts: 16
|
![]()
Hi folks,
Could any one please tell me how to get the last few elements from a string using perl? for eg, $string= ATTGGCTACC; if I want to print the last 3 elements in the above string, how can I script it? Thank you, Pradhaun. |
![]() |
![]() |
![]() |
#2 |
Senior Member
Location: USA, Midwest Join Date: May 2008
Posts: 1,178
|
![]()
Why don't you try this: http://lmgtfy.com/?q=perl+substring
|
![]() |
![]() |
![]() |
#3 |
Member
Location: China Join Date: Nov 2011
Posts: 14
|
![]()
$substring=substr($string,7,3);
or $substring=substr($string,-3,3); |
![]() |
![]() |
![]() |
#4 |
Member
Location: US Join Date: Nov 2011
Posts: 16
|
![]()
thank you heiya!! It worked out!!
Thank you so much!! |
![]() |
![]() |
![]() |
#5 |
Senior Member
Location: Purdue University, West Lafayette, Indiana Join Date: Aug 2008
Posts: 2,317
|
![]()
The substr always seems alien to me, whereas simple regexes seem natural.
my ($substring) =$string=~ /(...)$/; speaks to me "capture the last 3 characters before the end of the string and assign them to $substring. (Okay the parentheses around $substring, denoting that the characters themselves should be assigned to $substring, not just whether the test succeeded or not -- that is not very intuitive.) But if I want to only capture the last three bases if they are sequence characters, only a minor change is required: my ($substring)=$string=~/([ACGTacgtNn]{3})$/; But I have heard that substr is faster. -- Phillip |
![]() |
![]() |
![]() |
#6 |
Member
Location: US Join Date: Nov 2011
Posts: 16
|
![]()
Thank you pmiguel! I tried your suggestion. It worked well! Thank you so much!
-pradhaun |
![]() |
![]() |
![]() |
#7 |
Senior Member
Location: Purdue University, West Lafayette, Indiana Join Date: Aug 2008
Posts: 2,317
|
![]()
Hi Pradhaun,
Welcome to the world of regular expressions! Although I should caution you about the old perl joke: Say you have a problem and think "I will use regular expressions to solve that". Now, you have two problems... Also Rick though I should have shortened the line to: my ($substring)=$string=~/([ACGTN]{3})$/i; -- Phillip |
![]() |
![]() |
![]() |
#8 |
Member
Location: US Join Date: Nov 2011
Posts: 16
|
![]()
Hello all,
I am using Tophat and cufflinks to estimate the copy number of genes in an organism by comparing to its closely related organism genes. I got a bam and gtf file as a outputs from Tophat and Cufflinks . I tried to view the alignment (Tophat output) file as well as the gtf file in IGV. I can see the FPKM value for every single gene but My question is, how can I know whether these two organisms are closely related? Like for eg., "There are x number of same set of genes present in both the organisms" Or is there any way to know the overall FPKM or copy number? I am new to this kind of study, am not sure whether my thinking can be applicable or not. So I would appreciate if you can please provide your suggestions... Thank you, Pradhaun |
![]() |
![]() |
![]() |
#9 | |
Senior Member
Location: San Diego Join Date: May 2008
Posts: 912
|
![]() Quote:
|
|
![]() |
![]() |
![]() |
#10 | |
Rick Westerman
Location: Purdue University, Indiana, USA Join Date: Jun 2008
Posts: 1,104
|
![]() Quote:
|
|
![]() |
![]() |
![]() |
Thread Tools | |
|
|