Comments (5)
Thanks for the info!
from stitchr.
Hello hello,
Glad to see that the import option is getting some attention! It is however a relatively advanced use of the tool, so unfortunately you have to do a little more legwork to recapitulate the fuller functionality of the current scripts. To answer your questions:
1- The way that the tool works is that the core stitch
function does the actual legwork of sticking the V/J/CDR3 together and then the different scripts take that information and process it to whatever the relevant format is. As this importing example only runs that st.stitch
function you don't get the full output that the command line stitchr.py
script produces.
However it's pretty simple to get the same information out of the results provided - you just need to translate the stitched nt sequence, which is the second item in the output, e.g.:
aa = fxn.translate_nt(stitched[1])
print(aa)
MGTRLLCWAALCLLGADHTGAGVSQTPSNKVTEKGKYVELRCDPISGHTALYWYRQSLGQGPEFLIYFQGTGAADDSGLPNDRFFAVRPEGSVSTLKIQRTERGDSAVYLCASSYLQAQYTEAFFGQGTRLTVVEDLNKVFPPEVAVFEPSEAEISHTQKATLVCLATGFFPDHVELSWWVNGKEVHSGVSTDPQPLKEQPALNDSRYCLSSRLRVSATFWQNPRNHFRCQVQFYGLSENDEWTQDRAKPVTQIVSAEAWGRADCGFTSVSYQQGVLSATILYEILLGKATLYAVLVSALVLMAMVKRKDF
2- stitchr
always requires there to be a constant region supplied, as adding the C is one of the required parts of its function. You're right, the command line version does cope without one, but that's because it's doing some extra checks the under the hood to infer the C before running the stitch
function:
For human and mouse TCRs, the script will use the TRBC gene located in the same cluster as the J gene (i.e. TRBJ1-1 through TRBJ1-6 will get TRBC1, while TRBJ2-1 through TRBJ2-7 will get TRBC2). This can be overriden (see optional arguments). Unfortunately we are not experts in TCR loci architecture of all species, so we haven’t hard-wired any other constant region assumptions, so for all other species you’ll need to explicitly state which constant region you want used.
When using the bare function you're going to have to make that determination yourself for each of your rearrangement. Alternatively if you don't care about the constant you can just specify the same C for all of them and trim it off later, or use the extra gene file to apply some arbitrary sequence in place of the C.
Hope that helps!
Jamie
from stitchr.
No probs, my pleasure - glad to see people using the tool!
from stitchr.
Sorry to re-float this, I am trying to run Stitchr inside R
in the same way as above, but this time trying to get rid of the python file that I create, and instead passing the arguments as variables to the stitch function.
I'm not very proficient with Python, so I think the below code needs converting the variables with reticulate
, using r_to_py()
or something.
this is my best attempt:
fxn <- reticulate::import("Stitchr.stitchrfunctions")
st <- reticulate::import("Stitchr.stitchr")
chain <- "TRB"
species <- "HUMAN"
output <- fxn$get_imgt_data(chain, st$gene_types, species)
tcr_dat <- output[[1]]
functionality <- output[[2]]
partial <- output[[3]]
codons <- fxn$get_optimal_codons('', species)
tcr_bits <- list(v = 'TRBV7-3*01',
j = 'TRBJ1-1*01',
cdr3 = 'CASSYLQAQYTEAFF',
l = 'TRBV7-3*01',
c = 'TRBC1*01',
skip_c_checks = 'False',
species = species,
seamless = 'False',
'5_prime_seq' = '',
'3_prime_seq' = '',
name = 'TCR')
stitched <- st$stitch(tcr_bits, tcr_dat, functionality, partial, codons, 3, '')
but I get:
Error in py_call_impl(callable, call_args$unnamed, call_args$named) :
KeyError: 'TRBV7-3'
Do you have any insight on how to solve this? Thanks!
from stitchr.
I'm afraid that I don't use R much (or reticulate
at all), and that's not a stitchr
error, so I can't offer much insight here. I've confirmed that the TCR details and stitchr
commands in the python example in the docs work, and it looks like they've been converted OK here.
Is the underlying data there/OK? What's the content of tcr_dat
and output
? Ordinarily stitchr
will throw errors if it can't find the data in the right place, but I don't know how/if reticulate
handles python errors.
from stitchr.
Related Issues (20)
- Simplifying output / silent mode HOT 1
- J/C region broken in certain genes in skip/extra gene mode HOT 1
- Lower case CDR3 amino acid characters cause an error HOT 1
- TRDV2 error HOT 2
- Possible to use custom species (non-human/non-mouse)? HOT 1
- Alternative non-templated codon usage?
- Improve % of perfectly replicated CDR3s when using a NT CDR3
- Add -cite option to stitchr
- thimble function gives an error for LEADER sequence when stitching TCR HOT 3
- Compatibility of stitchr with Windows HOT 5
- CDR1/2 HOT 2
- Wild card usage in Thimble ignores extra genes (-xg/additional-genes.fasta)
- First example at https://jamieheather.github.io/stitchr/installation.html not working as expected HOT 2
- Specify databases location HOT 5
- Add option to read FASTA automatically into additional-genes.fasta
- Add more details to docs about different error/warning messages HOT 1
- TRBD gene HOT 2
- Integration with tidytcells HOT 4
- A issue about stitching immunoglobulins HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from stitchr.