Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
magatt
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
UMR GDEC
magatt
Commits
fc95bbb9
Commit
fc95bbb9
authored
5 years ago
by
Helene Rimbert
Browse files
Options
Downloads
Patches
Plain Diff
new script gmapRescue.sh
parent
13be85a0
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
bin/gmapRescue.sh
+110
-0
110 additions, 0 deletions
bin/gmapRescue.sh
with
110 additions
and
0 deletions
bin/gmapRescue.sh
0 → 100755
+
110
−
0
View file @
fc95bbb9
#!/bin/bash
##SBATCH --array=0-7
##SBATCH -n1
##SBATCH --mail-user=helene.rimbert@inrae.fr
##SBATCH --mail-type=ALL
# for use with slurm
#chroms=($(echo TraesCS{1..7} TraesCSU))
#chrom=${chroms[$SLURM_ARRAY_TASK_ID]}
# get the list of query and target file for gmap
inputDir
=
$1
blastdb
=
$2
querylist
=(
$(
find
$inputDir
-type
f
-name
'query.fasta'
)
)
targetlist
=(
$(
find
$inputDir
-type
f
-name
'target.fasta'
)
)
numquery
=
${#
querylist
[@]
}
numtarget
=
${#
targetlist
[@]
}
#blastdb='/banks/blast/IWGSCv1.1_repr_mrna'
echo
"STARTING AT
`
date
`
FOR DATASET
$inputDir
"
echo
"found
$numquery
query fasta file"
echo
"found
$numtarget
target fasta file"
for
i
in
"
${
querylist
[@]
}
"
;
do
rootdir
=
`
dirname
$i
`
# extract the name of the gene
geneid
=
$(
cat
$rootdir
'/query.fasta'
|fgrep
'>'
|perl
-ne
'print $1 if /^\>(TraesCS.+)\ coords/'
)
echo
"
\n\n
================================================"
echo
" gene is
$geneid
"
echo
" datadir is
$rootdir
"
echo
"1. creating gmap db for dataset
$rootdir
"
if
[
!
-d
"
$rootdir
/query"
]
then
gmap_build
-D
$rootdir
-d
query
$rootdir
'/query.fasta'
&
pid
=
$!
gmap_build
-D
$rootdir
-d
target
$rootdir
'/target.fasta'
&
pid2
=
$!
wait
$pid
$pid2
fi
echo
"2. extract mrna"
mrnaid
=
$geneid
'.1'
if
[
!
-s
"
$rootdir
/query.mrna.fasta"
]
then
blastdbcmd
-db
$blastdb
-entry
$mrnaid
>
$rootdir
'/query.mrna.fasta'
fi
echo
"3. run gmap on target and query"
if
[
!
-s
"
$rootdir
/gmap.target.gff3"
]
then
gmap
-d
target
-D
$rootdir
-f
2
$rootdir
'/query.mrna.fasta'
>
$rootdir
'/gmap.target.gff3'
&
pid
=
$!
gmap
-d
query
-D
$rootdir
-f
2
$rootdir
'/query.mrna.fasta'
>
$rootdir
'/gmap.query.gff3'
&
pid2
=
$!
blastn
-query
$rootdir
'/query.fasta'
-subject
$rootdir
'/target.fasta'
-outfmt
6
-out
$rootdir
'/blast_m8.tab'
&
pid3
=
$!
wait
$pid
$pid2
$pid3
fi
rm
-rf
$rootdir
'/query'
$rootdir
'/target'
echo
"4. indexing the query and target genomic"
if
[
!
-s
"
$rootdir
/query.fasta.fai"
]
then
samtools faidx
$rootdir
'/query.fasta'
samtools faidx
$rootdir
'/target.fasta'
else
echo
" index already done"
fi
echo
"5. running gffread to extract the pep sequence"
if
[
!
-s
"
$rootdir
/target.pep.faa"
]
then
gffread
-x
$rootdir
'/target.cds.fasta'
-y
$rootdir
'/target.pep.faa'
-g
$rootdir
'/target.fasta'
$rootdir
'/gmap.target.gff3'
gffread
-x
$rootdir
'/query.cds.fasta'
-y
$rootdir
'/query.pep.faa'
-g
$rootdir
'/query.fasta'
$rootdir
'/gmap.query.gff3'
else
echo
"pep extraction already done"
fi
echo
"6. running diff to check if the pep sequences are different or not"
diffresult
=
$(
diff
$rootdir
'/target.pep.faa'
$rootdir
'/query.pep.faa'
)
if
[
!
-s
"
$rootdir
/blat.txt"
]
then
echo
"RESULTS no blat results here: no extraction to make"
touch
$rootdir
/UNMAPPED
else
if
[
"
$diffresult
"
!=
""
]
then
echo
"RESULTS pep of gene
$geneid
has changed"
echo
$diffresults
>
$rootdir
/CDS_CHANGED
else
echo
"RESULTS pep of gene
$geneid
stays the same"
touch
$rootdir
/CDS_OK
fi
fi
done
echo
"ENDED AT
`
date
`
"
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment