This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Extract Hard-clipped and soft-clipped values from fifth column

Hello all,

Is it possible to know how I can extract 105 hard-clipped base from fifth column and then add value 105 to end coordinate of chr1 ?

As I tried with awk, but no success !

chr1    21730812    21730857    M00758:777:BKR4B:1:2103:25646:13282  45M105H
chr1    179196680   179196716     M00758:777:BKR4B:1:2101:24687:24458     87H36M27H

Thanks a lot!

sequencing awk perl bash

105 hard-clipped base from fifth column and then add value 105 to end coordinate of chr1 ?

do you really want to do this ??? how would you handle a 'N' or a 'D' in the cigar string ???

Here is the code :

awk -F'\t' 'NR==FNR{arr[$1]++;next}{for(i=1; i<=NF; i++) if ($i in arr){a[i]++;}} { for (i in a) printf "%s\t", $i; printf "\n"}'  file.bed

This is your input :

chr1    21730812    21730857    M00758:777:BKR4B:1:2103:25646:13282    45M105H

chr1    179196680    179196716    M00758:777:BKR4B:1:2101:24687:24458    87H36M27H

And you want a result like this :

chr1    21730812    21730962    M00758:777:BKR4B:1:2103:25646:13282    45M105H

chr1    179196680    179196743    M00758:777:BKR4B:1:2101:24687:24458    87H36M27H

?

I want a result like this :

chr1   21730857     21730962    M00758:777:BKR4B:1:2103:25646:13282    45M105H

chr1    179196716    179196743    M00758:777:BKR4B:1:2101:24687:24458    87H36M27H

Thanks !

You wish to add number of Matched based to start position and number of hard clipped to end position?

Why?

You mean for the first line :

chr1   21730812     21730962    M00758:777:BKR4B:1:2103:25646:13282    45M105H

Because 45M105H does not have hard clipping as start

Yes ! Any idea how i can be able to achieve this ?

Please explain your awk script as it does nothing to pick relevant parts of $5 or add to $2 or $3. I don't even see why a loop is necessary in your awk script.

Also, please edit your question and add your awk script in there.

What is the larger problem that you are attempting to solve, and why only hard clips, not soft clips?

Wouldn't it be easier to just use a utility such as gridss.ComputeSamTags SOFTEN_HARD_CLIPS=true to convert your hard clips into soft clips then do you conversion to BED?

Hello Ram,

Please provide feedback to the comments here so we can get this discussion to closure.

Thank you!

0 answers

No answers yet.

Log in to answer this question.